diff --git a/CMakeLists.txt b/CMakeLists.txt index d1a1297f2f..d8cdb320a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,12 +26,15 @@ list( APPEND CMAKE_C_PREPROCESSOR_FLAGS -P -nostdinc -traditional ) include( CMakePackageConfigHelpers ) include( CheckIPOSupported ) + +# WRF helper scripts include( c_preproc ) include( m4_preproc ) include( target_copy ) include( confcheck ) include( gitinfo ) include( printOption ) +include( target_source_properties ) include( wrf_case_setup ) include( wrf_get_version ) @@ -127,6 +130,9 @@ set( WRF_CASE_OPTIONS EM_CONVRAD EM_SQUALL2D_X EM_SQUALL2D_Y + + # No case selected, for situations where we are not compiling ARW + NONE ) set( WRF_CASE "" CACHE STRING "WRF_CASE" ) @@ -220,6 +226,11 @@ if ( NOT ${WRF_CORE} IN_LIST WRF_CORE_OPTIONS ) message( FATAL_ERROR "WRF Core option not recognized : ${WRF_CORE}" ) endif() +if ( NOT ${WRF_CORE} STREQUAL "ARW" ) + message( STATUS "All non-ARW Cores requires using pointers in grid state struct" ) + set( USE_ALLOCATABLES OFF CACHE BOOL "Required by configuration" FORCE ) +endif() + if ( NOT ${WRF_NESTING} IN_LIST WRF_NESTING_OPTIONS ) message( FATAL_ERROR "WRF Nesting option not recognized : ${WRF_NESTING}" ) endif() @@ -303,6 +314,51 @@ if ( ${USE_IPO} ) endif() endif() + +################################################################################ +## +## Create our flags / defines properties and variables to carry our information +## +################################################################################ +define_target_source_properties( + PROPERTIES + COMPILE_OPTIONS_OPTIMIZATION # Control of optimization flags + COMPILE_OPTIONS_CONFCHECK # Originate from system configuration checks + COMPILE_OPTIONS_OPTIONS # Derived from options + COMPILE_OPTIONS_Fortran_PRECISION # Fortran floating point precision control + COMPILE_OPTIONS_Fortran_LINE_LENGTH # Fortran line length for compilers that need it + COMPILE_OPTIONS_DIAGNOSTICS # Extra flags for diagnostics + COMPILE_OPTIONS_SUPPRESS_ERRORS # EXPLICITLY suppress errors, USE SPARINGLY!!! + COMPILE_OPTIONS_SUPPRESS_WARNINGS # Suppress warnings, try to fix before they become errs + COMPILE_OPTIONS_STANZA # Any remaining flags imported via stanza + + COMPILE_DEFINITIONS_CONFCHECK # Originate from system configuration checks + COMPILE_DEFINITIONS_OPTIONS # Anything that is derived from options + COMPILE_DEFINITIONS_STANZA # Any remaining defines imported via stanza + ) + +# These will be the cumulative set for quicker reference +set( PROJECT_COMPILE_OPTIONS "" ) +set( PROJECT_COMPILE_DEFINITIONS "" ) + +# Recreate these as project variables so that they may be re-used generically +set( PROJECT_COMPILE_OPTIONS_OPTIMIZATION "" ) +set( PROJECT_COMPILE_OPTIONS_CONFCHECK "" ) +set( PROJECT_COMPILE_OPTIONS_OPTIONS "" ) +set( PROJECT_COMPILE_OPTIONS_Fortran_PRECISION "" ) +set( PROJECT_COMPILE_OPTIONS_Fortran_LINE_LENGTH "" ) +set( PROJECT_COMPILE_OPTIONS_DIAGNOSTICS "" ) +set( PROJECT_COMPILE_OPTIONS_SUPPRESS_ERRORS "" ) +set( PROJECT_COMPILE_OPTIONS_SUPPRESS_WARNINGS "" ) +set( PROJECT_COMPILE_OPTIONS_STANZA "" ) +set( PROJECT_COMPILE_DEFINITIONS_CONFCHECK "" ) +set( PROJECT_COMPILE_DEFINITIONS_OPTIONS "" ) +set( PROJECT_COMPILE_DEFINITIONS_STANZA ${WRF_ARCH_LOCAL} ) + +# Make these imported variables easier to use in genexp +separate_arguments( WRF_FCOPTIM ) +separate_arguments( WRF_FCNOOPT ) + ################################################################################ ## ## Now find packages that cross-compilation is potentially handled @@ -322,21 +378,21 @@ if ( ${USE_MPI} ) # It still technically finds MPI but the output is nonintuitive # saying things like hdf5 or pthread find_package( MPI REQUIRED COMPONENTS Fortran C ) - add_compile_definitions( - USE_MPI=1 - DM_PARALLEL - ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS + USE_MPI=1 + DM_PARALLEL + ) if ( DEFINED WRF_MPI_Fortran_FLAGS AND NOT "${WRF_MPI_Fortran_FLAGS}" STREQUAL "" ) - add_compile_options( - $<$:${WRF_MPI_Fortran_FLAGS}> - ) + list( APPEND PROJECT_COMPILE_OPTIONS_OPTIONS + $<$:${WRF_MPI_Fortran_FLAGS}> + ) endif() if ( DEFINED WRF_MPI_C_FLAGS AND NOT "${WRF_MPI_C_FLAGS}" STREQUAL "" ) - add_compile_options( - $<$:${WRF_MPI_C_FLAGS}> - ) + list( APPEND PROJECT_COMPILE_OPTIONS_OPTIONS + $<$:${WRF_MPI_C_FLAGS}> + ) endif() # Check if MPI in all its glory has forced IPO down our throats due to hard-coding the wrapper flags @@ -365,16 +421,19 @@ if ( ${USE_MPI} ) set( USE_RSL_LITE ON ) # We know NONE is the zero index so compare against that elseif( ${CURRENT_NESTING_IDX} GREATER 0 ) - add_compile_definitions( - DM_PARALLEL - STUBMPI - ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS + DM_PARALLEL + STUBMPI + ) set( USE_RSL_LITE ON ) endif() if ( ${USE_OPENMP} ) find_package( OpenMP REQUIRED COMPONENTS Fortran C ) - add_compile_definitions( USE_OPENMP=1 SM_PARALLEL ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS + USE_OPENMP=1 + SM_PARALLEL + ) endif() if ( ${USE_M4} ) @@ -504,87 +563,63 @@ add_subdirectory( confcheck ) ## ################################################################################ -# https://stackoverflow.com/a/47927921 -# Define compile options to be inherited for directories -define_property( - SOURCE - PROPERTY COMPILE_FLAGS - INHERITED - BRIEF_DOCS "brief-doc" - FULL_DOCS "full-doc" - ) - -define_property( - DIRECTORY - PROPERTY COMPILE_FLAGS - INHERITED - BRIEF_DOCS "brief-doc" - FULL_DOCS "full-doc" - ) - # Get current build type flags and put them in there if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) - set_directory_properties( - PROPERTIES - COMPILE_FLAGS - $<$:${WRF_FCOPTIM}> - ) + set( PROJECT_COMPILE_OPTIONS_OPTIMIZATION $<$:${WRF_FCOPTIM}> ) # else() # # Assume no optimization -# set_directory_properties( -# PROPERTIES -# COMPILE_FLAGS -# $<$:${WRF_FCNOOPT}> -# ) +# set( PROJECT_COMPILE_OPTIONS_OPTIMIZATION $<$:${WRF_FCNOOPT}> ) endif() # This is really ugly but such is the cost of supporting many ways to say the same thing # https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html -add_compile_options( - # Use "" and ; specifically to evaluate correctly - # "$<$:>" #@ Absoft Fortran - # "$<$:>" #@ Analog VisualDSP++ - # "$<$:>" #@ Apple Clang - # "$<$:>" #@ ARM Compiler - # "$<$:>" #@ ARM Compiler based on Clang - # "$<$:>" #@ Bruce C Compiler - # "$<$:>" #@ Concurrent Fortran - # "$<$:>" #@ LLVM Clang - "$<$:-s;integer32;-s;real${RWORDSIZE_B}>" #@ Cray Compiler - # "$<$:>" #@ Embarcadero - "$<$,$>:-fdefault-real-${RWORDSIZE}>" #@ Classic Flang Fortran Compiler - # "$<$:>" #@ LLVM Flang Fortran Compiler - "$<$:-CcdRR${RWORDSIZE}>" #@ Fujitsu HPC compiler (Trad mode) - # "$<$:>" #@ Fujitsu HPC compiler (Clang mode) - "$<$:-r${RWORDSIZE};-i4>" #@ G95 Fortran - "$<$,$>:-fdefault-real-${RWORDSIZE}>" #@ GNU Compiler Collection - # "$<$:>" #@ Green Hills Software - # "$<$:>" #@ Hewlett-Packard Compiler - # "$<$:>" #@ IAR Systems - "$<$:-real-size;${RWORDSIZE_B};-i4>" #@ Intel Classic Compiler - "$<$:-real-size;${RWORDSIZE_B};-i4>" #@ Intel LLVM-Based Compiler - # "$<$:>" #@ MCST Elbrus C/C++/Fortran Compiler - # "$<$:>" #@ Microsoft Visual Studio - "$<$:-r${RWORDSIZE};-i4>" #@ NVIDIA HPC Compiler - # "$<$:>" #@ NVIDIA CUDA Compiler - # "$<$:>" #@ Open Watcom - "$<$:-r${RWORDSIZE};-i4>" #@ The Portland Group - "$<$:-r${RWORDSIZE};-i4>" #@ PathScale - # "$<$:>" #@ Small Device C Compiler - # "$<$:>" #@ Oracle Solaris Studio - # "$<$:>" #@ Tasking Compiler Toolsets - # "$<$:>" #@ Texas Instruments - # "$<$:>" #@ Tiny C Compiler - "$<$:-qrealsize=${RWORDSIZE};-qintsize=4>" #@ IBM XL - # "$<$:>" #@ IBM Clang-based XL - # "$<$:>" #@ IBM LLVM-based Compiler - # Todo find how to handle default selection or add new compiler IDs - # unknown how to add support for sxf90 - - # line lengths - "$<$:-ffree-line-length-none>" #@ GNU Compiler Collection - ) +list( APPEND PROJECT_COMPILE_OPTIONS_Fortran_PRECISION + # Use "" and ; specifically to evaluate correctly + # "$<$:>" #@ Absoft Fortran + # "$<$:>" #@ Analog VisualDSP++ + # "$<$:>" #@ Apple Clang + # "$<$:>" #@ ARM Compiler + # "$<$:>" #@ ARM Compiler based on Clang + # "$<$:>" #@ Bruce C Compiler + # "$<$:>" #@ Concurrent Fortran + # "$<$:>" #@ LLVM Clang + "$<$:-s;integer32;-s;real${RWORDSIZE_B}>" #@ Cray Compiler + # "$<$:>" #@ Embarcadero + "$<$,$>:-fdefault-real-${RWORDSIZE}>" #@ Classic Flang Fortran Compiler + # "$<$:>" #@ LLVM Flang Fortran Compiler + "$<$:-CcdRR${RWORDSIZE}>" #@ Fujitsu HPC compiler (Trad mode) + # "$<$:>" #@ Fujitsu HPC compiler (Clang mode) + "$<$:-r${RWORDSIZE};-i4>" #@ G95 Fortran + "$<$,$>:-fdefault-real-${RWORDSIZE}>" #@ GNU Compiler Collection + # "$<$:>" #@ Green Hills Software + # "$<$:>" #@ Hewlett-Packard Compiler + # "$<$:>" #@ IAR Systems + "$<$:-real-size;${RWORDSIZE_B};-i4>" #@ Intel Classic Compiler + "$<$:-real-size;${RWORDSIZE_B};-i4>" #@ Intel LLVM-Based Compiler + # "$<$:>" #@ MCST Elbrus C/C++/Fortran Compiler + # "$<$:>" #@ Microsoft Visual Studio + "$<$:-r${RWORDSIZE};-i4>" #@ NVIDIA HPC Compiler + # "$<$:>" #@ NVIDIA CUDA Compiler + # "$<$:>" #@ Open Watcom + "$<$:-r${RWORDSIZE};-i4>" #@ The Portland Group + "$<$:-r${RWORDSIZE};-i4>" #@ PathScale + # "$<$:>" #@ Small Device C Compiler + # "$<$:>" #@ Oracle Solaris Studio + # "$<$:>" #@ Tasking Compiler Toolsets + # "$<$:>" #@ Texas Instruments + # "$<$:>" #@ Tiny C Compiler + "$<$:-qrealsize=${RWORDSIZE};-qintsize=4>" #@ IBM XL + # "$<$:>" #@ IBM Clang-based XL + # "$<$:>" #@ IBM LLVM-based Compiler + # Todo find how to handle default selection or add new compiler IDs + # unknown how to add support for sxf90 + ) + +list( APPEND PROJECT_COMPILE_OPTIONS_Fortran_LINE_LENGTH + # line lengths + "$<$:-ffree-line-length-none>" #@ GNU Compiler Collection + ) # https://stackoverflow.com/a/53155812 @@ -592,114 +627,240 @@ add_compile_options( # message( STATUS "Set Fortran_COMPILER_ID to : ${Fortran_COMPILER_ID}" ) -# Whole project flags -add_compile_options( - # $<$:-cpp> - # Use "" and ; specifically to evaluate correctly - "$<$:-diag-disable;6843>" - $<$,$>:-fallow-argument-mismatch> - $<$,$>:-fallow-invalid-boz> - $<$,$>:-ffree-line-length-none> +list( APPEND PROJECT_COMPILE_OPTIONS_SUPPRESS_WARNINGS + # Use "" and ; specifically to evaluate correctly + "$<$:-diag-disable;6843>" + ) - # $,$:-diag-disable;6843> - ) +list( APPEND PROJECT_COMPILE_OPTIONS_SUPPRESS_ERRORS + $<$,$>:-fallow-argument-mismatch> + $<$,$>:-fallow-invalid-boz> + $<$,$>:-ffree-line-length-none> + ) if ( ${PROFILE_COMPILATION} ) message( STATUS "Attemping to add compilation profiling..." ) - add_compile_options( - $<$:-ftime-report> - ) + list( APPEND PROJECT_COMPILE_OPTIONS_DIAGNOSTICS $<$:-ftime-report> ) endif() -add_compile_definitions( - MAX_DOMAINS_F=${MAX_DOMAINS_F} - CONFIG_BUF_LEN=${CONFIG_BUF_LEN} - MAX_HISTORY=${MAX_HISTORY} - IWORDSIZE=${IWORDSIZE} - DWORDSIZE=${DWORDSIZE} - LWORDSIZE=${LWORDSIZE} - RWORDSIZE=${RWORDSIZE} - # Only define if set, this is to use #ifdef/#ifndef preprocessors - # in code since cmake cannot handle basically any others :( - # https://gitlab.kitware.com/cmake/cmake/-/issues/17398 - $<$:WRF_CHEM=$> - $<$:BUILD_CHEM=$> - $<$:WRF_CMAQ=$> - $<$,$>:WRF_KPP=$> - $<$:WRF_DFI_RADAR=$> - $<$:WRF_TITAN=$> - $<$:WRF_MARS=$> - $<$:WRF_VENUS=$> - $<$:WRF_HYDRO=$> - - # Because once again we need two defines to control one thing - $<$:WRF_USE_CTSM=$> - $<$>:WRF_USE_CLM> - - # If force classic or no nc-4 support enable classic - $<$,$>>:NETCDF_classic=1> - $<$,$>>:WRFIO_NCD_NO_LARGE_FILE_SUPPORT=1> - # May need a check for WRFIO_ncdpar_LARGE_FILE_SUPPORT - - # Now set the opposite in different defines, because why not :) - $<$>,$>:USE_NETCDF4_FEATURES=1> - $<$>,$>:WRFIO_NCD_LARGE_FILE_SUPPORT=1> - - # Could simplify logic to just check if RPC is available but to be explicit - # Does this actually need to check for EM_CORE (Config.pl:443) - # not enable terran or not rpc_found do - # not ( enable terrain and rpc_found ) - $<$,$>>:LANDREAD_STUB> - $<$:TERRAIN_AND_LANDUSE> - - - $<$:USE_ALLOCATABLES> - $<$:wrfmodel> - $<$:GRIB1> - $<$:INTIO> - $<$:KEEP_INT_AROUND> - $<$:LIMIT_ARGS> - - #!TODO Always defined - fix the ambiguous english in these BUILD_*_FAST defines - BUILD_RRTMG_FAST=$ - BUILD_RRTMK=$ - BUILD_SBM_FAST=$ - SHOW_ALL_VARS_USED=$ - - # Alwasys set - NMM_CORE=$ - NMM_MAX_DIM=2600 - NETCDF - - #!TODO Change this to a confcheck - NONSTANDARD_SYSTEM_SUBR - - EM_CORE=${EM_CORE} - WRFPLUS=$> - DA_CORE=$,$>> - # DFI_RADAR=$ - - # Nesting options - $<$:MOVE_NESTS> - $<$>:VORTEX_CENTER> - - # Configuration checks - $<$>:NO_IEEE_MODULE> - $<$>:NO_ISO_C_SUPPORT> - # If flush fails, check if we can fall back to fflush, and if not no support - $<$>:$,USE_FFLUSH,NO_FLUSH_SUPPORT>> - $<$>:NO_GAMMA_SUPPORT> - - #!TODO Leaving as is in WRF for now but investigate why we don't do this - # https://stackoverflow.com/a/1035713 - # If fseeko64 succeeds, use that, else check if we can fall back to fseeko, and if not just use fseek - $,FSEEKO64_OK,$,FSEEKO_OK,FSEEK_OK>> - - # I don't believe these are used anymore... - # $<$:MPI2_SUPPORT=$> - # $<$:MPI2_THREAD_SUPPORT=$> +list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS + MAX_DOMAINS_F=${MAX_DOMAINS_F} + CONFIG_BUF_LEN=${CONFIG_BUF_LEN} + MAX_HISTORY=${MAX_HISTORY} + IWORDSIZE=${IWORDSIZE} + DWORDSIZE=${DWORDSIZE} + LWORDSIZE=${LWORDSIZE} + RWORDSIZE=${RWORDSIZE} - ) + + # Alwasys set + NMM_MAX_DIM=2600 + NETCDF + + #!TODO Change this to a confcheck + # NONSTANDARD_SYSTEM_SUBR # For now let this come from stanza + + EM_CORE=${EM_CORE} + + ) + + +# Only define if set, this is to use #ifdef/#ifndef preprocessors +# in code since cmake cannot handle basically any others :( +# https://gitlab.kitware.com/cmake/cmake/-/issues/17398 +if ( ${USE_DOUBLE} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS DOUBLE_PRECISION ) +endif() +if ( ${ENABLE_CHEM} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS WRF_CHEM=1 ) + if ( ${ENABLE_KPP} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS WRF_KPP=1 ) + endif() +endif() +if ( ${ENABLE_CHEM} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS BUILD_CHEM=1 ) +endif() +if ( ${ENABLE_CMAQ} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS WRF_CMAQ=1 ) +endif() +if ( ${ENABLE_DFI_RADAR} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS WRF_DFI_RADAR=1 ) +endif() +if ( ${ENABLE_TITAN} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS WRF_TITAN=1 ) +endif() +if ( ${ENABLE_MARS} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS WRF_MARS=1 ) +endif() +if ( ${ENABLE_VENUS} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS WRF_VENUS=1 ) +endif() +if ( ${ENABLE_HYDRO} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS WRF_HYDRO=1 ) +endif() + +# Because once again we need two defines to control one thing +if ( ${ENABLE_CTSM} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS WRF_USE_CTSM ) +else() + #!TODO there are some files that rely on this being 1, but that is never set by the legacy make system + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS WRF_USE_CLM ) +endif() + +# If force classic or no nc-4 support enable classic +if ( ${FORCE_NETCDF_CLASSIC} OR ( NOT ${netCDF_NC4} ) ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS NETCDF_classic=1 ) +endif() +if ( ${WRFIO_NCD_NO_LARGE_FILE_SUPPORT} OR ( NOT ${netCDF_LARGE_FILE_SUPPORT} ) ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS WRFIO_NCD_NO_LARGE_FILE_SUPPORT=1 ) +endif() +# May need a check for WRFIO_ncdpar_LARGE_FILE_SUPPORT + +# Now set the opposite in different defines, because why not :) +if ( ( NOT ${FORCE_NETCDF_CLASSIC} ) AND ${netCDF_NC4} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS USE_NETCDF4_FEATURES=1 ) +endif() +if ( ( NOT ${WRFIO_NCD_NO_LARGE_FILE_SUPPORT} ) AND ${netCDF_LARGE_FILE_SUPPORT} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS WRFIO_NCD_LARGE_FILE_SUPPORT=1 ) +endif() + +# Could simplify logic to just check if RPC is available but to be explicit +# Does this actually need to check for EM_CORE (Config.pl:443) +# not enable terran or not rpc_found do +# not ( enable terrain and rpc_found ) +# if ( NOT ( ${ENABLE_TERRAIN} AND ${RPC_FOUND} ) ) # this is wrong, needs fixing +# list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS LANDREAD_STUB ) +# endif() +if ( ${ENABLE_TERRAIN} AND ${MOVE_NESTS} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS TERRAIN_AND_LANDUSE ) +else () + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS LANDREAD_STUB ) +endif() + +if ( ${USE_ALLOCATABLES} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS USE_ALLOCATABLES ) +endif() +if ( ${wrfmodel} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS wrfmodel ) +endif() +if ( ${GRIB1} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS GRIB1 ) +endif() +if ( ${INTIO} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS INTIO ) +endif() +if ( ${KEEP_INT_AROUND} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS KEEP_INT_AROUND ) +endif() +if ( ${LIMIT_ARGS} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS LIMIT_ARGS ) +endif() + + +if ( ${BUILD_RRTMG_FAST} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS BUILD_RRTMG_FAST=1 ) +else() + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS BUILD_RRTMG_FAST=0 ) +endif() +if ( ${BUILD_RRTMK} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS BUILD_RRTMK=1 ) +else() + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS BUILD_RRTMK=0 ) +endif() +if ( ${BUILD_SBM_FAST} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS BUILD_SBM_FAST=1 ) +else() + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS BUILD_SBM_FAST=0 ) +endif() +if ( ${SHOW_ALL_VARS_USED} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS SHOW_ALL_VARS_USED=1 ) +else() + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS SHOW_ALL_VARS_USED=0 ) +endif() +if ( ${NMM_CORE} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS NMM_CORE=1 ) +else() + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS NMM_CORE=0 ) +endif() + +if ( "${WRF_CORE}" STREQUAL "PLUS" ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS WRFPLUS=1 ) +else() + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS WRFPLUS=0 ) +endif() + +if ( "${WRF_CORE}" STREQUAL "DA_CORE" OR "${WRF_CORE}" STREQUAL "DA_4D_VAR" ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS DA_CORE=1 ) +else() + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS DA_CORE=0 ) +endif() +# DFI_RADAR=$ + +# Nesting options +if ( ${MOVE_NESTS} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS MOVE_NESTS ) +endif() +if ( "${WRF_NESTING}" STREQUAL "VORTEX" ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_OPTIONS VORTEX_CENTER ) +endif() + +# Configuration checks +if ( NOT ${Fortran_2003_IEEE} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_CONFCHECK NO_IEEE_MODULE ) +endif() +if ( NOT ${Fortran_2003_ISO_C} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_CONFCHECK NO_ISO_C_SUPPORT ) +endif() +# If flush fails, check if we can fall back to fflush, and if not no support +if ( NOT ${Fortran_2003_FLUSH} ) + if ( "${Fortran_2003_FFLUSH}" ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_CONFCHECK USE_FFLUSH ) + else() + list( APPEND PROJECT_COMPILE_DEFINITIONS_CONFCHECK NO_FLUSH_SUPPORT ) + endif() +endif() +if ( NOT ${Fortran_2003_GAMMA} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_CONFCHECK NO_GAMMA_SUPPORT ) +endif() + +#!TODO Leaving as is in WRF for now but investigate why we don't do this +# https://stackoverflow.com/a/1035713 +# If fseeko64 succeeds, use that, else check if we can fall back to fseeko, and if not just use fseek +if ( ${FSEEKO64} ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_CONFCHECK FSEEKO64_OK ) +elseif( "${FSEEKO}" ) + list( APPEND PROJECT_COMPILE_DEFINITIONS_CONFCHECK FSEEKO_OK ) +else() + list( APPEND PROJECT_COMPILE_DEFINITIONS_CONFCHECK FSEEK_OK ) +endif() + +# I don't believe these are used anymore... +# $<$:MPI2_SUPPORT=$> +# $<$:MPI2_THREAD_SUPPORT=$> + +# Accumulate option and definitions +list( APPEND PROJECT_COMPILE_OPTIONS + ${PROJECT_COMPILE_OPTIONS_OPTIMIZATION} + ${PROJECT_COMPILE_OPTIONS_CONFCHECK} + ${PROJECT_COMPILE_OPTIONS_OPTIONS} + ${PROJECT_COMPILE_OPTIONS_Fortran_PRECISION} + ${PROJECT_COMPILE_OPTIONS_Fortran_LINE_LENGTH} + ${PROJECT_COMPILE_OPTIONS_DIAGNOSTICS} + ${PROJECT_COMPILE_OPTIONS_SUPPRESS_ERRORS} + ${PROJECT_COMPILE_OPTIONS_SUPPRESS_WARNINGS} + ${PROJECT_COMPILE_OPTIONS_STANZA} + ) +list( APPEND PROJECT_COMPILE_DEFINITIONS + ${PROJECT_COMPILE_DEFINITIONS_CONFCHECK} + ${PROJECT_COMPILE_DEFINITIONS_OPTIONS} + ${PROJECT_COMPILE_DEFINITIONS_STANZA} + ) + +################################################################################ +## +## DO NOT modify PROJECT_COMPILE_* beyond this point +## +################################################################################ # Make core target @@ -708,6 +869,23 @@ add_library( STATIC ) +set_target_properties( + ${PROJECT_NAME}_Core + PROPERTIES + COMPILE_OPTIONS_OPTIMIZATION "${PROJECT_COMPILE_OPTIONS_OPTIMIZATION}" + COMPILE_OPTIONS_CONFCHECK "${PROJECT_COMPILE_OPTIONS_CONFCHECK}" + COMPILE_OPTIONS_OPTIONS "${PROJECT_COMPILE_OPTIONS_OPTIONS}" + COMPILE_OPTIONS_Fortran_PRECISION "${PROJECT_COMPILE_OPTIONS_Fortran_PRECISION}" + COMPILE_OPTIONS_Fortran_LINE_LENGTH "${PROJECT_COMPILE_OPTIONS_Fortran_LINE_LENGTH}" + COMPILE_OPTIONS_DIAGNOSTICS "${PROJECT_COMPILE_OPTIONS_DIAGNOSTICS}" + COMPILE_OPTIONS_SUPPRESS_ERRORS "${PROJECT_COMPILE_OPTIONS_SUPPRESS_ERRORS}" + COMPILE_OPTIONS_SUPPRESS_WARNINGS "${PROJECT_COMPILE_OPTIONS_SUPPRESS_WARNINGS}" + COMPILE_OPTIONS_STANZA "${PROJECT_COMPILE_OPTIONS_STANZA}" + # We do not use compile definitions for CMake's lack of source file accounting + ) + +# Do NOT apply these options or defines just yet, allow files to be added and set their own properties + # Supplemental to core, or rather should be, some stuff in external is legitimately part of WRF and others # are source code from truly external repositories - albeit old versions add_subdirectory( external ) @@ -719,6 +897,68 @@ add_dependencies( # So many things depend on this that I'm adding a dep here registry_code ) + +# Add directly to core +add_subdirectory( phys ) +add_subdirectory( share ) +add_subdirectory( frame ) +add_subdirectory( inc ) + +if ( ${WRF_CHEM} ) + add_subdirectory( chem ) +endif() + +if ( ${ENABLE_HYDRO} ) + add_subdirectory( hydro ) +endif() + +add_subdirectory( dyn_em ) + + +add_subdirectory( main ) + +################################################################################ +# Add subdirectory with case info +################################################################################ +if ( ${CURRENT_WRF_CORE_IDX} GREATER_EQUAL ${START_DA_IDX} ) + message( STATUS "DA or PLUS build, WRF_CASE selection ignored" ) +else() + add_subdirectory( test/${WRF_CASE_FOLDER} ) +endif() + + + +################################################################################ +## +## DO NOT add sources beyond this point +## +################################################################################ + +# gather compile info and apply +apply_target_source_properties( + TARGETS ${PROJECT_NAME}_Core + PROPERTIES + COMPILE_OPTIONS_OPTIMIZATION + COMPILE_OPTIONS_CONFCHECK + COMPILE_OPTIONS_OPTIONS + COMPILE_OPTIONS_Fortran_PRECISION + COMPILE_OPTIONS_Fortran_LINE_LENGTH + COMPILE_OPTIONS_DIAGNOSTICS + COMPILE_OPTIONS_SUPPRESS_ERRORS + COMPILE_OPTIONS_SUPPRESS_WARNINGS + COMPILE_OPTIONS_STANZA + AS_PROPERTY COMPILE_OPTIONS + ) + +target_compile_definitions( + ${PROJECT_NAME}_Core + PRIVATE + ${PROJECT_COMPILE_DEFINITIONS_CONFCHECK} + ${PROJECT_COMPILE_DEFINITIONS_OPTIONS} + ${PROJECT_COMPILE_DEFINITIONS_STANZA} + ) + + target_include_directories( ${PROJECT_NAME}_Core PUBLIC @@ -777,34 +1017,6 @@ target_include_directories( ${pnetCDF_INCLUDE_DIRS} ) -# Add directly to core -add_subdirectory( phys ) -add_subdirectory( share ) -add_subdirectory( frame ) -add_subdirectory( inc ) - -if ( ${WRF_CHEM} ) - add_subdirectory( chem ) -endif() - -if ( ${ENABLE_HYDRO} ) - add_subdirectory( hydro ) -endif() - -add_subdirectory( dyn_em ) - - -add_subdirectory( main ) - -################################################################################ -# Add subdirectory with case info -################################################################################ -if ( ${CURRENT_WRF_CORE_IDX} GREATER_EQUAL ${START_DA_IDX} ) - message( STATUS "DA or PLUS build, WRF_CASE selection ignored" ) -else() - add_subdirectory( test/${WRF_CASE_FOLDER} ) -endif() - # Configure core set_target_properties( ${PROJECT_NAME}_Core @@ -815,6 +1027,8 @@ set_target_properties( EXPORT_PROPERTIES Fortran_MODULE_DIRECTORY ) +target_link_options( ${PROJECT_NAME}_Core PRIVATE ${WRF_LINK_FLAGS} ) + # Because of the way netCDF provides its info and the way cmake auto-gens RPATH, we need to help it along target_link_directories( ${PROJECT_NAME}_Core diff --git a/Makefile b/Makefile index 2bdff94d81..6fc8f380be 100644 --- a/Makefile +++ b/Makefile @@ -595,7 +595,7 @@ em_real : wrf ln -sf ../../run/ishmael-qi-qr.bin . ; \ ln -sf ../../run/BROADBAND_CLOUD_GODDARD.bin . ; \ ln -sf ../../run/STOCHPERT.TBL . ; \ - if [ $(RWORDSIZE) -eq 8 ] ; then \ + if [ -n "$(DOUBLE_PRECISION)" ] ; then \ ln -sf ../../run/ETAMPNEW_DATA_DBL ETAMPNEW_DATA ; \ ln -sf ../../run/ETAMPNEW_DATA.expanded_rain_DBL ETAMPNEW_DATA.expanded_rain ; \ ln -sf ../../run/RRTM_DATA_DBL RRTM_DATA ; \ @@ -677,7 +677,7 @@ em_real : wrf ln -sf ../../run/ishmael-qi-qr.bin . ; \ ln -sf ../../run/BROADBAND_CLOUD_GODDARD.bin . ; \ ln -sf ../../run/STOCHPERT.TBL . ; \ - if [ $(RWORDSIZE) -eq 8 ] ; then \ + if [ -n "$(DOUBLE_PRECISION)" ] ; then \ ln -sf ../../run/ETAMPNEW_DATA_DBL ETAMPNEW_DATA ; \ ln -sf ../../run/ETAMPNEW_DATA.expanded_rain_DBL ETAMPNEW_DATA.expanded_rain ; \ ln -sf ../../run/RRTM_DATA_DBL RRTM_DATA ; \ diff --git a/arch/Config.pl b/arch/Config.pl index 761c540abe..0c36ddcf12 100644 --- a/arch/Config.pl +++ b/arch/Config.pl @@ -25,6 +25,7 @@ $sw_compileflags=""; $sw_opt_level=""; $sw_rwordsize="\$\(NATIVE_RWORDSIZE\)"; +$sw_promotion=""; $sw_rttov_flag = "" ; $sw_rttov_inc = "" ; $sw_rttov_path = "" ; @@ -228,6 +229,10 @@ { $sw_config_line=substr( $ARGV[0], 13 ) ; } + if ( substr( $ARGV[0], 1, 6 ) eq "rword=" ) + { + $sw_rwordsize=substr( $ARGV[0], 7 ) ; + } shift @ARGV ; } @@ -316,6 +321,10 @@ } $sw_rwordsize = "8" if ( $sw_wrfplus_core eq "-DWRFPLUS=1" ); + if ( $sw_rwordsize eq "8" ) + { + $sw_promotion = "-DDOUBLE_PRECISION" ; + } # A separately-installed ESMF library is required to build the ESMF # implementation of WRF IOAPI in external/io_esmf. This is needed @@ -634,6 +643,7 @@ $_ =~ s/CONFIGURE_LDFLAGS/$sw_ldflags/g ; $_ =~ s/CONFIGURE_COMPILEFLAGS/$sw_compileflags/g ; $_ =~ s/CONFIGURE_RWORDSIZE/$sw_rwordsize/g ; + $_ =~ s/CONFIGURE_PROMOTION/$sw_promotion/g ; $_ =~ s/CONFIGURE_FC/$sw_time $sw_fc/g ; $_ =~ s/CONFIGURE_CC/$sw_cc/g ; $_ =~ s/CONFIGURE_COMMS_LIB/$sw_comms_lib/g ; diff --git a/arch/configure_reader.py b/arch/configure_reader.py index fb89bfca80..c52d776af7 100755 --- a/arch/configure_reader.py +++ b/arch/configure_reader.py @@ -17,7 +17,8 @@ osAndArchAlt = re.compile( r"^ARCH[ ]+(\w+)[ ]+(\w+)", re.I ) referenceVar = re.compile( r"[$]([(])?(\w+)(?(1)[)])", re.I ) -compileObject = re.compile( r"(\W)-c(\W)" ) +compileObject = re.compile( r"(\W|^)-c(\W|$)" ) +configureRepl = re.compile( r"(\W|^)CONFIGURE_\w+(\W|$)" ) class Stanza(): @@ -160,52 +161,9 @@ def sanitize( self ) : self.dereference( "FCBASEOPTS" ) # Remove rogue compile commands that should *NOT* even be here - keysToSanitize = [ - "ARFLAGS","ARFLAGS", - "CC", - "CFLAGS_LOCAL", - "CFLAGS", - "COMPRESSION_INC", - "COMPRESSION_LIBS", - "CPP", - "CPPFLAGS", - "DM_CC", - "DM_FC", - "ESMF_LDFLAG", - "F77FLAGS", - "FC", - "FCBASEOPTS_NO_G", - "FCBASEOPTS", - "FCOPTIM", - "FCSUFFIX", - "FDEFS", - "FFLAGS", - "FNGFLAGS", - "FORMAT_FIXED", - "FORMAT_FREE", - "LD", - "LDFLAGS_LOCAL", - "LDFLAGS", - "MODULE_SRCH_FLAG", - "RLFLAGS", - "SCC", - "SFC", - "TRADFLAG", - ] - - for keyToSan in keysToSanitize : - if keyToSan in self.kvPairs_ : - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_COMP_L", "" ) - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_COMP_I", "" ) - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_FC", "" ) - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_CC", "" ) - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_FDEFS", "" ) - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_MPI", "" ) - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_COMPAT_FLAGS", "" ) - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_CPPFLAGS", "" ) - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_TRADFLAG", "" ) - - self.kvPairs_[ keyToSan ] = compileObject.sub( r"\1\2", self.kvPairs_[ keyToSan ] ).strip() + for keyToSan in self.kvPairs_.keys() : + self.kvPairs_[ keyToSan ] = configureRepl.sub( r"\1\2", self.kvPairs_[ keyToSan ] ).strip() + self.kvPairs_[ keyToSan ] = compileObject.sub( r"\1\2", self.kvPairs_[ keyToSan ] ).strip() # Now fix certain ones that are mixing programs with flags all mashed into one option @@ -546,6 +504,7 @@ def generateCMakeToolChainFile( cmakeToolChainTemplate, output, stanza, optionsD configStanza = cmakeToolChainTemplateLines.format( ARCH_LOCAL=stanza.kvPairs_["ARCH_LOCAL"], + LDFLAGS_LOCAL=stanza.kvPairs_["LDFLAGS_LOCAL"], BYTESWAPIO=stanza.kvPairs_["BYTESWAPIO"], CFLAGS_LOCAL=stanza.kvPairs_["CFLAGS_LOCAL"], DM_CC=stanza.kvPairs_["DM_CC"], @@ -575,8 +534,12 @@ def generateCMakeToolChainFile( cmakeToolChainTemplate, output, stanza, optionsD def projectSpecificOptions( options, stanzaCfg ) : coreOption = getStringOptionSelection( options.sourceCMakeFile, "WRF_CORE_OPTIONS", "WRF_CORE" ) - nestingOption = getStringOptionSelection( options.sourceCMakeFile, "WRF_NESTING_OPTIONS", "WRF_NESTING", 1 ) - caseOption = getStringOptionSelection( options.sourceCMakeFile, "WRF_CASE_OPTIONS", "WRF_CASE" ) + if coreOption == "ARW" : + nestingOption = getStringOptionSelection( options.sourceCMakeFile, "WRF_NESTING_OPTIONS", "WRF_NESTING", 1 ) + caseOption = getStringOptionSelection( options.sourceCMakeFile, "WRF_CASE_OPTIONS", "WRF_CASE" ) + else : + nestingOption = "NONE" + caseOption = "NONE" # These are yes yesValues = [ "yes", "y", "true", "1" ] @@ -625,4 +588,4 @@ def projectSpecificOptions( options, stanzaCfg ) : return additionalOptions if __name__ == '__main__' : - main() \ No newline at end of file + main() diff --git a/arch/md_calls.inc b/arch/md_calls.inc index 88e0722fbb..11b6e3be24 100644 --- a/arch/md_calls.inc +++ b/arch/md_calls.inc @@ -258,7 +258,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef NETCDF CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncd_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -280,7 +280,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncdpar_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -291,7 +291,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef PNETCDF CASE ( IO_PNETCDF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -301,7 +301,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PHDF5 CASE ( IO_PHDF5 ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_phdf5_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -311,7 +311,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef ESMFIO CASE ( IO_ESMF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_esmf_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -321,7 +321,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef XXX CASE ( IO_XXX ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_xxx_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -331,7 +331,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef YYY CASE ( IO_YYY ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_yyy_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -342,7 +342,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB1 CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr1_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -365,7 +365,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB2 CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr2_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -388,7 +388,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef INTIO CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_int_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -472,7 +472,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef NETCDF CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncd_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -494,7 +494,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncdpar_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -505,7 +505,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef PNETCDF CASE ( IO_PNETCDF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -515,7 +515,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PHDF5 CASE ( IO_PHDF5 ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_phdf5_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -525,7 +525,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef ESMFIO CASE ( IO_ESMF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_esmf_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -535,7 +535,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef XXX CASE ( IO_XXX ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_xxx_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -545,7 +545,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef YYY CASE ( IO_YYY ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_yyy_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -556,7 +556,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB1 CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr1_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -579,7 +579,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB2 CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr2_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -602,7 +602,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef INTIO CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_int_get_dom_ti_double ( Hndl, Element, Data, & locCount, Outcount, Status ) # else @@ -688,7 +688,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef NETCDF CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncd_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -710,7 +710,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncdpar_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -721,7 +721,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef PNETCDF CASE ( IO_PNETCDF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -731,7 +731,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PHDF5 CASE ( IO_PHDF5 ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_phdf5_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -741,7 +741,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef ESMFIO CASE ( IO_ESMF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_esmf_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -751,7 +751,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef XXX CASE ( IO_XXX ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_xxx_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -761,7 +761,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef YYY CASE ( IO_YYY ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_yyy_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -772,7 +772,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB1 CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr1_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -795,7 +795,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB2 CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr2_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -818,7 +818,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef INTIO CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_int_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -902,7 +902,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef NETCDF CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncd_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -924,7 +924,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncdpar_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -935,7 +935,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef PNETCDF CASE ( IO_PNETCDF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -945,7 +945,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PHDF5 CASE ( IO_PHDF5 ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_phdf5_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -955,7 +955,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef ESMFIO CASE ( IO_ESMF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_esmf_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -965,7 +965,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef XXX CASE ( IO_XXX ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_xxx_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -975,7 +975,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef YYY CASE ( IO_YYY ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_yyy_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -986,7 +986,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB1 CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr1_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -1009,7 +1009,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB2 CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr2_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -1032,7 +1032,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef INTIO CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_int_put_dom_ti_double ( Hndl, Element, Data, & locCount, Status ) # else @@ -3431,7 +3431,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef NETCDF CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncd_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3453,7 +3453,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncdpar_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3464,7 +3464,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef PNETCDF CASE ( IO_PNETCDF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3474,7 +3474,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PHDF5 CASE ( IO_PHDF5 ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_phdf5_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3484,7 +3484,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef ESMFIO CASE ( IO_ESMF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_esmf_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3494,7 +3494,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef XXX CASE ( IO_XXX ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_xxx_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3504,7 +3504,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef YYY CASE ( IO_YYY ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_yyy_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3515,7 +3515,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB1 CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr1_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3538,7 +3538,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB2 CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr2_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3561,7 +3561,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef INTIO CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_int_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3645,7 +3645,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef NETCDF CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncd_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3667,7 +3667,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncdpar_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3678,7 +3678,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef PNETCDF CASE ( IO_PNETCDF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3688,7 +3688,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PHDF5 CASE ( IO_PHDF5 ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_phdf5_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3698,7 +3698,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef ESMFIO CASE ( IO_ESMF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_esmf_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3708,7 +3708,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef XXX CASE ( IO_XXX ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_xxx_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3718,7 +3718,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef YYY CASE ( IO_YYY ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_yyy_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3729,7 +3729,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB1 CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr1_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3752,7 +3752,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB2 CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr2_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3775,7 +3775,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef INTIO CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_int_get_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Outcount, Status ) # else @@ -3861,7 +3861,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef NETCDF CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncd_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -3883,7 +3883,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncdpar_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -3894,7 +3894,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef PNETCDF CASE ( IO_PNETCDF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -3904,7 +3904,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PHDF5 CASE ( IO_PHDF5 ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_phdf5_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -3914,7 +3914,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef ESMFIO CASE ( IO_ESMF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_esmf_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -3924,7 +3924,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef XXX CASE ( IO_XXX ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_xxx_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -3934,7 +3934,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef YYY CASE ( IO_YYY ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_yyy_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -3945,7 +3945,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB1 CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr1_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -3968,7 +3968,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB2 CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr2_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -3991,7 +3991,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef INTIO CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_int_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -4075,7 +4075,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef NETCDF CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncd_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -4097,7 +4097,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncdpar_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -4108,7 +4108,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef PNETCDF CASE ( IO_PNETCDF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -4118,7 +4118,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PHDF5 CASE ( IO_PHDF5 ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_phdf5_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -4128,7 +4128,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef ESMFIO CASE ( IO_ESMF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_esmf_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -4138,7 +4138,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef XXX CASE ( IO_XXX ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_xxx_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -4148,7 +4148,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef YYY CASE ( IO_YYY ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_yyy_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -4159,7 +4159,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB1 CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr1_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -4182,7 +4182,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB2 CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr2_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -4205,7 +4205,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef INTIO CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_int_put_dom_td_double ( Hndl, Element, DateStr, Data, & locCount, Status ) # else @@ -6604,7 +6604,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef NETCDF CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncd_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6626,7 +6626,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncdpar_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6637,7 +6637,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef PNETCDF CASE ( IO_PNETCDF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6647,7 +6647,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PHDF5 CASE ( IO_PHDF5 ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_phdf5_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6657,7 +6657,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef ESMFIO CASE ( IO_ESMF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_esmf_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6667,7 +6667,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef XXX CASE ( IO_XXX ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_xxx_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6677,7 +6677,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef YYY CASE ( IO_YYY ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_yyy_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6688,7 +6688,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB1 CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr1_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6711,7 +6711,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB2 CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr2_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6734,7 +6734,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef INTIO CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_int_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6818,7 +6818,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef NETCDF CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncd_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6840,7 +6840,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncdpar_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6851,7 +6851,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef PNETCDF CASE ( IO_PNETCDF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6861,7 +6861,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PIO CASE ( IO_PIO ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6871,7 +6871,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PHDF5 CASE ( IO_PHDF5 ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_phdf5_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6881,7 +6881,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef ESMFIO CASE ( IO_ESMF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_esmf_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6891,7 +6891,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef XXX CASE ( IO_XXX ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_xxx_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6901,7 +6901,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef YYY CASE ( IO_YYY ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_yyy_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6912,7 +6912,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB1 CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr1_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6935,7 +6935,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB2 CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr2_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -6958,7 +6958,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef INTIO CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_int_get_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Outcount, Status ) # else @@ -7044,7 +7044,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef NETCDF CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncd_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7066,7 +7066,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncdpar_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7077,7 +7077,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef PNETCDF CASE ( IO_PNETCDF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7087,7 +7087,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PHDF5 CASE ( IO_PHDF5 ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_phdf5_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7097,7 +7097,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef ESMFIO CASE ( IO_ESMF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_esmf_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7107,7 +7107,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef XXX CASE ( IO_XXX ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_xxx_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7117,7 +7117,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef YYY CASE ( IO_YYY ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_yyy_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7128,7 +7128,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB1 CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr1_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7151,7 +7151,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB2 CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr2_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7174,7 +7174,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef INTIO CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_int_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7258,7 +7258,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef NETCDF CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncd_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7280,7 +7280,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncdpar_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7291,7 +7291,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef PNETCDF CASE ( IO_PNETCDF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7301,7 +7301,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PHDF5 CASE ( IO_PHDF5 ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_phdf5_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7311,7 +7311,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef ESMFIO CASE ( IO_ESMF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_esmf_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7321,7 +7321,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef XXX CASE ( IO_XXX ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_xxx_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7331,7 +7331,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef YYY CASE ( IO_YYY ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_yyy_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7342,7 +7342,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB1 CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr1_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7365,7 +7365,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB2 CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr2_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -7388,7 +7388,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef INTIO CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_int_put_var_ti_double ( Hndl, Element, Varname, Data, & locCount, Status ) # else @@ -9787,7 +9787,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef NETCDF CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncd_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -9809,7 +9809,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncdpar_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -9820,7 +9820,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef PNETCDF CASE ( IO_PNETCDF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -9830,7 +9830,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PHDF5 CASE ( IO_PHDF5 ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_phdf5_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -9840,7 +9840,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef ESMFIO CASE ( IO_ESMF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_esmf_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -9850,7 +9850,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef XXX CASE ( IO_XXX ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_xxx_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -9860,7 +9860,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef YYY CASE ( IO_YYY ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_yyy_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -9871,7 +9871,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB1 CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr1_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -9894,7 +9894,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB2 CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr2_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -9917,7 +9917,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef INTIO CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_int_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -10001,7 +10001,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef NETCDF CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncd_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -10023,7 +10023,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncdpar_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -10034,7 +10034,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef PNETCDF CASE ( IO_PNETCDF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -10044,7 +10044,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PHDF5 CASE ( IO_PHDF5 ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_phdf5_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -10054,7 +10054,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef ESMFIO CASE ( IO_ESMF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_esmf_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -10064,7 +10064,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef XXX CASE ( IO_XXX ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_xxx_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -10074,7 +10074,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef YYY CASE ( IO_YYY ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_yyy_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -10085,7 +10085,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB1 CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr1_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -10108,7 +10108,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB2 CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr2_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -10131,7 +10131,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef INTIO CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_int_get_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Outcount, Status ) # else @@ -10217,7 +10217,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef NETCDF CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncd_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10239,7 +10239,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncdpar_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10250,7 +10250,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef PNETCDF CASE ( IO_PNETCDF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10260,7 +10260,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PHDF5 CASE ( IO_PHDF5 ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_phdf5_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10270,7 +10270,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef ESMFIO CASE ( IO_ESMF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_esmf_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10280,7 +10280,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef XXX CASE ( IO_XXX ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_xxx_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10290,7 +10290,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef YYY CASE ( IO_YYY ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_yyy_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10301,7 +10301,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB1 CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr1_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10324,7 +10324,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB2 CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr2_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10347,7 +10347,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef INTIO CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_int_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10431,7 +10431,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef NETCDF CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncd_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10453,7 +10453,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_ncdpar_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10464,7 +10464,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef PNETCDF CASE ( IO_PNETCDF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_pnc_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10474,7 +10474,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef PHDF5 CASE ( IO_PHDF5 ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_phdf5_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10484,7 +10484,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef ESMFIO CASE ( IO_ESMF ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_esmf_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10494,7 +10494,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef XXX CASE ( IO_XXX ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_xxx_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10504,7 +10504,7 @@ IF ( Hndl .GT. -1 ) THEN #endif #ifdef YYY CASE ( IO_YYY ) -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_yyy_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10515,7 +10515,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB1 CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr1_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10538,7 +10538,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef GRIB2 CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_gr2_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else @@ -10561,7 +10561,7 @@ IF ( Hndl .GT. -1 ) THEN #ifdef INTIO CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION CALL ext_int_put_var_td_double ( Hndl, Element, DateStr, Varname, Data, & locCount, Status ) # else diff --git a/arch/postamble b/arch/postamble index aa55662073..101286725e 100644 --- a/arch/postamble +++ b/arch/postamble @@ -2,8 +2,10 @@ # POSTAMBLE FGREP = fgrep -iq +### Used throughout the build system to inform promotion to double precision +DOUBLE_PRECISION = CONFIGURE_PROMOTION -ARCHFLAGS = $(COREDEFS) -DIWORDSIZE=$(IWORDSIZE) -DDWORDSIZE=$(DWORDSIZE) -DRWORDSIZE=$(RWORDSIZE) -DLWORDSIZE=$(LWORDSIZE) \ +ARCHFLAGS = $(COREDEFS) -DIWORDSIZE=$(IWORDSIZE) -DDWORDSIZE=$(DWORDSIZE) -DRWORDSIZE=$(RWORDSIZE) -DLWORDSIZE=$(LWORDSIZE) CONFIGURE_PROMOTION \ $(ARCH_LOCAL) \ $(DA_ARCHFLAGS) \ CONFIGURE_DMPARALLEL \ diff --git a/chem/CMakeLists.txt b/chem/CMakeLists.txt index 9bfbf3d5ac..544b253256 100644 --- a/chem/CMakeLists.txt +++ b/chem/CMakeLists.txt @@ -223,4 +223,17 @@ target_link_libraries( convert_emiss PRIVATE ${PROJECT_NAME}_Core - ) \ No newline at end of file + ) + +target_compile_options( + convert_emiss + PRIVATE + ${PROJECT_COMPILE_OPTIONS} + ) + + +target_compile_definitions( + convert_emiss + PRIVATE + ${PROJECT_COMPILE_DEFINITIONS} + ) diff --git a/chem/module_phot_tuv.F b/chem/module_phot_tuv.F index f37d167a67..0a32c08c00 100644 --- a/chem/module_phot_tuv.F +++ b/chem/module_phot_tuv.F @@ -1457,11 +1457,10 @@ subroutine get_xsqy_tab CALL wrf_dm_bcast_bytes( temp_data, n_temp_data*RWORDSIZE ) CALL wrf_dm_bcast_bytes( o3_data, n_o3_data*RWORDSIZE ) CALL wrf_dm_bcast_bytes( air_dens_data, n_air_dens_data*RWORDSIZE ) -#if RWORDSIZE == 4 +#ifndef DOUBLE_PRECISION CALL wrf_dm_bcast_bytes( chebev_ac, nchebev_term*nchebev_wave*2*RWORDSIZE ) CALL wrf_dm_bcast_bytes( chebev_bc, nchebev_term*nchebev_wave*2*RWORDSIZE ) -#endif -#if RWORDSIZE == 8 +#else CALL wrf_dm_bcast_bytes( chebev_ac, nchebev_term*nchebev_wave*RWORDSIZE ) CALL wrf_dm_bcast_bytes( chebev_bc, nchebev_term*nchebev_wave*RWORDSIZE ) #endif diff --git a/cmake/c_preproc.cmake b/cmake/c_preproc.cmake index 14f7fe9295..23ee44ddb0 100644 --- a/cmake/c_preproc.cmake +++ b/cmake/c_preproc.cmake @@ -111,17 +111,15 @@ macro( wrf_expand_definitions ) set( WRF_EXP_DEFS ) foreach( WRF_EXP_DEF ${WRF_EXP_DEFINITIONS} ) if ( NOT ${WRF_EXP_DEF} MATCHES ".*-D.*" ) - # We have a generator expression, inject the -D correctly - # THIS SHOULD ONLY BE USED FOR CONDITIONALLY APPLIED DEFINITIONS + # We have a generator expression, error! no way we can evaluate this correctly if ( ${WRF_EXP_DEF} MATCHES "^[$]<" ) - # Take advantage of the fact that a define is most likely not an expanded variable (i.e. starts with a-zA-Z, adjust if not) - # preceeded by the defining generator expression syntax $<>:var or ,var - # Yes this is fragile but is probably more robust than the current code if you're relying on this macro :D - string( REGEX REPLACE "(>:|,)([a-zA-Z])" "\\1-D\\2" WRF_EXP_DEF_SANITIZED ${WRF_EXP_DEF} ) - list( APPEND WRF_EXP_DEFS ${WRF_EXP_DEF_SANITIZED} ) + message( FATAL_ERROR "Generator expressions not allowed in preprocessing defines" ) else() list( APPEND WRF_EXP_DEFS -D${WRF_EXP_DEF} ) endif() + else() + # Just add it normally + list( APPEND WRF_EXP_DEFS ${WRF_EXP_DEF} ) endif() endforeach() diff --git a/cmake/target_source_properties.cmake b/cmake/target_source_properties.cmake new file mode 100644 index 0000000000..55042a6263 --- /dev/null +++ b/cmake/target_source_properties.cmake @@ -0,0 +1,142 @@ +# +# These two functions together allow greater control of propagating flags within +# a target on a per-source basis with the ability to "inherit" those properties +# from the target if not set. This allows a target to defing its own flags, but +# then if a file needs different settings those can be directly overridden without +# relying on compiler-specific flag order precedence. Additionally this allows a +# project to organize grouping of flags within a target +# +# Note that for compile defines on source files they are not used in the autogen +# dependency scanning. See : +# https://gitlab.kitware.com/cmake/cmake/-/issues/22519 +# and +# https://gitlab.kitware.com/cmake/cmake/-/blob/master/Source/cmDependsFortran.cxx#L84 +# functions cmDependsFortran::cmDependsFortran() and cmDependsFortran::WriteDependencies() +# +# The solution is to either use Ninja or preprocess the files (what Ninja internally does) +# This is probably the way to go as well since CMake native preprocessor directive +# parsing is... subpar and simplified : +# https://gitlab.kitware.com/cmake/cmake/-/issues/17398 +# +# Alternatively, set critical flags at the target level +# + + + +# +# A simple function to create properties for targets and sources quickly +# +function( define_target_source_properties ) + set( options ) + set( oneValueArgs ) + set( multiValueArgs PROPERTIES ) + + cmake_parse_arguments( + FUNC_PROP + "${options}" "${oneValueArgs}" "${multiValueArgs}" + ${ARGN} + ) + + foreach( PROPERTY ${FUNC_PROP_PROPERTIES} ) + define_property( + SOURCE + PROPERTY ${PROPERTY} + # INHERITED # they will be "inherited" via target to source + ) + + define_property( + TARGET + PROPERTY ${PROPERTY} + # INHERITED # they will be "inherited" via target to source + ) + endforeach() +endfunction() + + +# +# The bulk of the functionality exists in this function. It will loop over each +# provided target, gathering sources and their respective properties listed, using +# the target's property if not defined for this source else nothing, and finally +# applies it to that source. +# +function( apply_target_source_properties ) + set( options DISCARD_PREVIOUS DEBUG ) + set( oneValueArgs AS_PROPERTY ) + set( multiValueArgs TARGETS PROPERTIES ) + + cmake_parse_arguments( + FUNC_PROP + "${options}" "${oneValueArgs}" "${multiValueArgs}" + ${ARGN} + ) + + foreach( TARGET ${FUNC_PROP_TARGETS} ) + # get target sources + get_target_property( TARGET_SOURCES ${TARGET} SOURCES ) + + # get default "inherited" value from target + foreach( PROPERTY ${FUNC_PROP_PROPERTIES} ) + get_target_property( TARGET_PROPERTY_${PROPERTY} ${TARGET} ${PROPERTY} ) + if ( "${TARGET_PROPERTY_${PROPERTY}}" STREQUAL "TARGET_PROPERTY_${PROPERTY}-NOTFOUND" ) + # unset it + set( TARGET_PROPERTY_${PROPERTY} ) + endif() + endforeach() + + foreach( SOURCE ${TARGET_SOURCES} ) + + # We need to accumulate properties since a call to set property will + # override what was there before + set( SOURCE_PROPERTY_ALL ) + + foreach( PROPERTY ${FUNC_PROP_PROPERTIES} ) + # first try source + get_source_file_property( + SOURCE_PROPERTY_${PROPERTY} + ${SOURCE} + TARGET_DIRECTORY ${TARGET} + ${PROPERTY} + ) + if ( "${SOURCE_PROPERTY_${PROPERTY}}" STREQUAL "NOTFOUND" ) + # use target + set( SOURCE_PROPERTY_${PROPERTY} ${TARGET_PROPERTY_${PROPERTY}} ) + endif() + + # Now apply these as prop + if ( NOT "${SOURCE_PROPERTY_${PROPERTY}}" STREQUAL "" ) + if ( ${FUNC_PROP_DEBUG} ) + message( STATUS "DEBUG : Adding '${SOURCE_PROPERTY_${PROPERTY}}' as SOURCE_PROPERTY_${PROPERTY}") + endif() + list( APPEND SOURCE_PROPERTY_ALL ${SOURCE_PROPERTY_${PROPERTY}} ) + endif() + endforeach() # properties + + # Apply properties to source + if ( NOT "${SOURCE_PROPERTY_ALL}" STREQUAL "" ) + if ( NOT ${FUNC_PROP_DISCARD_PREVIOUS} ) + # get old value and append + get_source_file_property( + SOURCE_PROPERTY_ORIG + ${SOURCE} + TARGET_DIRECTORY ${TARGET} + ${FUNC_PROP_AS_PROPERTY} + ) + if ( "${SOURCE_PROPERTY_ORIG}" STREQUAL "NOTFOUND" ) + set( SOURCE_PROPERTY_ORIG ) + endif() + endif() + + if ( ${FUNC_PROP_DEBUG} ) + message( STATUS "DEBUG : ${FUNC_PROP_AS_PROPERTY} being set to '${SOURCE_PROPERTY_ORIG} ${SOURCE_PROPERTY_ALL}'") + endif() + + set_source_files_properties( + ${SOURCE} + TARGET_DIRECTORY ${TARGET} + PROPERTIES + ${FUNC_PROP_AS_PROPERTY} "${SOURCE_PROPERTY_ORIG};${SOURCE_PROPERTY_ALL}" + ) + endif() + endforeach() # sources + endforeach() # targets +endfunction() \ No newline at end of file diff --git a/cmake/template/arch_config.cmake b/cmake/template/arch_config.cmake index 42cba60287..0a655a4e32 100644 --- a/cmake/template/arch_config.cmake +++ b/cmake/template/arch_config.cmake @@ -15,15 +15,16 @@ set( CMAKE_Fortran_FLAGS_INIT "{SFC_FLAGS} {FCBASEOPTS} {BYTESWAPIO}" ) set( CMAKE_C_FLAGS_INIT "{SCC_FLAGS} {CFLAGS_LOCAL}" ) # https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS_CONFIG_INIT.html -set( CMAKE_Fortran_FLAGS_DEBUG_INIT "{FCDEBUG}" ) -set( CMAKE_Fortran_FLAGS_RELEASE_INIT "" ) -set( CMAKE_C_FLAGS_DEBUG_INIT "" ) -set( CMAKE_C_FLAGS_RELEASE_INIT "" ) +set( CMAKE_Fortran_FLAGS_Debug_INIT "{FCDEBUG}" ) +set( CMAKE_Fortran_FLAGS_Release_INIT "" ) +set( CMAKE_C_FLAGS_Debug_INIT "" ) +set( CMAKE_C_FLAGS_Release_INIT "" ) # Project specifics now -set( WRF_MPI_Fortran_FLAGS "{DM_FC_FLAGS}" ) -set( WRF_MPI_C_FLAGS "{DM_CC_FLAGS}" ) -set( WRF_ARCH_LOCAL "{ARCH_LOCAL}" ) -set( WRF_M4_FLAGS "{M4_FLAGS}" ) -set( WRF_FCOPTIM "{FCOPTIM}" ) -set( WRF_FCNOOPT "{FCNOOPT}" ) \ No newline at end of file +set( WRF_MPI_Fortran_FLAGS "{DM_FC_FLAGS}" ) +set( WRF_MPI_C_FLAGS "{DM_CC_FLAGS}" ) +set( WRF_ARCH_LOCAL "{ARCH_LOCAL}" ) +set( WRF_M4_FLAGS "{M4_FLAGS}" ) +set( WRF_FCOPTIM "{FCOPTIM}" ) +set( WRF_FCNOOPT "{FCNOOPT}" ) +set( WRF_LINK_FLAGS "{LDFLAGS_LOCAL}" ) diff --git a/configure b/configure index 5e2bedb10f..dd1bbac8b7 100755 --- a/configure +++ b/configure @@ -6,7 +6,7 @@ thiscmd=$0 FORTRAN_COMPILER_TIMER="" opt_level="-f" -rword="-r4" +rword=4 print_usage="" chemistry="" wrf_core="" @@ -22,7 +22,7 @@ while [ $# -ge 1 ]; do -help) print_usage="yes" ;; -os) shift ; WRF_OS=$1 ;; -mach) shift ; WRF_MACH=$1 ;; - -r8) rword="-r8" ;; + -r8) rword=8 ;; -time) shift ; FORTRAN_COMPILER_TIMER=$1 ;; chem) WRF_CHEM=1 ;; cmaq) WRF_CMAQ=1 ;; @@ -529,7 +529,7 @@ if test -n "$wrf_core" ; then if [ "$wrf_core" = "DA_CORE" -o \ "$wrf_core" = "4D_DA_CORE" -o \ "$wrf_core" = "WRF_PLUS_CORE" ] ; then - rword="-r8" + rword=8 fi fi @@ -541,7 +541,7 @@ if test -n "$PERL" ; then -netcdf=$NETCDF -pnetcdf=$PNETCDF -netcdfpar=$NETCDFPAR -adios2=$ADIOS2 -hdf5=$HDF5 -phdf5=$PHDF5 -os=$os -mach=$mach -ldflags=$ldflags \ -compileflags=$compileflags -opt_level=$opt_level -USENETCDFF=$USENETCDFF -USENETCDF=$USENETCDF \ -time=$FORTRAN_COMPILER_TIMER -tfl="$TFL" -cfl="$CFL" -config_line="$config_line" \ - -wrf_core=$wrf_core -gpfs=$GPFS_PATH -curl=$CURL_PATH -netcdf4_dep_lib="$NETCDF4_DEP_LIB" + -wrf_core=$wrf_core -gpfs=$GPFS_PATH -curl=$CURL_PATH -netcdf4_dep_lib="$NETCDF4_DEP_LIB" -rword="$rword" if test ! -f configure.wrf ; then echo "configure.wrf not created! Exiting configure script..." exit 1 @@ -556,13 +556,10 @@ if test -n "$PERL" ; then fi # GNU has a funny way of doing promotion to real*8 - if [ "$rword" = "-r8" ] ; then + if [ $rword -eq 8 ] ; then srch=`grep -i "^SFC" configure.wrf | grep -i "gfortran"` if [ -n "$srch" ] ; then - sed -e '/^PROMOTION/s/#//' \ - -e '/^RWORDSIZE/s/$(NATIVE_RWORDSIZE)/8/' configure.wrf > configure.wrf.edit - else - sed -e '/^RWORDSIZE/s/$(NATIVE_RWORDSIZE)/8/' configure.wrf > configure.wrf.edit + sed -e '/^PROMOTION/s/#//' configure.wrf > configure.wrf.edit fi /bin/mv configure.wrf.edit configure.wrf sed -e 's/-DBUILD_SBM_FAST=1/-DBUILD_SBM_FAST=0/' configure.wrf > configure.wrf.edit diff --git a/dyn_em/module_big_step_utilities_em.F b/dyn_em/module_big_step_utilities_em.F index 72e827b275..96d0c3c26a 100644 --- a/dyn_em/module_big_step_utilities_em.F +++ b/dyn_em/module_big_step_utilities_em.F @@ -2,7 +2,7 @@ !wrf:MODEL_LAYER:DYNAMICS ! -#if (RWORDSIZE == 4) +#ifndef DOUBLE_PRECISION # define VPOWX vspowx # define VPOW vspow #else diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 7036a9debe..e52b1c3fbf 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -20,6 +20,10 @@ # Always build +# Suffice it to say everything under this is WRF-specific while also being external +add_compile_options ( "${PROJECT_COMPILE_OPTIONS}" ) +add_compile_definitions( "${PROJECT_COMPILE_DEFINITIONS}" ) + add_subdirectory( io_int ) add_subdirectory( io_grib1 ) add_subdirectory( io_grib_share ) diff --git a/external/RSL_LITE/module_dm.F b/external/RSL_LITE/module_dm.F index 5c9bb62a67..d641e9a865 100644 --- a/external/RSL_LITE/module_dm.F +++ b/external/RSL_LITE/module_dm.F @@ -78,7 +78,7 @@ MODULE module_dm #endif INTERFACE wrf_dm_maxval -#if ( defined(PROMOTE_FLOAT) || ( RWORDSIZE == DWORDSIZE ) ) +#ifdef DOUBLE_PRECISION MODULE PROCEDURE wrf_dm_maxval_real , wrf_dm_maxval_integer #else MODULE PROCEDURE wrf_dm_maxval_real , wrf_dm_maxval_integer, wrf_dm_maxval_doubleprecision @@ -86,7 +86,7 @@ MODULE module_dm END INTERFACE INTERFACE wrf_dm_minval ! gopal's doing -#if ( defined(PROMOTE_FLOAT) || ( RWORDSIZE == DWORDSIZE ) ) +#ifdef DOUBLE_PRECISION MODULE PROCEDURE wrf_dm_minval_real , wrf_dm_minval_integer #else MODULE PROCEDURE wrf_dm_minval_real , wrf_dm_minval_integer, wrf_dm_minval_doubleprecision @@ -1458,7 +1458,7 @@ SUBROUTINE wrf_dm_minval_real ( val, idex, jdex ) # endif END SUBROUTINE wrf_dm_minval_real -#ifndef PROMOTE_FLOAT +#ifndef DOUBLE_PRECISION SUBROUTINE wrf_dm_maxval_doubleprecision ( val, idex, jdex ) # ifndef STUBMPI IMPLICIT NONE diff --git a/external/io_adios2/CMakeLists.txt b/external/io_adios2/CMakeLists.txt index dde531a716..2d8efd61e0 100644 --- a/external/io_adios2/CMakeLists.txt +++ b/external/io_adios2/CMakeLists.txt @@ -33,14 +33,13 @@ target_include_directories( ${FOLDER_COMPILE_TARGET} # First preprocess -get_directory_property( DIR_DEFS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS ) get_target_property ( FOLDER_COMPILE_TARGET_INCLUDES ${FOLDER_COMPILE_TARGET} INCLUDE_DIRECTORIES ) wrf_c_preproc_fortran( TARGET_NAME ${FOLDER_COMPILE_TARGET}_c_preproc_wrf_io OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/preproc/ EXTENSION ".f90" INCLUDES ${FOLDER_COMPILE_TARGET_INCLUDES} - DEFINITIONS ${DIR_DEFS} + DEFINITIONS ${PROJECT_COMPILE_DEFINITIONS} SOURCES wrf_io.F90 ) diff --git a/external/io_int/io_int.F90 b/external/io_int/io_int.F90 index ab95b49a45..7be1bc04ce 100644 --- a/external/io_int/io_int.F90 +++ b/external/io_int/io_int.F90 @@ -1529,12 +1529,12 @@ SUBROUTINE ext_int_read_field ( DataHandle , DateStr , VarName , Field , FieldTy locMemoryStart , locMemoryEnd , & locPatchStart , locPatchEnd ) IF ( TRIM(locVarName) .EQ. TRIM(VarName) ) THEN - IF ( FieldType .EQ. WRF_REAL ) THEN + IF ( FieldType .EQ. WRF_FLOAT ) THEN CALL rfieldread( DataHandle, Field, MemoryStart, MemoryEnd, PatchStart, PatchEnd ) ELSE IF ( FieldType .EQ. WRF_INTEGER ) THEN CALL ifieldread( DataHandle, Field, MemoryStart, MemoryEnd, PatchStart, PatchEnd ) ELSE - CALL wrf_message('io_int.F90: ext_int_read_field: types other than WRF_REAL not supported yet') + CALL wrf_message('io_int.F90: ext_int_read_field: types other than WRF_FLOAT not supported yet') READ( unit=DataHandle ) ENDIF ELSE @@ -1602,7 +1602,7 @@ SUBROUTINE ext_int_write_field ( DataHandle , DateStr , VarName , Field , FieldT inttypesize = itypesize realtypesize = rtypesize - IF ( FieldType .EQ. WRF_REAL .OR. FieldType .EQ. WRF_DOUBLE) THEN + IF ( FieldType .EQ. WRF_FLOAT .OR. FieldType .EQ. WRF_DOUBLE) THEN typesize = rtypesize ELSE IF ( FieldType .EQ. WRF_DOUBLE ) THEN CALL wrf_error_fatal( 'io_int.F90: ext_int_write_field, WRF_DOUBLE not yet supported') @@ -1621,7 +1621,7 @@ SUBROUTINE ext_int_write_field ( DataHandle , DateStr , VarName , Field , FieldT MemoryStart , MemoryEnd , & PatchStart , PatchEnd ) WRITE( unit=DataHandle ) hdrbuf - IF ( FieldType .EQ. WRF_REAL ) THEN + IF ( FieldType .EQ. WRF_FLOAT ) THEN CALL rfieldwrite( DataHandle, Field, MemoryStart, MemoryEnd, PatchStart, PatchEnd ) ELSE IF ( FieldType .EQ. WRF_INTEGER ) THEN CALL ifieldwrite( DataHandle, Field, MemoryStart, MemoryEnd, PatchStart, PatchEnd ) diff --git a/external/io_netcdf/CMakeLists.txt b/external/io_netcdf/CMakeLists.txt index ac93792869..b63a1ae474 100644 --- a/external/io_netcdf/CMakeLists.txt +++ b/external/io_netcdf/CMakeLists.txt @@ -47,14 +47,13 @@ target_include_directories( # First preprocess -get_directory_property( DIR_DEFS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS ) get_target_property ( FOLDER_COMPILE_TARGET_INCLUDES ${FOLDER_COMPILE_TARGET} INCLUDE_DIRECTORIES ) wrf_c_preproc_fortran( TARGET_NAME ${FOLDER_COMPILE_TARGET}_c_preproc_wrf_io OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/preproc/ EXTENSION ".f90" INCLUDES ${FOLDER_COMPILE_TARGET_INCLUDES} - DEFINITIONS ${DIR_DEFS} + DEFINITIONS ${PROJECT_COMPILE_DEFINITIONS} SOURCES wrf_io.F90 ) diff --git a/external/io_netcdfpar/CMakeLists.txt b/external/io_netcdfpar/CMakeLists.txt index 8a0db9b9c9..9536023c58 100644 --- a/external/io_netcdfpar/CMakeLists.txt +++ b/external/io_netcdfpar/CMakeLists.txt @@ -47,14 +47,13 @@ target_include_directories( # First preprocess -get_directory_property( DIR_DEFS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS ) get_target_property ( FOLDER_COMPILE_TARGET_INCLUDES ${FOLDER_COMPILE_TARGET} INCLUDE_DIRECTORIES ) wrf_c_preproc_fortran( TARGET_NAME ${FOLDER_COMPILE_TARGET}_c_preproc_wrf_io OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/preproc/ EXTENSION ".f90" INCLUDES ${FOLDER_COMPILE_TARGET_INCLUDES} - DEFINITIONS ${DIR_DEFS} + DEFINITIONS ${PROJECT_COMPILE_DEFINITIONS} SOURCES wrf_io.F90 ) diff --git a/external/io_pnetcdf/CMakeLists.txt b/external/io_pnetcdf/CMakeLists.txt index 1717f71383..8c7c138233 100644 --- a/external/io_pnetcdf/CMakeLists.txt +++ b/external/io_pnetcdf/CMakeLists.txt @@ -35,14 +35,13 @@ target_include_directories( ${FOLDER_COMPILE_TARGET} # First preprocess -get_directory_property( DIR_DEFS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS ) get_target_property ( FOLDER_COMPILE_TARGET_INCLUDES ${FOLDER_COMPILE_TARGET} INCLUDE_DIRECTORIES ) wrf_c_preproc_fortran( TARGET_NAME ${FOLDER_COMPILE_TARGET}_c_preproc_wrf_io OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/preproc/ EXTENSION ".f90" INCLUDES ${FOLDER_COMPILE_TARGET_INCLUDES} - DEFINITIONS ${DIR_DEFS} + DEFINITIONS ${PROJECT_COMPILE_DEFINITIONS} SOURCES wrf_io.F90 ) diff --git a/external/ioapi_share/makefile b/external/ioapi_share/makefile index a5142e02af..49893377cc 100644 --- a/external/ioapi_share/makefile +++ b/external/ioapi_share/makefile @@ -6,13 +6,8 @@ all: ../../inc/wrf_io_flags.h ../../inc/wrf_status_codes.h # The if statement below modifies WRF data type codes for builds made with # compiler autopromotion of REAL -> DOUBLE. ../../inc/wrf_io_flags.h : wrf_io_flags.h ../../configure.wrf - ( /bin/rm -f ../../inc/wrf_io_flags.h foo_io_flags.h; \ - /bin/cp wrf_io_flags.h foo_io_flags.h; \ - if [ $(RWORDSIZE) -ne $(NATIVE_RWORDSIZE) ] ; then \ - /bin/rm -f foo_io_flags.h; \ - sed -e 's/104/105/' wrf_io_flags.h > foo_io_flags.h ;\ - fi ; \ - /bin/mv foo_io_flags.h ../../inc/wrf_io_flags.h ) + /bin/rm -f ../../inc/wrf_io_flags.h + /bin/cp wrf_io_flags.h ../../inc/wrf_io_flags.h ../../inc/wrf_status_codes.h : wrf_status_codes.h /bin/rm -f ../../inc/wrf_status_codes.h diff --git a/external/ioapi_share/wrf_io_flags.h b/external/ioapi_share/wrf_io_flags.h index a131b5484d..67bb0a02a0 100644 --- a/external/ioapi_share/wrf_io_flags.h +++ b/external/ioapi_share/wrf_io_flags.h @@ -4,7 +4,7 @@ integer, parameter :: WRF_FILE_OPENED_FOR_READ = 103 integer, parameter :: WRF_REAL = 104 integer, parameter :: WRF_DOUBLE = 105 -#ifdef PROMOTE_FLOAT +#ifdef DOUBLE_PRECISION integer, parameter :: WRF_FLOAT=WRF_DOUBLE #else integer, parameter :: WRF_FLOAT=WRF_REAL diff --git a/frame/CMakeLists.txt b/frame/CMakeLists.txt index 59f8d2551b..b923149edf 100644 --- a/frame/CMakeLists.txt +++ b/frame/CMakeLists.txt @@ -14,7 +14,6 @@ set( # Generate all the combinations dynamically, not a fan of this file breakdown ######################################################################################################################## set( nl_dyn_source ) -get_directory_property( DIR_DEFS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS ) foreach( n RANGE 0 7 ) wrf_c_preproc_fortran( @@ -25,7 +24,7 @@ foreach( n RANGE 0 7 ) INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/inc DEPENDENCIES registry_code - DEFINITIONS ${DIR_DEFS} NNN=${n} NL_set_ROUTINES + DEFINITIONS ${PROJECT_COMPILE_DEFINITIONS} NNN=${n} NL_set_ROUTINES SOURCES nl_access_routines.F ) wrf_c_preproc_fortran( @@ -36,7 +35,7 @@ foreach( n RANGE 0 7 ) INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/inc DEPENDENCIES registry_code - DEFINITIONS ${DIR_DEFS} NNN=${n} NL_get_ROUTINES + DEFINITIONS ${PROJECT_COMPILE_DEFINITIONS} NNN=${n} NL_get_ROUTINES SOURCES nl_access_routines.F ) @@ -159,11 +158,11 @@ target_sources( set_source_files_properties( ${nl_dyn_source} PROPERTIES - COMPILE_FLAGS + COMPILE_OPTIONS_OPTIMIZATION $<$:${WRF_FCNOOPT}> ) install( FILES ${WRF_INCLUDE_FILES} DESTINATION include/${FOLDER_COMPILE_TARGET} - ) \ No newline at end of file + ) diff --git a/frame/md_calls.m4 b/frame/md_calls.m4 index 73ce5deef3..69ac289910 100644 --- a/frame/md_calls.m4 +++ b/frame/md_calls.m4 @@ -62,7 +62,7 @@ IF ( Hndl .GT. -1 ) THEN CASE ( IO_NETCDF ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN ifelse($3,real, -`# if ( RWORDSIZE == DWORDSIZE ) +`# ifdef DOUBLE_PRECISION CALL ext_ncd_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, & ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status ) # else @@ -87,7 +87,7 @@ ifelse($3,real, #ifdef NETCDFPAR CASE ( IO_NETCDFPAR ) ifelse($3,real, -`# if ( RWORDSIZE == DWORDSIZE ) +`# ifdef DOUBLE_PRECISION CALL ext_ncdpar_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, & ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status ) # else @@ -101,7 +101,7 @@ ifelse($3,real, #ifdef PNETCDF CASE ( IO_PNETCDF ) ifelse($3,real, -`# if ( RWORDSIZE == DWORDSIZE ) +`# ifdef DOUBLE_PRECISION CALL ext_pnc_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, & ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status ) # else @@ -114,7 +114,7 @@ ifelse($3,real, #ifdef ADIOS2 CASE ( IO_ADIOS2 ) ifelse($3,real, -`# if ( RWORDSIZE == DWORDSIZE ) +`# ifdef DOUBLE_PRECISION CALL ext_adios2_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, & ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status ) # else @@ -127,7 +127,7 @@ ifelse($3,real, #ifdef PIO CASE ( IO_PIO ) ifelse($3,real, -`# if ( RWORDSIZE == DWORDSIZE ) +`# ifdef DOUBLE_PRECISION CALL ext_pio_$1_$2_$6_double$4_$5 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, & ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status ) # else @@ -140,7 +140,7 @@ ifelse($3,real, #ifdef PHDF5 CASE ( IO_PHDF5 ) ifelse($3,real, -`# if ( RWORDSIZE == DWORDSIZE ) +`# ifdef DOUBLE_PRECISION CALL ext_phdf5_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, & ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status ) # else @@ -153,7 +153,7 @@ ifelse($3,real, #ifdef ESMFIO CASE ( IO_ESMF ) ifelse($3,real, -`# if ( RWORDSIZE == DWORDSIZE ) +`# ifdef DOUBLE_PRECISION CALL ext_esmf_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, & ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status ) # else @@ -166,7 +166,7 @@ ifelse($3,real, #ifdef XXX CASE ( IO_XXX ) ifelse($3,real, -`# if ( RWORDSIZE == DWORDSIZE ) +`# ifdef DOUBLE_PRECISION CALL ext_xxx_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, & ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status ) # else @@ -179,7 +179,7 @@ ifelse($3,real, #ifdef YYY CASE ( IO_YYY ) ifelse($3,real, -`# if ( RWORDSIZE == DWORDSIZE ) +`# ifdef DOUBLE_PRECISION CALL ext_yyy_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, & ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status ) # else @@ -193,7 +193,7 @@ ifelse($3,real, CASE ( IO_GRIB1 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN ifelse($3,real, -`# if ( RWORDSIZE == DWORDSIZE ) +`# ifdef DOUBLE_PRECISION CALL ext_gr1_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, & ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status ) # else @@ -219,7 +219,7 @@ ifelse($3,real, CASE ( IO_GRIB2 ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN ifelse($3,real, -`# if ( RWORDSIZE == DWORDSIZE ) +`# ifdef DOUBLE_PRECISION CALL ext_gr2_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, & ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status ) # else @@ -245,7 +245,7 @@ ifelse($3,real, CASE ( IO_INTIO ) IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN ifelse($3,real, -`# if ( RWORDSIZE == DWORDSIZE ) +`# ifdef DOUBLE_PRECISION CALL ext_int_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, & ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status ) # else diff --git a/frame/module_alloc_space.h b/frame/module_alloc_space.h index 56e8bf2f87..4fedc45532 100644 --- a/frame/module_alloc_space.h +++ b/frame/module_alloc_space.h @@ -135,7 +135,7 @@ inter_domain = inter_domain_in okay_to_alloc = okay_to_alloc_in -#if ( RWORDSIZE == 8 ) +#ifdef DOUBLE_PRECISION initial_data_value = 0. #else CALL get_initial_data_value ( initial_data_value ) diff --git a/frame/module_clear_halos.F b/frame/module_clear_halos.F index 88de325ecf..db19e0e5fc 100644 --- a/frame/module_clear_halos.F +++ b/frame/module_clear_halos.F @@ -42,7 +42,7 @@ subroutine clear_ij_halos(grid,how,full_domain) ips, ipe, jps, jpe, kps, kpe logical :: fulldom real :: badR, badR_N,badR_NE,badR_NW,badR_S,badR_SW,badR_SE,badR_E,badR_W -#if (RWORDSIZE==4) +#ifndef DOUBLE_PRECISION double precision :: badD, badD_N,badD_NE,badD_NW,badD_S,badD_SW,badD_SE,badD_E,badD_W #else real :: badD, badD_N,badD_NE,badD_NW,badD_S,badD_SW,badD_SE,badD_E,badD_W diff --git a/frame/module_cpl_oasis3.F b/frame/module_cpl_oasis3.F index f7d96cecad..896de708e1 100644 --- a/frame/module_cpl_oasis3.F +++ b/frame/module_cpl_oasis3.F @@ -22,7 +22,7 @@ MODULE module_cpl_oasis3 TYPE :: FLD_CPL ! Coupling field information CHARACTER(len = 64) :: clname ! Name of the coupling field, jpeighty defined in oasis INTEGER :: nid ! Id of the field -#if ( RWORDSIZE == 8 ) +#ifdef DOUBLE_PRECISION REAL , POINTER, DIMENSION(:,:) :: dbl2d ! 2d array to store received field #else REAL(kind=8), POINTER, DIMENSION(:,:) :: dbl2d ! 2d array to store received field @@ -308,7 +308,7 @@ SUBROUTINE cpl_oasis_snd( kdomwrf, kdomext, kfldid, ksec, pdata ) kdomwrf, kdomext, kfldid, ' ', TRIM(ssnd(kdomwrf,kdomext,kfldid)%clname), ksec CALL wrf_debug(nlevdbg, cltxt) -#if ( RWORDSIZE == 8 ) +#ifdef DOUBLE_PRECISION CALL oasis_put(ssnd(kdomwrf,kdomext,kfldid)%nid, ksec, pdata(:,:) , info) #else CALL oasis_put(ssnd(kdomwrf,kdomext,kfldid)%nid, ksec, DBLE(pdata(:,:)), info) @@ -362,7 +362,7 @@ SUBROUTINE cpl_oasis_rcv( kdomwrf, kdomext, kfldid, ksec, pcplrcv ) CALL wrf_debug(nlevdbg, cltxt) CALL oasis_get( srcv(kdomwrf,kdomext,kfldid)%nid, ksec, srcv(kdomwrf,kdomext,kfldid)%dbl2d, info ) -#if ( RWORDSIZE == 8 ) +#ifdef DOUBLE_PRECISION pcplrcv(:,:) = srcv(kdomwrf,kdomext,kfldid)%dbl2d #else pcplrcv(:,:) = REAL(srcv(kdomwrf,kdomext,kfldid)%dbl2d, kind=4) diff --git a/hydro/CMakeLists.txt b/hydro/CMakeLists.txt index ee756e71ac..63f6f59bf0 100644 --- a/hydro/CMakeLists.txt +++ b/hydro/CMakeLists.txt @@ -1,4 +1,6 @@ # 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") diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 9a2f69eca6..b0ec69d7f0 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -1,6 +1,9 @@ # WRF CMake Build set( FOLDER_COMPILE_TARGETS ) +add_compile_options ( "${PROJECT_COMPILE_OPTIONS}" ) +add_compile_definitions( "${PROJECT_COMPILE_DEFINITIONS}" ) + # First make true executables if ( ${WRF_CORE} STREQUAL "PLUS" ) add_executable( diff --git a/phys/CMakeLists.txt b/phys/CMakeLists.txt index d7d85e1c12..d3df6a28e0 100644 --- a/phys/CMakeLists.txt +++ b/phys/CMakeLists.txt @@ -5,14 +5,13 @@ # Quickly preprocess some files so that cmake can understand the module dependencies # ######################################################################################################################## -get_directory_property( DIR_DEFS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS ) wrf_c_preproc_fortran( TARGET_NAME module_ra_rrtmg_preproc OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/preproc/ EXTENSION ".f90" INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} DEPENDENCIES registry_code - DEFINITIONS ${DIR_DEFS} + DEFINITIONS ${PROJECT_COMPILE_DEFINITIONS} SOURCES module_ra_rrtmg_lwk.F module_ra_rrtmg_lwf.F module_ra_rrtmg_swk.F diff --git a/phys/ccpp_kind_types.F b/phys/ccpp_kind_types.F index 9360bbf67e..5647ce0362 100644 --- a/phys/ccpp_kind_types.F +++ b/phys/ccpp_kind_types.F @@ -1,5 +1,5 @@ module ccpp_kind_types -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION integer, parameter :: kind_phys = selected_real_kind(6) #else integer, parameter :: kind_phys = selected_real_kind(12) diff --git a/phys/module_mp_ntu.F b/phys/module_mp_ntu.F index d4fc4ee33d..5629d63415 100644 --- a/phys/module_mp_ntu.F +++ b/phys/module_mp_ntu.F @@ -661,12 +661,10 @@ REAL FUNCTION GAMLN(XX) ! Referred to y = y+1.D0 ser = ser+cof(J)/y ENDDO -#if (DWORDSIZE == 8 && RWORDSIZE == 8) +#ifdef DOUBLE_PRECISION GAMLN = TMP+LOG(stp*ser/X) -#elif (DWORDSIZE == 8 && RWORDSIZE == 4) - GAMLN = SNGL(TMP+LOG(stp*ser/X)) #else -! This is a temporary hack assuming double precision is 8 bytes. + GAMLN = SNGL(TMP+LOG(stp*ser/X)) #endif END FUNCTION GAMLN diff --git a/phys/module_mp_wdm5.F b/phys/module_mp_wdm5.F index 6e69b082e2..0e67a665c6 100644 --- a/phys/module_mp_wdm5.F +++ b/phys/module_mp_wdm5.F @@ -1,4 +1,4 @@ -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION # define VREC vsrec # define VSQRT vssqrt #else diff --git a/phys/module_mp_wdm6.F b/phys/module_mp_wdm6.F index 4509fff847..e30ec5ade9 100644 --- a/phys/module_mp_wdm6.F +++ b/phys/module_mp_wdm6.F @@ -1,4 +1,4 @@ -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION # define VREC vsrec # define VSQRT vssqrt #else diff --git a/phys/module_mp_wdm7.F b/phys/module_mp_wdm7.F index d29374481c..9096c997e5 100644 --- a/phys/module_mp_wdm7.F +++ b/phys/module_mp_wdm7.F @@ -1,4 +1,4 @@ -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION # define VREC vsrec # define VSQRT vssqrt #else diff --git a/phys/module_mp_wsm3.F b/phys/module_mp_wsm3.F index a71d3cbfa6..0081a4817e 100644 --- a/phys/module_mp_wsm3.F +++ b/phys/module_mp_wsm3.F @@ -1,7 +1,7 @@ #ifdef _ACCEL # include "module_mp_wsm3_accel.F" #else -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION # define VREC vsrec # define VSQRT vssqrt #else diff --git a/phys/module_mp_wsm3_accel.F b/phys/module_mp_wsm3_accel.F index bacec9bfad..21c7a7e00e 100644 --- a/phys/module_mp_wsm3_accel.F +++ b/phys/module_mp_wsm3_accel.F @@ -1,4 +1,4 @@ -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION # define VREC vsrec # define VSQRT vssqrt #else diff --git a/phys/module_mp_wsm5.F b/phys/module_mp_wsm5.F index e081a7b6e4..c80978e702 100644 --- a/phys/module_mp_wsm5.F +++ b/phys/module_mp_wsm5.F @@ -1,7 +1,7 @@ #ifdef _ACCEL # include "module_mp_wsm5_accel.F" #else -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION # define VREC vsrec # define VSQRT vssqrt #else diff --git a/phys/module_mp_wsm5_accel.F b/phys/module_mp_wsm5_accel.F index 085ef2f441..286e6a14cd 100644 --- a/phys/module_mp_wsm5_accel.F +++ b/phys/module_mp_wsm5_accel.F @@ -1,4 +1,4 @@ -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION # define VREC vsrec # define VSQRT vssqrt #else diff --git a/phys/module_mp_wsm7.F b/phys/module_mp_wsm7.F index 8f757f08c5..9b0c777d47 100644 --- a/phys/module_mp_wsm7.F +++ b/phys/module_mp_wsm7.F @@ -1,4 +1,4 @@ -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION # define VREC vsrec # define VSQRT vssqrt #else diff --git a/phys/module_ra_cam_support.F b/phys/module_ra_cam_support.F index 4e71f21dcd..86c1ffd501 100644 --- a/phys/module_ra_cam_support.F +++ b/phys/module_ra_cam_support.F @@ -3517,7 +3517,7 @@ subroutine oznini(ozmixm,pin,levsiz,num_months,XLAT, & #if ( defined( DM_PARALLEL ) && ( ! defined( STUBMPI ) ) ) endif if_master call wrf_debug(1,"Broadcast ozone to other ranks.") -# if ( RWORDSIZE == DWORDSIZE ) +# ifdef DOUBLE_PRECISION call MPI_Bcast(ozmixin,size(ozmixin),MPI_DOUBLE_PRECISION,0,local_communicator,ierr) call MPI_Bcast(pin,size(pin),MPI_DOUBLE_PRECISION,0,local_communicator,ierr) plev=pin diff --git a/phys/module_ra_goddard.F b/phys/module_ra_goddard.F index f9387c1a92..402491dc1a 100644 --- a/phys/module_ra_goddard.F +++ b/phys/module_ra_goddard.F @@ -2062,14 +2062,14 @@ subroutine goddardrad( sw_or_lw, dx & ENDDO -#if (RWORDSIZE == 4) +#ifndef DOUBLE_PRECISION call swrad ( np=dk_half, icb=icb, ict=ict, fcld=dble(fcld1d), & pl=dble(p8w1d), ta=dble(t1d), wa=dble(sh1d), oa=dble(o31d), & taucl=dble(taucl_sw), ssacl=dble(ssacl_sw), asycl=dble(asycl_sw), & taual=dble(taual_sw), ssaal=dble(ssaal_sw), asyal=dble(asyal_sw), & cosz=dble(cosz), rsuvbm=dble(rsuvbm), rsuvdf=dble(rsuvdf), rsirbm=dble(rsirbm), rsirdf=dble(rsirdf),& flx_out=flx, flxd_out=flxd,flxu_out=flxu, flxd_surf = flxd_surf, lmask=lmask, irestrict=min(CHUNK,ite-ii+1) ) -#elif (RWORDSIZE == 8) +#else call swrad ( np=dk_half, icb=icb, ict=ict, fcld=fcld1d, & pl=p8w1d, ta=t1d, wa=sh1d, oa=o31d, & taucl=taucl_sw, ssacl=ssacl_sw, asycl=asycl_sw, & @@ -2312,14 +2312,14 @@ subroutine goddardrad( sw_or_lw, dx & ! 1-dimension driver of longwave radiative transfer scheme ! -#if (RWORDSIZE == 4) +#ifndef DOUBLE_PRECISION call lwrad ( np=dk_half, tb=dble(tsfc), ts=dble(tskin), ict=ict, icb=icb,& pl=dble(p8w1d), ta=dble(t1d), wa=dble(sh1d), oa=dble(o31d), & emiss=dble(emis1d), fcld=dble(fcld1d), & taucl=dble(taucl_lw), ssacl=dble(ssacl_lw), asycl=dble(asycl_lw), & taual=dble(taual_lw), ssaal=dble(ssaal_lw), asyal=dble(asyal_lw), & flx_out=flx, acflxd_out=flxd, acflxu_out=flxu, irestrict=min(CHUNK,ite-ii+1) ) -#elif (RWORDSIZE == 8) +#else call lwrad ( np=dk_half, tb=tsfc, ts=tskin, ict=ict, icb=icb,& pl=p8w1d, ta=t1d, wa=sh1d, oa=o31d, & emiss=emis1d, fcld=fcld1d, & diff --git a/phys/module_ra_rrtmg_aero_optical_util_cmaq.F b/phys/module_ra_rrtmg_aero_optical_util_cmaq.F index 7ec0864a4e..48ba55d893 100644 --- a/phys/module_ra_rrtmg_aero_optical_util_cmaq.F +++ b/phys/module_ra_rrtmg_aero_optical_util_cmaq.F @@ -1687,7 +1687,7 @@ SUBROUTINE BHCOAT (XX, YY, RRFRL1, RRFRL2, QQEXT, QQSCA, QBACK, GGSCA, SUCCESS) SUCCESS = .TRUE. -#if ( RWORDSIZE == 8 ) +#ifdef DOUBLE_PRECISION II = c_set(0.0, 1.0) #else II = c_set(0.0D0, 1.0D0) @@ -1733,13 +1733,13 @@ SUBROUTINE BHCOAT (XX, YY, RRFRL1, RRFRL2, QQEXT, QQSCA, QBACK, GGSCA, SUCCESS) xi0y = c_sub(psi0y, c_mul(chi0y, II)) xi1y = c_sub(psi1y, c_mul(chi1y, II)) -#if ( RWORDSIZE == 8 ) +#ifdef DOUBLE_PRECISION chi0y2 = c_mul(-1.0, c_SIN(y2)) #else chi0y2 = c_mul(-1.0d0, c_SIN(y2)) #endif chi1y2 = c_COS(y2) -#if ( RWORDSIZE == 8 ) +#ifdef DOUBLE_PRECISION chi0x2 = c_mul(-1.0, c_SIN(x2)) #else chi0x2 = c_mul(-1.0d0, c_SIN(x2)) @@ -1748,7 +1748,7 @@ SUBROUTINE BHCOAT (XX, YY, RRFRL1, RRFRL2, QQEXT, QQSCA, QBACK, GGSCA, SUCCESS) qsca = 0.0d0 qext = 0.0d0 GSCA = 0.0d0 -#if ( RWORDSIZE == 8 ) +#ifdef DOUBLE_PRECISION xback = c_set(0.0, 0.0) #else xback = c_set(0.0d0, 0.0d0) @@ -1806,7 +1806,7 @@ SUBROUTINE BHCOAT (XX, YY, RRFRL1, RRFRL2, QQEXT, QQSCA, QBACK, GGSCA, SUCCESS) (c_ABS(amess3) .LE. del*c_ABS(d1y2)) .AND. & (c_ABS(amess4) .LE. del) ) THEN ! convergence for inner sphere -#if ( RWORDSIZE == 8 ) +#ifdef DOUBLE_PRECISION brack = c_set(0.0,0.0) crack = c_set(0.0,0.0) #else diff --git a/phys/module_ra_rrtmg_lw.F b/phys/module_ra_rrtmg_lw.F index 6b5dc2d342..fd04a0370c 100644 --- a/phys/module_ra_rrtmg_lw.F +++ b/phys/module_ra_rrtmg_lw.F @@ -32,10 +32,10 @@ module parkind #if 0 ! Modified for WRF: -#if (RWORDSIZE == 8) +#ifdef DOUBLE_PRECISION integer, parameter :: kind_rb = selected_real_kind(12) ! 8 byte real #endif -#if (RWORDSIZE == 4) +#ifndef DOUBLE_PRECISION integer, parameter :: kind_rb = selected_real_kind(6) ! 4 byte real #endif #else diff --git a/share/module_check_a_mundo.F b/share/module_check_a_mundo.F index 8ad4e88a6d..0bc9c2f37e 100644 --- a/share/module_check_a_mundo.F +++ b/share/module_check_a_mundo.F @@ -671,7 +671,7 @@ END FUNCTION bep_bem_ngr_u !----------------------------------------------------------------------- ! There is a binary file for Goddard radiation. It is single precision. !----------------------------------------------------------------------- -# if ( defined(PROMOTE_FLOAT) || ( RWORDSIZE == DWORDSIZE ) ) +# ifdef DOUBLE_PRECISION god_r8 : DO i = 1, model_config_rec % max_dom IF ( .NOT. model_config_rec % grid_allowed(i) ) CYCLE IF ( ( model_config_rec % ra_lw_physics(i) == goddardlwscheme ) .OR. & diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 1181ab0af4..a261177f1a 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,4 +1,6 @@ # WRF CMake Build +add_compile_options ( "${PROJECT_COMPILE_OPTIONS}" ) +add_compile_definitions( "${PROJECT_COMPILE_DEFINITIONS}" ) #!TODO ORGANIZE THIS FOLDER set( FOLDER_COMPILE_TARGET registry ) @@ -99,10 +101,9 @@ elseif ( ${WRF_CORE} STREQUAL "DA" OR ${WRF_CORE} STREQUAL "DA_4D_VAR" ) endif() -get_directory_property( DIR_DEFS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS ) wrf_expand_definitions( RESULT_VAR REGISTRY_DEFS - DEFINITIONS ${DIR_DEFS} + DEFINITIONS ${PROJECT_COMPILE_DEFINITIONS} ) # How this is not a bigger thing or not resolved is beyond me diff --git a/var/da/da_control/da_control.f90 b/var/da/da_control/da_control.f90 index 46810d7bec..6b9a6f93e2 100644 --- a/var/da/da_control/da_control.f90 +++ b/var/da/da_control/da_control.f90 @@ -99,7 +99,7 @@ module da_control !hcl-note: should the top and interval be namelist options? integer, parameter :: interpolate_level = 2000 -#if RWORDSIZE==8 +#ifdef DOUBLE_PRECISION real, parameter :: da_zero = 0D0 #else real, parameter :: da_zero = 0.0 diff --git a/var/da/da_obs_io/da_read_obs_bufr.inc b/var/da/da_obs_io/da_read_obs_bufr.inc index ca29ceada9..60098764aa 100644 --- a/var/da/da_obs_io/da_read_obs_bufr.inc +++ b/var/da/da_obs_io/da_read_obs_bufr.inc @@ -542,7 +542,7 @@ bufrfile: do ibufr=1,numbufr end if if ( obs(7,1) < r8bfms ) then pwq=nint(qms(7,1)) -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION pwe = min(DBLE(err_pw), oes(7,1)) #else pwe = min(err_pw, oes(7,1)) @@ -604,7 +604,7 @@ bufrfile: do ibufr=1,numbufr !Not currently used !cat=nint(obs(8,k)) -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION toe = min(DBLE(err_t), oes(3,k)) woe = min(DBLE(err_uv), oes(5,k)) qoe = min(DBLE(err_q), oes(2,k)*10.0) ! convert to % from PREPBUFR percent divided by 10 @@ -686,7 +686,7 @@ bufrfile: do ibufr=1,numbufr ! assign u,v,t,q obs errors for synop and metar if ( t29 == 512 .or. t29 == 511 .or. t29 == 514 ) then -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION toe = min(DBLE(err_t), oes(3,1)) woe = min(DBLE(err_uv), oes(5,1)) qoe = min(DBLE(err_q), oes(2,1)*10.0) ! convert to % from PREPBUFR percent divided by 10 diff --git a/var/da/da_par_util/da_par_util1.f90 b/var/da/da_par_util/da_par_util1.f90 index 3dce88fb24..bea5a672c0 100644 --- a/var/da/da_par_util/da_par_util1.f90 +++ b/var/da/da_par_util/da_par_util1.f90 @@ -3,7 +3,7 @@ module da_par_util1 use da_control, only : rootproc, ierr, comm, root #ifdef DM_PARALLEL -#if ( DWORDSIZE != RWORDSIZE ) +#ifndef DOUBLE_PRECISION ! use mpi, only : mpi_sum, mpi_integer, mpi_complex, mpi_real #else ! use mpi, only : mpi_sum, mpi_integer, mpi_double_complex, mpi_real8 @@ -21,7 +21,7 @@ module da_par_util1 #ifdef DM_PARALLEL include 'mpif.h' -#if ( DWORDSIZE != RWORDSIZE ) +#ifndef DOUBLE_PRECISION integer, parameter :: true_mpi_real = mpi_real integer, parameter :: true_mpi_complex = mpi_complex #else diff --git a/var/da/da_par_util/da_proc_maxmin_combine.inc b/var/da/da_par_util/da_proc_maxmin_combine.inc index bd3fe40d13..141586ad9e 100644 --- a/var/da/da_par_util/da_proc_maxmin_combine.inc +++ b/var/da/da_par_util/da_proc_maxmin_combine.inc @@ -32,7 +32,7 @@ subroutine da_proc_maxmin_combine(n, max, min) in(2*i) = myproc end do -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION call mpi_reduce(in, out, n, mpi_2real, mpi_minloc, root, comm, ierr) #else call mpi_reduce(in, out, n, mpi_2double_precision, mpi_minloc, root, comm, ierr) @@ -65,7 +65,7 @@ subroutine da_proc_maxmin_combine(n, max, min) in(2*i-1) = max(i)%value in(2*i) = myproc end do -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION call mpi_reduce(in, out, n, mpi_2real, mpi_maxloc, root, comm, ierr) #else call mpi_reduce(in, out, n, mpi_2double_precision, mpi_maxloc, root, comm, ierr) diff --git a/var/da/da_par_util/da_proc_stats_combine.inc b/var/da/da_par_util/da_proc_stats_combine.inc index d8fd895f57..74573c9300 100644 --- a/var/da/da_par_util/da_proc_stats_combine.inc +++ b/var/da/da_par_util/da_proc_stats_combine.inc @@ -43,7 +43,7 @@ subroutine da_proc_stats_combine(proc_ave, proc_err, proc_min, proc_max, & ! Get minimum value and associated processor index. in(1) = proc_min in(2) = myproc -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION call mpi_reduce(in, out, 1, mpi_2real, mpi_minloc, root, comm, ierr) #else call mpi_reduce(in, out, 1, mpi_2double_precision, mpi_minloc, root, comm, ierr) @@ -73,7 +73,7 @@ subroutine da_proc_stats_combine(proc_ave, proc_err, proc_min, proc_max, & in(1) = proc_max in(2) = myproc -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION call mpi_reduce(in, out, 1, mpi_2real, mpi_maxloc, root, comm, ierr) #else call mpi_reduce(in, out, 1, mpi_2double_precision, mpi_maxloc, root, comm, ierr) diff --git a/var/da/da_radiance/gsi_kinds.f90 b/var/da/da_radiance/gsi_kinds.f90 index 0c0ac7c27c..672a43fb5d 100644 --- a/var/da/da_radiance/gsi_kinds.f90 +++ b/var/da/da_radiance/gsi_kinds.f90 @@ -96,7 +96,7 @@ module gsi_kinds ! Default values ! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT REAL TYPE KIND *** ! 1=single, 2=double, 3=quad -#if ( RWORDSIZE == 4 ) +#ifndef DOUBLE_PRECISION integer, parameter, private :: default_real = 1 #else integer, parameter, private :: default_real = 2 diff --git a/wrftladj/module_big_step_utilities_em_ad.F b/wrftladj/module_big_step_utilities_em_ad.F index 8cc13725e9..b4f42ca6b7 100644 --- a/wrftladj/module_big_step_utilities_em_ad.F +++ b/wrftladj/module_big_step_utilities_em_ad.F @@ -11,7 +11,7 @@ MODULE a_module_big_step_utilities_em kfetascheme, mskfscheme, g3scheme, p_qv, param_first_scalar, p_qr, p_qc, DFI_FWD USE module_configure, ONLY : grid_config_rec_type USE module_wrf_error -#if (RWORDSIZE == 4) +#ifndef DOUBLE_PRECISION # define VPOWX vspowx # define VPOW vspow #else diff --git a/wrftladj/module_big_step_utilities_em_tl.F b/wrftladj/module_big_step_utilities_em_tl.F index cab1e5e525..67d79f9b7d 100644 --- a/wrftladj/module_big_step_utilities_em_tl.F +++ b/wrftladj/module_big_step_utilities_em_tl.F @@ -5,7 +5,7 @@ ! and LSEC of ICMSEC, AMSS(2001-2003) ! The copyright of the DFT system was declared by Walls at LASG, 1998-2010 ! ====================================================================================== -#if (RWORDSIZE == 4) +#ifndef DOUBLE_PRECISION # define VPOWX vspowx # define VPOW vspow #else