diff --git a/.gitignore b/.gitignore index 8296d548..27d970ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ # Whitelist ignore file: Ignore everything that isn't explicitly included * !*/ +bin/ +build !ctem/** !examples/** !src/** diff --git a/CMakeLists.txt b/CMakeLists.txt index 2984d6cb..fd259936 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.6.0...3.27.1) # Get version stored in text file FILE(READ "version.txt" VERSION) -PROJECT(${SKBUILD_PROJECT_NAME} LANGUAGES C Fortran VERSION ${VERSION}) +PROJECT(CTEM LANGUAGES C Fortran VERSION ${VERSION}) IF (CMAKE_Fortran_COMPILER_ID MATCHES "^Intel") SET(COMPILER_OPTIONS "Intel" CACHE STRING "Compiler identified as Intel") @@ -70,7 +70,7 @@ SET(CTEM_LIBRARY ctem) # The source for the CTEM binary and have it placed in the bin folder ADD_SUBDIRECTORY(${SRC} ${BIN}) -ADD_SUBDIRECTORY(${PY}) +#ADD_SUBDIRECTORY(${PY}) # Add a distclean target to the Makefile ADD_CUSTOM_TARGET(distclean diff --git a/Makefile.am b/Makefile.am deleted file mode 100755 index 87b94ac3..00000000 --- a/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = src -EXTRA_DIST = autogen.sh diff --git a/cmake/Modules/FindCoarray_Fortran.cmake b/cmake/Modules/FindCoarray_Fortran.cmake deleted file mode 100644 index 01324b15..00000000 --- a/cmake/Modules/FindCoarray_Fortran.cmake +++ /dev/null @@ -1,117 +0,0 @@ -# Copyright 2022 - David Minton, Carlisle Wishard, Jennifer Pouplin, Jake Elliott, & Dana Singh -# This file is part of Swiftest. -# Swiftest is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -# Swiftest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# You should have received a copy of the GNU General Public License along with Swiftest. -# If not, see: https://www.gnu.org/licenses. - -# - Finds Coarray support -# This module can be used to detect Coarray support in a compiler. -# If the compiler supports Coarray, the flags required to compile with -# coarray support are set. -# -# This module was modified from the standard FindOpenMP module to find Fortran -# flags. -# -# The following variables are set: -# Coarray_Fortran_FLAGS - flags to add to the Fortran compiler for Coarray -# support. In general, you must use these at both -# compile- and link-time. -# OMP_NUM_PROCS - the max number of processors available to Coarray - -#============================================================================= - -INCLUDE (FindPackageHandleStandardArgs) - -STRING(TOUPPER "${CMAKE_BUILD_TYPE}" BT) -IF(BT STREQUAL "DEBUG") - IF (COMPILER_OPTIONS STREQUAL "Intel") - SET (Coarray_Fortran_FLAG_CANDIDATES - #Intel - "-coarray=single" - #Intel windows - "/Qcoarray:single" - #Empty, if compiler automatically accepts coarray - " " - ) - ELSEIF (COMPILER_OPTIONS STREQUAL "GNU") - SET (Coarray_Fortran_FLAG_CANDIDATES - #Gnu - "-fcoarray=single" - #Empty, if compiler automatically accepts coarray - " " - ) - ENDIF() -ELSE() - IF (COMPILER_OPTIONS STREQUAL "Intel") - SET (Coarray_Fortran_FLAG_CANDIDATES - #Intel - "-coarray=distributed" - #Intel windows - "/Qcoarray:distributed" - #Empty, if compiler automatically accepts coarray - " " - ) - ELSEIF (COMPILER_OPTIONS STREQUAL "GNU") - SET (Coarray_Fortran_FLAG_CANDIDATES - #Gnu - "-fcoarray=lib -lcaf_mpi" - #Empty, if compiler automatically accepts coarray - " " - ) -ENDIF() - - -IF (DEFINED Coarray_Fortran_FLAGS) - SET (Coarray_Fortran_FLAG_CANDIDATES) -ENDIF (DEFINED Coarray_Fortran_FLAGS) - -# check fortran compiler. also determine number of processors -FOREACH (FLAG ${Coarray_Fortran_FLAG_CANDIDATES}) - SET (SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - SET (CMAKE_REQUIRED_FLAGS "${FLAG}") - UNSET (Coarray_FLAG_DETECTED CACHE) - MESSAGE (STATUS "Try Coarray Fortran flag = [${FLAG}]") - FILE (WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCoarray.f90" -" -program TestCoarray - integer, codimension[*] :: i - write(*,'(I2)',ADVANCE='NO') num_images() -end program TestCoarray -") - SET (MACRO_CHECK_FUNCTION_DEFINITIONS - "-DCoarray_FLAG_DETECTED ${CMAKE_REQUIRED_FLAGS}") - TRY_RUN (Coarray_RUN_FAILED Coarray_FLAG_DETECTED ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCoarray.f90 - COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - COMPILE_OUTPUT_VARIABLE OUTPUT - RUN_OUTPUT_VARIABLE OMP_NUM_PROCS_INTERNAL) - IF (Coarray_FLAG_DETECTED) - FILE (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the Fortran compiler supports Coarray passed with " - "the following output:\n${OUTPUT}\n\n") - SET (Coarray_FLAG_DETECTED 1) - IF (Coarray_RUN_FAILED) - MESSAGE (FATAL_ERROR "Coarray found, but test code did not run") - ENDIF (Coarray_RUN_FAILED) - SET (Coarray_Fortran_FLAGS_INTERNAL "${FLAG}") - BREAK () - ELSE () - FILE (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the Fortran compiler supports Coarray failed with " - "the following output:\n${OUTPUT}\n\n") - SET (Coarray_FLAG_DETECTED 0) - ENDIF (Coarray_FLAG_DETECTED) -ENDFOREACH (FLAG ${Coarray_Fortran_FLAG_CANDIDATES}) - -SET (Coarray_Fortran_FLAGS "${Coarray_Fortran_FLAGS_INTERNAL}" - CACHE STRING "Fortran compiler flags for Coarray parallization") - -# handle the standard arguments for FIND_PACKAGE -FIND_PACKAGE_HANDLE_STANDARD_ARGS (Coarray_Fortran DEFAULT_MSG - Coarray_Fortran_FLAGS) - -MARK_AS_ADVANCED(Coarray_Fortran_FLAGS) diff --git a/cmake/Modules/FindMKL.cmake b/cmake/Modules/FindMKL.cmake deleted file mode 100644 index 9e48932c..00000000 --- a/cmake/Modules/FindMKL.cmake +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2022 - David Minton, Carlisle Wishard, Jennifer Pouplin, Jake Elliott, & Dana Singh -# This file is part of Swiftest. -# Swiftest is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -# Swiftest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# You should have received a copy of the GNU General Public License along with Swiftest. -# If not, see: https://www.gnu.org/licenses. - -# - Finds the Intel MKL libraries -find_path(MKL_INCLUDE_DIR NAMES mkl.h HINTS ENV MKLROOT PATH_SUFFIXES include) -find_library(MKL_LIBRARY NAMES libmkl_core.a HINTS ENV MKLROOT PATH_SUFFIXES lib lib/intel64 ) - -set(MKL_FOUND TRUE) -set(MKL_INCLUDE_DIRS ${MKL_INCLUDE_DIR}) -set(MKL_LIBRARIES ${MKL_LIBRARY}) -mark_as_advanced(MKL_LIBRARY MKL_INCLUDE_DIR) \ No newline at end of file diff --git a/cmake/Modules/FindNETCDF.cmake b/cmake/Modules/FindNETCDF.cmake deleted file mode 100644 index 05f91e77..00000000 --- a/cmake/Modules/FindNETCDF.cmake +++ /dev/null @@ -1,207 +0,0 @@ -# Copyright 2022 - David Minton, Carlisle Wishard, Jennifer Pouplin, Jake Elliott, & Dana Singh -# This file is part of Swiftest. -# Swiftest is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -# Swiftest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# You should have received a copy of the GNU General Public License along with Swiftest. -# If not, see: https://www.gnu.org/licenses. - -# - Finds the NetCDF libraries - -SET(NFPREFIX_DIR ${CMAKE_SOURCE_DIR} CACHE PATH "Location of provided NetCDF-Fortran dependencies") -SET(NFINCLUDE_DIR "${NFPREFIX_DIR}/include" CACHE PATH "Location of provided netcdf.mod") -IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") - FIND_PATH(NFBIN - NAMES nf-config - HINTS - NFPREFIX_DIR - ENV NETCDF_FORTRAN_HOME - ENV PATH - PATH_SUFFIXES - bin - ) - - IF (NFBIN) - SET(CMD "${NFBIN}/nf-config") - LIST(APPEND CMD "--includedir") - MESSAGE(STATUS "Searching for NetCDF-Fortran include directory using ${CMD}") - EXECUTE_PROCESS(COMMAND ${CMD} OUTPUT_VARIABLE NFINCLUDE_DIR ERROR_VARIABLE ERR RESULT_VARIABLE RES OUTPUT_STRIP_TRAILING_WHITESPACE) - IF (NFINCLUDE_DIR) - MESSAGE(STATUS "Found in ${NFINCLUDE_DIR}") - ELSE () - MESSAGE(STATUS "Cannot execute ${CMD}") - MESSAGE(STATUS "OUTPUT: ${NFINCLUDE_DIR}") - MESSAGE(STATUS "RESULT: ${RES}") - MESSAGE(STATUS "ERROR : ${ERR}") - ENDIF () - - SET(CMD "${NFBIN}/nf-config") - LIST(APPEND CMD "--prefix") - MESSAGE(STATUS "Searching for NetCDF-Fortran library directory using ${CMD}") - EXECUTE_PROCESS(COMMAND ${CMD} OUTPUT_VARIABLE NFPREFIX_DIR ERROR_VARIABLE ERR RESULT_VARIABLE RES OUTPUT_STRIP_TRAILING_WHITESPACE) - IF (NFPREFIX_DIR) - MESSAGE(STATUS "Found in ${NFPREFIX_DIR}") - ELSE () - MESSAGE(STATUS "Cannot execute ${CMD}") - MESSAGE(STATUS "OUTPUT: ${NFPREFIX_DIR}") - MESSAGE(STATUS "RESULT: ${RES}") - MESSAGE(STATUS "ERROR : ${ERR}") - ENDIF () - ENDIF() -ENDIF() - -MESSAGE(STATUS "\nNETCDF_INCLUDE: $ENV{NETCDF_INCLUDE}\nNETCDF_FORTRAN_HOME: $ENV{NETCDF_FORTRAN_HOME}\n") -FIND_PATH(NETCDF_INCLUDE_DIR - NAMES netcdf.mod - HINTS - ${NFINCLUDE_DIR} - ENV NETCDF_INCLUDE - ENV NETCDF_FORTRAN_HOME - ENV CPATH - PATH_SUFFIXES - include - modules - mod - REQUIRED -) - -MESSAGE(STATUS "NetCDF-Fortran include directory: ${NETCDF_INCLUDE_DIR}") - -IF (BUILD_SHARED_LIBS) - SET(NETCDFF "netcdff") -ELSE () - SET(NCPREFIX_DIR ${CMAKE_SOURCE_DIR} CACHE PATH "Location of provided NetCDF-C dependencies") - SET(H5PREFIX_DIR ${CMAKE_SOURCE_DIR} CACHE PATH "Location of provided HDF5 dependencies") - SET(ZPREFIX_DIR ${CMAKE_SOURCE_DIR} CACHE PATH "Location of provided zlib dependencies") - IF (CMAKE_SYSTEM_NAME STREQUAL "Windows") - SET(NETCDFF "netcdff.lib") - SET(NETCDF "netcdf.lib") - SET(HDF5 "libhdf5.lib") - SET(HDF5_HL "libhdf5_hl.lib") - SET(ZLIB "zlibstatic.lib") - ELSE () - SET(NETCDFF "libnetcdff.a") - SET(NETCDF "libnetcdf.a") - SET(HDF5 "libhdf5.a") - SET(HDF5_HL "libhdf5_hl.a") - SET(ZLIB "libz.a") - ENDIF() -ENDIF() - -FIND_LIBRARY(NETCDF_FORTRAN_LIBRARY - NAMES ${NETCDFF} - HINTS - ${NFPREFIX_DIR} - ENV NETCDF_FORTRAN_HOME - ENV NETCDF_HOME - ENV LD_LIBRARY_PATH - PATH_SUFFIXES - lib - ${CMAKE_LIBRARY_ARCHITECTURE} - REQUIRED -) - -MESSAGE(STATUS "NetCDF-Fortran Library: ${NETCDF_FORTRAN_LIBRARY}") - -IF (BUILD_SHARED_LIBS) - SET(NETCDF_LIBRARIES ${NETCDF_FORTRAN_LIBRARY} CACHE STRING "NetCDF Fortran library") -ELSE () - FIND_LIBRARY(NETCDF_LIBRARY - NAMES ${NETCDF} - HINTS - ${NCPREFIX_DIR} - ENV NETCDF_HOME - ENV LD_LIBRARY_PATH - PATH_SUFFIXES - lib - ${CMAKE_LIBRARY_ARCHITECTURE} - REQUIRED - ) - - MESSAGE(STATUS "NetCDF-C Library: ${NETCDF_LIBRARY}") - IF (CMAKE_SYSTEM_NAME STREQUAL "Windows") - FIND_LIBRARY(HDF5_LIBRARY - NAMES ${HDF5} - HINTS - ${H5PREFIX_DIR} - ENV HDF5_ROOT - ENV LD_LIBRARY_PATH - PATH_SUFFIXES - lib - ${CMAKE_LIBRARY_ARCHITECTURE} - REQUIRED - ) - - FIND_LIBRARY(HDF5_HL_LIBRARY - NAMES ${HDF5_HL} - HINTS - ${H5PREFIX_DIR} - ENV HDF5_ROOT - ENV LD_LIBRARY_PATH - PATH_SUFFIXES - lib - ${CMAKE_LIBRARY_ARCHITECTURE} - REQUIRED - ) - - FIND_LIBRARY(Z_LIBRARY - NAMES ${ZLIB} - HINTS - ${ZPREFIX_DIR} - ENV ZLIB_ROOT - ENV LD_LIBRARY_PATH - PATH_SUFFIXES - lib - ${CMAKE_LIBRARY_ARCHITECTURE} - REQUIRED - ) - - LIST(APPEND EXTRA_FLAGS ${HDF5_LIBRARY} ${HDF5_HL_LIBRARY} ${Z_LIBRARY}) - - ELSE () - FIND_PATH(NCBIN - NAMES nc-config - HINTS - ENV NETCDF_HOME - ENV PATH - PATH_SUFFIXES - bin - ) - - IF (NCBIN) # The nc-config utility is available. Parse its output for unique flags - SET(CMD "${NCBIN}/nc-config") - LIST(APPEND CMD "--libs") - LIST(APPEND CMD "--static") - MESSAGE(STATUS "NetCDF configuration command: ${CMD}") - EXECUTE_PROCESS(COMMAND ${CMD} OUTPUT_VARIABLE EXTRA_FLAGS ERROR_VARIABLE ERR RESULT_VARIABLE RES OUTPUT_STRIP_TRAILING_WHITESPACE) - IF (EXTRA_FLAGS) - SEPARATE_ARGUMENTS(EXTRA_FLAGS NATIVE_COMMAND "${EXTRA_FLAGS}") - LIST(REMOVE_DUPLICATES EXTRA_FLAGS) - LIST(FILTER EXTRA_FLAGS EXCLUDE REGEX "netcdf+") - MESSAGE(STATUS "Extra library flags: ${EXTRA_FLAGS}") - ELSE () - MESSAGE(STATUS "Cannot execute ${CMD}") - MESSAGE(STATUS "OUTPUT: ${EXTRA_FLAGS}") - MESSAGE(STATUS "RESUL : ${RES}") - MESSAGE(STATUS "ERROR : ${ERR}") - MESSAGE(FATAL_ERROR "Cannot configure NetCDF for static") - ENDIF () - ELSE () - MESSAGE(FATAL_ERROR "Cannot find nc-config") - ENDIF () - ENDIF() - - IF (DEFINED ENV{LIBS}) - STRING(STRIP "$ENV{LIBS}" LIBS) - SEPARATE_ARGUMENTS(LIBS NATIVE_COMMAND "${LIBS}") - LIST(APPEND EXTRA_FLAGS ${LIBS}) - ENDIF() - - # Note for posterity: When building static libraries, NETCDF_FORTRAN_LIBRARY must come *before* NETCDF_LIBRARY. Otherwise you get a bunch of "undefined reference to" errors - SET(NETCDF_LIBRARIES ${NETCDF_FORTRAN_LIBRARY} ${NETCDF_LIBRARY} ${EXTRA_FLAGS} CACHE STRING "NetCDF Fortran and dependant static libraries") -ENDIF () -MESSAGE(STATUS "NetCDF dependencies: ${NETCDF_LIBRARIES}") - -SET(NETCDF_FOUND TRUE) -MARK_AS_ADVANCED(NETCDF_LIBRARIES NETCDF_INCLUDE_DIR) \ No newline at end of file diff --git a/cmake/Modules/SetFortranFlags.cmake b/cmake/Modules/SetFortranFlags.cmake index c5514e74..dd940f0f 100644 --- a/cmake/Modules/SetFortranFlags.cmake +++ b/cmake/Modules/SetFortranFlags.cmake @@ -112,6 +112,14 @@ ELSEIF (COMPILER_OPTIONS STREQUAL "Intel") SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}" Fortran "/Qpad" # Intel Windows ) + #Enables byte record length + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}" + Fortran "/assume:byterecl" # Intel Windows + ) + #Enables heap arrays + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}" + Fortran "/heap-arrays" + ) ELSE () SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}" Fortran "-no-wrap-margin" # Intel @@ -124,6 +132,14 @@ ELSEIF (COMPILER_OPTIONS STREQUAL "Intel") SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}" Fortran "-pad" # Intel Windows ) + #Enables byte record length + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}" + Fortran "-assume byterecl" + ) + #Enables heap arrays + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}" + Fortran "-heap-arrays" + ) ENDIF () ENDIF () @@ -590,81 +606,65 @@ IF (COMPILER_OPTIONS STREQUAL "Intel") IF (WINOPT) # Some subroutines require more strict floating point operation optimizations for repeatability - SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}" + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" Fortran "/fp:precise" # Intel Windows ) - SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}" + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" Fortran "/Qprec-div" # Intel Windows ) - SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}" + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" Fortran "/Qprec-sqrt" # Intel Windows ) - SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}" + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" Fortran "/assume:protect-parens" # Intel Windows ) # Improves floating-point precision and consistency - SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}" + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" Fortran "/Qprec" # Intel Windows ) - - # Most subroutines can use aggressive optimization of floating point operations without problems. - SET_COMPILE_FLAG(FASTMATH_FLAGS "${FASTMATH_FLAGS}" - Fortran "/fp:fast" # Intel Windows - ) ELSE () # Some subroutines require more strict floating point operation optimizations for repeatability - SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}" + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" Fortran "-fp-module=precise" # Intel ) - SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}" + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" Fortran "-prec-div" # Intel ) - SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}" + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" Fortran "-prec-sqrt" # Intel ) - SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}" + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" Fortran "-assume protect-parens" # Intel ) # Improves floating-point precision and consistency - SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}" + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" Fortran "-mp1" # Intel Windows ) - - # Most subroutines can use aggressive optimization of floating point operations without problems. - SET_COMPILE_FLAG(FASTMATH_FLAGS "${FASTMATH_FLAGS}" - Fortran "-fp-model=fast" # Intel Windows - ) - ENDIF () ELSEIF (COMPILER_OPTIONS STREQUAL "GNU") # Some subroutines require more strict floating point operation optimizations for repeatability - SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}" + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" Fortran "-fno-unsafe-math-optimizations" # GNU ) # Disable transformations and optimizations that assume default floating-point rounding behavior. - SET_COMPILE_FLAG(STRICTMATH_FLAGS "${STRICTMATH_FLAGS}" + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" Fortran "-frounding-math" ) - - # Most subroutines can use aggressive optimization of floating point operations without problems. - SET_COMPILE_FLAG(FASTMATH_FLAGS "${FASTMATH_FLAGS}" - Fortran "-ffast-math" # GNU - ) ENDIF () # Debug mode always uses strict math SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" - Fortran ${STRICTMATH_FLAGS} + Fortran ${CMAKE_Fortran_FLAGS_RELEASE} ) ##################### diff --git a/cmake/Modules/SetMKL.cmake b/cmake/Modules/SetMKL.cmake deleted file mode 100644 index e58c9f51..00000000 --- a/cmake/Modules/SetMKL.cmake +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2022 - David Minton, Carlisle Wishard, Jennifer Pouplin, Jake Elliott, & Dana Singh -# This file is part of Swiftest. -# Swiftest is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -# Swiftest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# You should have received a copy of the GNU General Public License along with Swiftest. -# If not, see: https://www.gnu.org/licenses. - -# Find MKL if not already found -IF(NOT MKL_FOUND) - ENABLE_LANGUAGE(C) # Some libraries need a C compiler to find - FIND_PACKAGE(MKL REQUIRED) -ENDIF(NOT MKL_FOUND) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8e25a629..0a698297 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,35 +17,145 @@ IF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) ENDIF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) INCLUDE(SetParallelizationLibrary) -INCLUDE(SetUpNetCDF) -IF (COMPILER_OPTIONS STREQUAL "Intel" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") - INCLUDE(SetMKL) -ENDIF () # This INCLUDE statement executes code that sets the compile flags for DEBUG, # RELEASE, PROFILING, and TESTING. INCLUDE(SetFortranFlags) # Add the source files -SET(SOURCE_FILES - +SET(SRC_FILES + ${SRC}/globals/module_globals.f90 + ${SRC}/util/module_util.f90 + ${SRC}/io/module_io.f90 + ${SRC}/crater/module_crater.f90 + ${SRC}/ejecta/module_ejecta.f90 + ${SRC}/init/module_init.f90 + ${SRC}/seismic/module_seismic.f90 + ${SRC}/regolith/module_regolith.f90 + ${SRC}/porosity/module_porosity.f90 + ${SRC}/realistic/module_realistic.f90 + ${SRC}/util/util_toupper.f90 + ${SRC}/util/util_mrgrnk.f90 + ${SRC}/util/util_add_to_layer.f90 + ${SRC}/util/util_remove_from_layer.f90 + ${SRC}/util/util_sort_layer.f90 + ${SRC}/util/util_periodic.f90 + ${SRC}/util/util_search.f90 + ${SRC}/util/util_rootbracketed.f90 + ${SRC}/util/util_diffusion_solver.f90 + ${SRC}/util/util_area_intersection.f90 + ${SRC}/util/util_poisson.f90 + ${SRC}/util/util_pop.f90 + ${SRC}/util/util_pop_array.f90 + ${SRC}/util/util_push_array.f90 + ${SRC}/util/util_traverse_pop_array.f90 + ${SRC}/util/util_destroy_list.f90 + ${SRC}/util/util_init_array.f90 + ${SRC}/util/util_perlin_noise.f90 + ${SRC}/util/util_random_number_normal.f90 + ${SRC}/util/util_npf_timefunc.f90 + ${SRC}/util/util_tscale.f90 + ${SRC}/util/util_t_from_scale.f90 + ${SRC}/io/io_read_const.f90 + ${SRC}/io/io_get_token.f90 + ${SRC}/io/io_input.f90 + ${SRC}/io/io_read_craterlist.f90 + ${SRC}/io/io_read_prod.f90 + ${SRC}/io/io_read_regotrack.f90 + ${SRC}/io/io_read_vdist.f90 + ${SRC}/io/io_read_surf.f90 + ${SRC}/io/io_ejecta_table.f90 + ${SRC}/io/io_write_dist.f90 + ${SRC}/io/io_write_tally.f90 + ${SRC}/io/io_write_surf.f90 + ${SRC}/io/io_write_const.f90 + ${SRC}/io/io_write_regotrack.f90 + ${SRC}/io/io_crater_profile.f90 + ${SRC}/io/io_updatePbar.f90 + ${SRC}/io/io_resetPbar.f90 + ${SRC}/io/io_splash.f90 + ${SRC}/io/io_write_pindex_map.f90 + ${SRC}/ejecta/ejecta_emplace.f90 + ${SRC}/ejecta/ejecta_ray_pattern.f90 + ${SRC}/ejecta/ejecta_ray_pattern_func.f90 + ${SRC}/ejecta/ejecta_ray_func.f90 + ${SRC}/ejecta/ejecta_blanket.f90 + ${SRC}/ejecta/ejecta_blanket_func.f90 + ${SRC}/ejecta/ejecta_thickness.f90 + ${SRC}/ejecta/ejecta_table_define.f90 + ${SRC}/ejecta/ejecta_interpolate.f90 + ${SRC}/ejecta/ejecta_rootfind.f90 + ${SRC}/ejecta/ejecta_soften.f90 + ${SRC}/ejecta/ejecta_distance_estimate.f90 + ${SRC}/crater/crater_populate.f90 + ${SRC}/crater/crater_scale.f90 + ${SRC}/crater/crater_generate.f90 + ${SRC}/crater/crater_dimensions.f90 + ${SRC}/crater/crater_averages.f90 + ${SRC}/crater/crater_emplace.f90 + ${SRC}/crater/crater_realistic_topography.f90 + ${SRC}/crater/crater_form_interior.f90 + ${SRC}/crater/crater_form_exterior.f90 + ${SRC}/crater/crater_form_exterior_func.f90 + ${SRC}/crater/crater_form_exterior_rootfind.f90 + ${SRC}/crater/crater_record.f90 + ${SRC}/crater/crater_tally_true.f90 + ${SRC}/crater/crater_tally_observed.f90 + ${SRC}/crater/crater_slope_collapse.f90 + ${SRC}/crater/crater_soften.f90 + ${SRC}/crater/crater_subpixel_diffusion.f90 + ${SRC}/crater/crater_make_list.f90 + ${SRC}/crater/crater_degradation_function.f90 + ${SRC}/crater/crater_visibility.f90 + ${SRC}/crater/crater_get_degradation_state.f90 + ${SRC}/crater/crater_profile.f90 + ${SRC}/crater/crater_superdomain.f90 + ${SRC}/init/init_domain.f90 + ${SRC}/init/init_dist.f90 + ${SRC}/init/init_surf.f90 + ${SRC}/init/init_regolith_stack.f90 + ${SRC}/seismic/seismic_shake.f90 + ${SRC}/seismic/seismic_distance.f90 + ${SRC}/seismic/seismic_kdiff_func.f90 + ${SRC}/regolith/regolith_circle_sector_func.f90 + ${SRC}/regolith/regolith_cubic_func.f90 + ${SRC}/regolith/regolith_melt_func.f90 + ${SRC}/regolith/regolith_melt_fraction.f90 + ${SRC}/regolith/regolith_melt_zone.f90 + ${SRC}/regolith/regolith_quadratic_func.f90 + ${SRC}/regolith/regolith_quartic_func.f90 + ${SRC}/regolith/regolith_mix.f90 + ${SRC}/regolith/regolith_depth_model.f90 + ${SRC}/regolith/regolith_streamtube.f90 + ${SRC}/regolith/regolith_streamtube_head.f90 + ${SRC}/regolith/regolith_streamtube_lineseg.f90 + ${SRC}/regolith/regolith_subpixel_streamtube.f90 + ${SRC}/regolith/regolith_transport.f90 + ${SRC}/regolith/regolith_traverse_streamtube.f90 + ${SRC}/regolith/regolith_subcrater_mix.f90 + ${SRC}/regolith/regolith_melt_glass.f90 + ${SRC}/regolith/regolith_superdomain.f90 + ${SRC}/regolith/regolith_melt_zone_superdomain.f90 + ${SRC}/regolith/regolith_streamtube_volume_func.f90 + ${SRC}/regolith/regolith_shock_damage_zone.f90 + ${SRC}/regolith/regolith_shock_damage.f90 + ${SRC}/regolith/regolith_interior.f90 + ${SRC}/porosity/porosity_form_interior.f90 + ${SRC}/realistic/realistic_perlin_noise.f90 + ${SRC}/realistic/realistic_crater_topography.f90 ) SET(DRIVER_src ${SRC}/main/CTEM.f90) # Combine all source files -set(CTEM_src ${SOURCE_FILES}) +set(CTEM_src ${SRC_FILES}) # Turn preprocessor on for all files SET_SOURCE_FILES_PROPERTIES(${CTEM_src} ${DRIVER_src} PROPERTIES Fortran_PREPROCESS ON) -#Set strict vs fast math flags +# Set Build Type variable STRING(TOUPPER "${CMAKE_BUILD_TYPE}" BT) -IF(BT STREQUAL "RELEASE" OR BT STREQUAL "PROFILE") - SET_PROPERTY(SOURCE ${STRICT_MATH_FILES} APPEND_STRING PROPERTY COMPILE_FLAGS "${STRICTMATH_FLAGS}") - SET_PROPERTY(SOURCE ${FAST_MATH_FILES} APPEND_STRING PROPERTY COMPILE_FLAGS "${FASTMATH_FLAGS}") -ENDIF() IF(BT STREQUAL "DEBUG") ADD_DEFINITIONS(-DDEBUG) @@ -53,10 +163,6 @@ ELSEIF(BT STREQUAL "PROFILE") ADD_DEFINITIONS(-DPROFILE) ENDIF() -# Define the executable name -SET(CTEM_DRIVER ctem_driver) -ADD_EXECUTABLE(${CTEM_DRIVER} ${DRIVER_src}) - ##################################################### # Add the needed libraries ##################################################### @@ -66,10 +172,11 @@ IF (NOT BUILD_SHARED_LIBS) SET_PROPERTY(TARGET ${CTEM_LIBRARY} PROPERTY POSITION_INDEPENDENT_CODE) ENDIF () -TARGET_INCLUDE_DIRECTORIES(${CTEM_LIBRARY} PUBLIC ${NETCDF_INCLUDE_DIR}) -TARGET_INCLUDE_DIRECTORIES(${CTEM_DRIVER} PUBLIC ${NETCDF_INCLUDE_DIR}) -TARGET_LINK_LIBRARIES(${CTEM_LIBRARY} PUBLIC ${NETCDF_LIBRARIES}) -TARGET_LINK_LIBRARIES(${CTEM_DRIVER} PUBLIC ${CTEM_LIBRARY} ${NETCDF_LIBRARIES}) + +# Define the executable name +SET(CTEM_DRIVER ctem_exe) +ADD_EXECUTABLE(${CTEM_DRIVER} ${DRIVER_src}) +SET_PROPERTY(TARGET ${CTEM_DRIVER} PROPERTY OUTPUT_NAME ctem) IF(USE_OPENMP OR USE_SIMD) SET_PROPERTY(TARGET ${CTEM_LIBRARY} ${CTEM_DRIVER} APPEND_STRING PROPERTY COMPILE_FLAGS "${OpenMP_Fortran_FLAGS} ") @@ -81,13 +188,6 @@ IF (CMAKE_SYSTEM_NAME STREQUAL "Windows") ENDIF() -IF(USE_COARRAY) - TARGET_COMPILE_DEFINITIONS(${CTEM_LIBRARY} PUBLIC -DCOARRAY) - TARGET_COMPILE_DEFINITIONS(${CTEM_DRIVER} PUBLIC -DCOARRAY) - SET_PROPERTY(TARGET ${CTEM_LIBRARY} ${CTEM_DRIVER} APPEND_STRING PROPERTY COMPILE_FLAGS "${Coarray_Fortran_FLAGS} ") - SET_PROPERTY(TARGET ${CTEM_LIBRARY} ${CTEM_DRIVER} APPEND_STRING PROPERTY LINK_FLAGS "${Coarray_Fortran_FLAGS} ") -ENDIF(USE_COARRAY) - # Check to see if the compiler allows for local-spec in do concurrent statements. Set a preprocessor variable if it does SET(TESTFILE "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}") SET(TESTFILE "${TESTFILE}/CMakeTmp/testFortranDoConcurrentLoc.f90") diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100755 index ede626ba..00000000 --- a/src/Makefile.am +++ /dev/null @@ -1,137 +0,0 @@ -bin_PROGRAMS = CTEM -#ifort optimized flags -SIMDVEC = -simd -xhost -align all -assume contiguous_assumed_shape -vecabi=cmdtarget -fp-model no-except -fma -PAR = -qopenmp -parallel -HEAPARR = -heap-arrays -OPTREPORT = -qopt-report=5 -IPRODUCTION = -g -traceback -no-wrap-margin -assume byterecl -O3 -qopt-prefetch=0 -sox $(PAR) $(SIMDVEC) $(HEAPARR) -IDEBUG = -O0 -g -traceback -debug all -nogen-interfaces -assume byterecl -m64 -heap-arrays -FR -no-pie -no-ftz -fpe-all=0 -mp1 -fp-model strict -fpe0 -align all -pad -ip -prec-div -prec-sqrt -assume protect-parens -CB -no-wrap-margin -init=snan,arrays -#AM_FCFLAGS = $(IDEBUG) -#ifort debug flags - -#gfortran optimized flags -#AM_FCFLAGS = -O3 -fopenmp -ffree-form -g -fbounds-check -fbacktrace -ffree-line-length-512 -#gfortran debug flags -AM_FCFLAGS = -O0 -g -fopenmp -fbounds-check -Wall -Warray-bounds -Warray-temporaries -Wimplicit-interface -ffree-form -fstack-check -fstack-protector-all -ffree-line-length-512 - -CTEM_SOURCES = globals/module_globals.f90\ -util/module_util.f90\ -io/module_io.f90\ -crater/module_crater.f90\ -ejecta/module_ejecta.f90\ -init/module_init.f90\ -seismic/module_seismic.f90\ -regolith/module_regolith.f90\ -porosity/module_porosity.f90\ -realistic/module_realistic.f90\ -util/util_toupper.f90\ -util/util_mrgrnk.f90\ -util/util_add_to_layer.f90\ -util/util_remove_from_layer.f90\ -util/util_sort_layer.f90\ -util/util_periodic.f90\ -util/util_search.f90\ -util/util_rootbracketed.f90\ -util/util_diffusion_solver.f90\ -util/util_area_intersection.f90\ -util/util_poisson.f90\ -util/util_pop.f90\ -util/util_pop_array.f90\ -util/util_push_array.f90\ -util/util_traverse_pop_array.f90\ -util/util_destroy_list.f90\ -util/util_init_array.f90\ -util/util_perlin_noise.f90\ -util/util_random_number_normal.f90\ -util/util_npf_timefunc.f90\ -util/util_tscale.f90\ -util/util_t_from_scale.f90\ -io/io_read_const.f90\ -io/io_get_token.f90\ -io/io_input.f90\ -io/io_read_craterlist.f90\ -io/io_read_prod.f90\ -io/io_read_regotrack.f90\ -io/io_read_vdist.f90\ -io/io_read_surf.f90\ -io/io_ejecta_table.f90\ -io/io_write_dist.f90\ -io/io_write_tally.f90\ -io/io_write_surf.f90\ -io/io_write_const.f90\ -io/io_write_regotrack.f90\ -io/io_crater_profile.f90\ -io/io_updatePbar.f90\ -io/io_resetPbar.f90\ -io/io_splash.f90\ -io/io_write_pindex_map.f90\ -ejecta/ejecta_emplace.f90\ -ejecta/ejecta_ray_pattern.f90\ -ejecta/ejecta_ray_pattern_func.f90\ -ejecta/ejecta_ray_func.f90\ -ejecta/ejecta_blanket.f90\ -ejecta/ejecta_blanket_func.f90\ -ejecta/ejecta_thickness.f90\ -ejecta/ejecta_table_define.f90\ -ejecta/ejecta_interpolate.f90\ -ejecta/ejecta_rootfind.f90\ -ejecta/ejecta_soften.f90\ -ejecta/ejecta_distance_estimate.f90\ -crater/crater_populate.f90\ -crater/crater_scale.f90\ -crater/crater_generate.f90\ -crater/crater_dimensions.f90\ -crater/crater_averages.f90\ -crater/crater_emplace.f90\ -crater/crater_realistic_topography.f90\ -crater/crater_form_interior.f90\ -crater/crater_form_exterior.f90\ -crater/crater_form_exterior_func.f90\ -crater/crater_form_exterior_rootfind.f90\ -crater/crater_record.f90\ -crater/crater_tally_true.f90\ -crater/crater_tally_observed.f90\ -crater/crater_slope_collapse.f90\ -crater/crater_soften.f90\ -crater/crater_subpixel_diffusion.f90\ -crater/crater_make_list.f90\ -crater/crater_degradation_function.f90\ -crater/crater_visibility.f90\ -crater/crater_get_degradation_state.f90\ -crater/crater_profile.f90\ -crater/crater_superdomain.f90\ -init/init_domain.f90\ -init/init_dist.f90\ -init/init_surf.f90\ -init/init_regolith_stack.f90\ -seismic/seismic_shake.f90\ -seismic/seismic_distance.f90\ -seismic/seismic_kdiff_func.f90\ -regolith/regolith_circle_sector_func.f90\ -regolith/regolith_cubic_func.f90\ -regolith/regolith_melt_func.f90\ -regolith/regolith_melt_fraction.f90\ -regolith/regolith_melt_zone.f90\ -regolith/regolith_quadratic_func.f90\ -regolith/regolith_quartic_func.f90\ -regolith/regolith_mix.f90\ -regolith/regolith_depth_model.f90\ -regolith/regolith_streamtube.f90\ -regolith/regolith_streamtube_head.f90\ -regolith/regolith_streamtube_lineseg.f90\ -regolith/regolith_subpixel_streamtube.f90\ -regolith/regolith_transport.f90\ -regolith/regolith_traverse_streamtube.f90\ -regolith/regolith_subcrater_mix.f90\ -regolith/regolith_melt_glass.f90\ -regolith/regolith_superdomain.f90\ -regolith/regolith_melt_zone_superdomain.f90\ -regolith/regolith_streamtube_volume_func.f90\ -regolith/regolith_shock_damage_zone.f90\ -regolith/regolith_shock_damage.f90\ -regolith/regolith_interior.f90\ -porosity/porosity_form_interior.f90\ -realistic/realistic_perlin_noise.f90\ -realistic/realistic_crater_topography.f90\ -main/CTEM.f90 -CLEANFILES = *.mod diff --git a/src/io/io_ejecta_table.f90 b/src/io/io_ejecta_table.f90 index 58dcc374..f5e1287a 100644 --- a/src/io/io_ejecta_table.f90 +++ b/src/io/io_ejecta_table.f90 @@ -37,7 +37,7 @@ subroutine io_ejecta_table(crater,domain,ejb,ejtble,filename) ! Executable code open(LUN, FILE=filename, status='replace') write(LUN,'("# trad = ",ES12.5, " frad = ",ES12.5)') crater%rad,crater%frad - write(LUN,'("# ejrim = " ES12.5, " ejdis = ",ES12.5," imp = ",ES12.5)') crater%ejrim,crater%ejdis,crater%imp + write(LUN,'("# ejrim = ",ES12.5, " ejdis = ",ES12.5," imp = ",ES12.5)') crater%ejrim,crater%ejdis,crater%imp write(LUN,'(A63)') '# "r (m)" "h (m)" "v (m/s)" "ang (deg)" "erad (m)"' do k=1,ejtble write(LUN,'(5(ES13.5E3,1X))') exp(ejb(k)%lrad),exp(ejb(k)%thick),sqrt(ejb(k)%vesq),ejb(k)%angle/DEG2RAD, & diff --git a/src/io/io_read_porotrack.f90 b/src/io/io_read_porotrack.f90 index 357c01e0..cf3f0617 100644 --- a/src/io/io_read_porotrack.f90 +++ b/src/io/io_read_porotrack.f90 @@ -42,7 +42,7 @@ subroutine io_read_porotrack(user,surf) ! Open a file for obtaining the number of stacks that is stored in each linked list ioerr = 0 - recsize = sizeof(itmp) * user%gridsize * user%gridsize + recsize = storage_size(itmp) * user%gridsize * user%gridsize / 8 open(LUP,file=STACKPORFILE,status='old',form='unformatted',recl=recsize,access='direct',iostat=ioerr) if (ioerr/=0) then write(*,*) 'Error! Cannot read file ',trim(adjustl(STACKPORFILE)) diff --git a/src/io/io_read_regotrack.f90 b/src/io/io_read_regotrack.f90 index fc199eaf..f8af61be 100644 --- a/src/io/io_read_regotrack.f90 +++ b/src/io/io_read_regotrack.f90 @@ -51,7 +51,7 @@ subroutine io_read_regotrack(user,surf,domain) ! Open a file for obtaining the number of stacks that is stored in each linked list ioerr = 0 - recsize = sizeof(itmp) * user%gridsize * user%gridsize + recsize = storage_size(itmp) * user%gridsize * user%gridsize / 8 open(LUN,file=STACKNUMFILE,status='old',form='unformatted',recl=recsize,access='direct',iostat=ioerr) if (ioerr/=0) then write(*,*) 'Error! Cannot read file ',trim(adjustl(STACKNUMFILE)) diff --git a/src/io/io_read_surf.f90 b/src/io/io_read_surf.f90 index c063e3a1..4dc65b9b 100644 --- a/src/io/io_read_surf.f90 +++ b/src/io/io_read_surf.f90 @@ -37,10 +37,7 @@ subroutine io_read_surf(user,surf,domain) ! Executable code ! Read in matrix files - recsize = sizeof(dtmp) * user%gridsize * user%gridsize - !write(*,*) 'recsize = ',recsize - !write(*,*) 'alternate = ', sizeof(dtmp) * user%gridsize * user%gridsize - !read(*,*) + recsize = storage_size(dtmp) * user%gridsize * user%gridsize / 8 open(LUN,file=DEMFILE,status='old',form='unformatted',recl=recsize,access='direct',iostat=ioerr) if (ioerr/=0) then write(*,*) 'Error! Cannot read file ',trim(adjustl(DEMFILE)) @@ -78,7 +75,7 @@ subroutine io_read_surf(user,surf,domain) end do close(LUN) - recsize = sizeof(stmp) * user%gridsize * user%gridsize + recsize = storage_size(stmp) * user%gridsize * user%gridsize / 8 open(LUN,file=POSFILE,status='old',form='unformatted',recl=recsize,access='direct',iostat=ioerr) if (ioerr/=0) then write(*,*) 'Error! Cannot read file ',trim(adjustl(POSFILE)) @@ -92,16 +89,5 @@ subroutine io_read_surf(user,surf,domain) if (user%doregotrack) call io_read_regotrack(user,surf,domain) - !if (user%docrustal_thinning) then - ! recsize=sizeof(itmp)*user%gridsize*user%gridsize - ! open(LUN,file=THICKFILE,status='old',form='unformatted',recl=recsize,access='direct',iostat=ioerr) - ! if (ioerr/=0) then - ! write(*,*) 'Error! Cannot read file ',trim(adjustl(THICKFILE)) - ! stop - ! end if - ! read(LUN,rec=1) surf%mantle - ! close(LUN) - !end if - return end subroutine io_read_surf diff --git a/src/io/io_write_age.f90 b/src/io/io_write_age.f90 index 78e1c4b6..77d50271 100644 --- a/src/io/io_write_age.f90 +++ b/src/io/io_write_age.f90 @@ -94,7 +94,7 @@ subroutine io_write_age(user,surf,n_size,icrater,ncrat) deallocate(age_prev,agedepthtot) n_age = max(int(icrater/ncrat), 1) - recsize = sizeof(stmp) * user%gridsize * user%gridsize + recsize = storage_size(stmp) * user%gridsize * user%gridsize / 8 write(fname,'(a,i6.6)') 'agetop', n_age open(LUN,file=fname,status='replace',form='unformatted',recl=recsize,access='direct') write(LUN,rec=1) agetop diff --git a/src/io/io_write_pindex_map.f90 b/src/io/io_write_pindex_map.f90 index 4f35fb55..fe88fa10 100644 --- a/src/io/io_write_pindex_map.f90 +++ b/src/io/io_write_pindex_map.f90 @@ -38,7 +38,7 @@ subroutine io_write_pindex_map(user,pindex,icrater,ncrat) ! Executable code n_age = int(icrater/ncrat) - recsize = sizeof(itmp) * user%gridsize * user%gridsize + recsize = storage_size(itmp) * user%gridsize * user%gridsize / 8 write(fname,'(a,i6.6)') 'pindex', n_age open(LUN,file=fname,status='replace',form='unformatted',recl=recsize,access='direct') write(LUN,rec=1) pindex diff --git a/src/io/io_write_porotrack.f90 b/src/io/io_write_porotrack.f90 index aa273704..99ba63db 100644 --- a/src/io/io_write_porotrack.f90 +++ b/src/io/io_write_porotrack.f90 @@ -63,7 +63,7 @@ subroutine io_write_porotrack(user,surf) close(LUN) close(LUM) - recsize = sizeof(itmp) * user%gridsize * user%gridsize + recsize = storage_size(itmp) * user%gridsize * user%gridsize / 8 open(LUN,file=STACKPORFILE,status='replace',form='unformatted',recl=recsize,access='direct') write(LUN,rec=1) stacks_num close(LUN) diff --git a/src/io/io_write_regotrack.f90 b/src/io/io_write_regotrack.f90 index 4e11d099..6146eb8e 100644 --- a/src/io/io_write_regotrack.f90 +++ b/src/io/io_write_regotrack.f90 @@ -99,7 +99,7 @@ subroutine io_write_regotrack(user,surf,domain) close(FMD) close(FEJM) - recsize = sizeof(itmp) * user%gridsize * user%gridsize + recsize = storage_size(itmp) * user%gridsize * user%gridsize / 8 open(LUN,file=STACKNUMFILE,status='replace',form='unformatted',recl=recsize,access='direct') write(LUN,rec=1) stacks_num close(LUN) diff --git a/src/io/io_write_surf.f90 b/src/io/io_write_surf.f90 index cd11acc2..e89b71db 100644 --- a/src/io/io_write_surf.f90 +++ b/src/io/io_write_surf.f90 @@ -39,7 +39,7 @@ subroutine io_write_surf(user,surf,domain) ! Write matrix files - recsize = sizeof(dtmp) * user%gridsize * user%gridsize + recsize = storage_size(dtmp) * user%gridsize * user%gridsize / 8 open(LUN,file=DEMFILE,status='replace',form='unformatted',recl=recsize,access='direct') write(LUN,rec=1) surf%dem close(LUN) @@ -60,7 +60,7 @@ subroutine io_write_surf(user,surf,domain) end do close(LUN) - recsize = sizeof(stmp) * user%gridsize * user%gridsize + recsize = storage_size(stmp) * user%gridsize * user%gridsize / 8 open(LUN,file=POSFILE,status='replace',form='unformatted',recl=recsize,access='direct') do i=1,user%numlayers write(LUN,rec=2*i-1) surf%xl(i) @@ -70,13 +70,5 @@ subroutine io_write_surf(user,surf,domain) if (user%doregotrack) call io_write_regotrack(user,surf,domain) -! if (user%docrustal_thinning) then -! recsize = sizeof(itmp) * user%gridsize * user%gridsize -! open(LUN,file=THICKFILE,status='replace',form='unformatted',recl=recsize,access='direct') -! write(LUN,rec=1) surf%mantle -! close(LUN) -! end if - - return end subroutine io_write_surf