From 2dcf0ea3b0f732d5f615f770ce3d144d41ddbfbb Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Thu, 13 Oct 2022 10:32:22 -0400 Subject: [PATCH 01/27] updated the .gitignore to stop ignoring cmake files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index fe0a24d5d..e9a3a409d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ # whitelist only the files that ever need to be tracked !*.f90 !*.sh +!CMakeLists.txt +!*.cmake !CHANGELOG !README.md !README.swifter From 841d06b5051b361d61d2aa1a44602f47fc9bb4ff Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Thu, 13 Oct 2022 10:32:58 -0400 Subject: [PATCH 02/27] added the cmake infrastructure --- CMakeLists.txt | 95 ++++++ cmake/Modules/FindOpenMP_Fortran.cmake | 104 ++++++ cmake/Modules/SetCompileFlag.cmake | 112 +++++++ cmake/Modules/SetFortranFlags.cmake | 313 ++++++++++++++++++ cmake/Modules/SetParallelizationLibrary.cmake | 39 +++ cmake/Modules/SetUpLAPACK.cmake | 11 + distclean.cmake | 68 ++++ lib/CMakeLists.txt | 3 + src/CMakeLists.txt | 134 ++++++++ 9 files changed, 879 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 cmake/Modules/FindOpenMP_Fortran.cmake create mode 100644 cmake/Modules/SetCompileFlag.cmake create mode 100644 cmake/Modules/SetFortranFlags.cmake create mode 100644 cmake/Modules/SetParallelizationLibrary.cmake create mode 100644 cmake/Modules/SetUpLAPACK.cmake create mode 100644 distclean.cmake create mode 100644 lib/CMakeLists.txt create mode 100644 src/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..4699a11ba --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,95 @@ +# CMake project file for FOO + +################################################## +# Define the project and the depencies that it has +################################################## + +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5...3.20.1) +PROJECT(Swiftest) + +# Set the Swiftest version +SET(VERSION 1.0.0) + +# Add our local modlues to the module path +SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/") + +# Uncomment if it is required that Fortran 90 is supported +IF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) + MESSAGE(FATAL_ERROR "Fortran compiler does not support F90") +ENDIF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) + +# Set some options the user may choose +# Uncomment the below if you want the user to choose a parallelization library +#OPTION(USE_MPI "Use the MPI library for parallelization" OFF) +#OPTION(USE_OPENMP "Use OpenMP for parallelization" OFF) + +# This INCLUDE statement executes code that sets the compile flags for DEBUG, +# RELEASE, and TESTING. You should review this file and make sure the flags +# are to your liking. +INCLUDE(${CMAKE_MODULE_PATH}/SetFortranFlags.cmake) +# Locate and set parallelization libraries. There are some CMake peculiarities +# taken care of here, such as the fact that the FindOpenMP routine doesn't know +# about Fortran. +INCLUDE(${CMAKE_MODULE_PATH}/SetParallelizationLibrary.cmake) +# Setup the LAPACK libraries. This also takes care of peculiarities, such as +# the fact the searching for MKL requires a C compiler, and that the results +# are not stored in the cache. +INCLUDE(${CMAKE_MODULE_PATH}/SetUpLAPACK.cmake) + +# There is an error in CMAKE with this flag for pgf90. Unset it +GET_FILENAME_COMPONENT(FCNAME ${CMAKE_Fortran_COMPILER} NAME) +IF(FCNAME STREQUAL "pgf90") + UNSET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS) +ENDIF(FCNAME STREQUAL "pgf90") + +############################################################ +# Define the actual files and folders that make up the build +############################################################ + +# Define the executable name +SET(FOOEXE swiftest_driver) + +# Define the library name +SET(BARLIB libswiftest) + +# Define some directories +SET(SRC ${CMAKE_SOURCE_DIR}/src) +SET(LIB ${CMAKE_SOURCE_DIR}/lib) +SET(BIN ${CMAKE_SOURCE_DIR}/bin) +SET(DISCARD ${SRC}/discard) +SET(DRIFT ${SRC}/drift) +SET(ENCOUNTER ${SRC}/encounter) +SET(FRAGGLE ${SRC}/fraggle) +SET(GR ${SRC}/gr) +SET(HELIO ${SRC}/helio) +SET(IO ${SRC}/io) +SET(KICK ${SRC}/kick) +SET(MAIN ${SRC}/main) +SET(MODULES ${SRC}/modules) +SET(NETCDF ${SRC}/netcdf) +SET(OBL ${SRC}/obl) +SET(OPERATORS ${SRC}/operators) +SET(ORBEL ${SRC}/orbel) +SET(PYTHONBINDINGS ${SRC}/python_bindings) +SET(RMVS ${SRC}/rmvs) +SET(SETUP ${SRC}/setup) +SET(SYMBA ${SRC}/SYMBA) +#SET(TIDES ${SRC}/tides) +SET(USER ${SRC}/user) +SET(UTIL ${SRC}/util) +SET(WALLTIME ${SRC}/walltime) +SET(WHM ${SRC}/whm) + +# Have the .mod files placed in the lib folder +SET(CMAKE_Fortran_MODULE_DIRECTORY ${LIB}) + +# The source for the Swiftest library and have it placed in the lib folder +ADD_SUBDIRECTORY(${BARLIB} ${LIB}) + +# The source for the EXE binary and have it placed in the bin folder +ADD_SUBDIRECTORY(${FOOEXE} ${BIN}) + +# Add a distclean target to the Makefile +ADD_CUSTOM_TARGET(distclean + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/distclean.cmake +) diff --git a/cmake/Modules/FindOpenMP_Fortran.cmake b/cmake/Modules/FindOpenMP_Fortran.cmake new file mode 100644 index 000000000..bc440ae10 --- /dev/null +++ b/cmake/Modules/FindOpenMP_Fortran.cmake @@ -0,0 +1,104 @@ +# - Finds OpenMP support +# This module can be used to detect OpenMP support in a compiler. +# If the compiler supports OpenMP, the flags required to compile with +# openmp support are set. +# +# This module was modified from the standard FindOpenMP module to find Fortran +# flags. +# +# The following variables are set: +# OpenMP_Fortran_FLAGS - flags to add to the Fortran compiler for OpenMP +# support. In general, you must use these at both +# compile- and link-time. +# OMP_NUM_PROCS - the max number of processors available to OpenMP + +#============================================================================= +# Copyright 2009 Kitware, Inc. +# Copyright 2008-2009 André Rigland Brodtkorb +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +INCLUDE (${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) + +SET (OpenMP_Fortran_FLAG_CANDIDATES + #Microsoft Visual Studio + "/openmp" + #Intel windows + "/Qopenmp" + #Intel + "-qopenmp" + #Gnu + "-fopenmp" + #Empty, if compiler automatically accepts openmp + " " + #Sun + "-xopenmp" + #HP + "+Oopenmp" + #IBM XL C/c++ + "-qsmp" + #Portland Group + "-mp" +) + +IF (DEFINED OpenMP_Fortran_FLAGS) + SET (OpenMP_Fortran_FLAG_CANDIDATES) +ENDIF (DEFINED OpenMP_Fortran_FLAGS) + +# check fortran compiler. also determine number of processors +FOREACH (FLAG ${OpenMP_Fortran_FLAG_CANDIDATES}) + SET (SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + SET (CMAKE_REQUIRED_FLAGS "${FLAG}") + UNSET (OpenMP_FLAG_DETECTED CACHE) + MESSAGE (STATUS "Try OpenMP Fortran flag = [${FLAG}]") + FILE (WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranOpenMP.f90" +" +program TestOpenMP + use omp_lib + write(*,'(I2)',ADVANCE='NO') omp_get_num_procs() +end program TestOpenMP +") + SET (MACRO_CHECK_FUNCTION_DEFINITIONS + "-DOpenMP_FLAG_DETECTED ${CMAKE_REQUIRED_FLAGS}") + TRY_RUN (OpenMP_RUN_FAILED OpenMP_FLAG_DETECTED ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranOpenMP.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 (OpenMP_FLAG_DETECTED) + FILE (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the Fortran compiler supports OpenMP passed with " + "the following output:\n${OUTPUT}\n\n") + SET (OpenMP_FLAG_DETECTED 1) + IF (OpenMP_RUN_FAILED) + MESSAGE (FATAL_ERROR "OpenMP found, but test code did not run") + ENDIF (OpenMP_RUN_FAILED) + SET (OMP_NUM_PROCS ${OMP_NUM_PROCS_INTERNAL} CACHE + STRING "Number of processors OpenMP may use" FORCE) + SET (OpenMP_Fortran_FLAGS_INTERNAL "${FLAG}") + BREAK () + ELSE () + FILE (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the Fortran compiler supports OpenMP failed with " + "the following output:\n${OUTPUT}\n\n") + SET (OpenMP_FLAG_DETECTED 0) + ENDIF (OpenMP_FLAG_DETECTED) +ENDFOREACH (FLAG ${OpenMP_Fortran_FLAG_CANDIDATES}) + +SET (OpenMP_Fortran_FLAGS "${OpenMP_Fortran_FLAGS_INTERNAL}" + CACHE STRING "Fortran compiler flags for OpenMP parallization") + +# handle the standard arguments for FIND_PACKAGE +FIND_PACKAGE_HANDLE_STANDARD_ARGS (OpenMP_Fortran DEFAULT_MSG + OpenMP_Fortran_FLAGS) + +MARK_AS_ADVANCED(OpenMP_Fortran_FLAGS) diff --git a/cmake/Modules/SetCompileFlag.cmake b/cmake/Modules/SetCompileFlag.cmake new file mode 100644 index 000000000..04ff3ffbd --- /dev/null +++ b/cmake/Modules/SetCompileFlag.cmake @@ -0,0 +1,112 @@ +############################################################################# +# Given a list of flags, this function will try each, one at a time, +# and choose the first flag that works. If no flags work, then nothing +# will be set, unless the REQUIRED key is given, in which case an error +# will be given. +# +# Call is: +# SET_COMPILE_FLAG(FLAGVAR FLAGVAL (Fortran|C|CXX) flag1 flag2...) +# +# For example, if you have the flag CMAKE_C_FLAGS and you want to add +# warnings and want to fail if this is not possible, you might call this +# function in this manner: +# SET_COMPILE_FLAGS(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" C REQUIRED +# "-Wall" # GNU +# "-warn all" # Intel +# ) +# The optin "-Wall" will be checked first, and if it works, will be +# appended to the CMAKE_C_FLAGS variable. If it doesn't work, then +# "-warn all" will be tried. If this doesn't work then checking will +# terminate because REQUIRED was given. +# +# The reasong that the variable must be given twice (first as the name then +# as the value in quotes) is because of the way CMAKE handles the passing +# of variables in functions; it is difficult to extract a variable's +# contents and assign new values to it from within a function. +############################################################################# + +INCLUDE(${CMAKE_ROOT}/Modules/CheckCCompilerFlag.cmake) +INCLUDE(${CMAKE_ROOT}/Modules/CheckCXXCompilerFlag.cmake) + +FUNCTION(SET_COMPILE_FLAG FLAGVAR FLAGVAL LANG) + + # Do some up front setup if Fortran + IF(LANG STREQUAL "Fortran") + # Create a list of error messages from compilers + SET(FAIL_REGEX + "ignoring unknown option" # Intel + "invalid argument" # Intel + "unrecognized .*option" # GNU + "[Uu]nknown switch" # Portland Group + "ignoring unknown option" # MSVC + "warning D9002" # MSVC, any lang + "[Uu]nknown option" # HP + "[Ww]arning: [Oo]ption" # SunPro + "command option .* is not recognized" # XL + ) + ENDIF(LANG STREQUAL "Fortran") + + # Make a variable holding the flags. Filter out REQUIRED if it is there + SET(FLAG_REQUIRED FALSE) + SET(FLAG_FOUND FALSE) + UNSET(FLAGLIST) + FOREACH (var ${ARGN}) + STRING(TOUPPER "${var}" UP) + IF(UP STREQUAL "REQUIRED") + SET(FLAG_REQUIRED TRUE) + ELSE() + SET(FLAGLIST ${FLAGLIST} "${var}") + ENDIF(UP STREQUAL "REQUIRED") + ENDFOREACH (var ${ARGN}) + + # Now, loop over each flag + FOREACH(flag ${FLAGLIST}) + + UNSET(FLAG_WORKS) + # Check the flag for the given language + IF(LANG STREQUAL "C") + CHECK_C_COMPILER_FLAG("${flag}" FLAG_WORKS) + ELSEIF(LANG STREQUAL "CXX") + CHECK_CXX_COMPILER_FLAG("${flag}" FLAG_WORKS) + ELSEIF(LANG STREQUAL "Fortran") + # There is no nice function to do this for FORTRAN, so we must manually + # create a test program and check if it compiles with a given flag. + SET(TESTFILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}") + SET(TESTFILE "${TESTFILE}/CMakeTmp/testFortranFlags.f90") + FILE(WRITE "${TESTFILE}" +" +program dummyprog + i = 5 +end program dummyprog +") + TRY_COMPILE(FLAG_WORKS ${CMAKE_BINARY_DIR} ${TESTFILE} + COMPILE_DEFINITIONS "${flag}" OUTPUT_VARIABLE OUTPUT) + + # Check that the output message doesn't match any errors + FOREACH(rx ${FAIL_REGEX}) + IF("${OUTPUT}" MATCHES "${rx}") + SET(FLAG_WORKS FALSE) + ENDIF("${OUTPUT}" MATCHES "${rx}") + ENDFOREACH(rx ${FAIL_REGEX}) + + ELSE() + MESSAGE(FATAL_ERROR "Unknown language in SET_COMPILE_FLAGS: ${LANG}") + ENDIF(LANG STREQUAL "C") + + # If this worked, use these flags, otherwise use other flags + IF(FLAG_WORKS) + # Append this flag to the end of the list that already exists + SET(${FLAGVAR} "${FLAGVAL} ${flag}" CACHE STRING + "Set the ${FLAGVAR} flags" FORCE) + SET(FLAG_FOUND TRUE) + BREAK() # We found something that works, so exit + ENDIF(FLAG_WORKS) + + ENDFOREACH(flag ${FLAGLIST}) + + # Raise an error if no flag was found + IF(FLAG_REQUIRED AND NOT FLAG_FOUND) + MESSAGE(FATAL_ERROR "No compile flags were found") + ENDIF(FLAG_REQUIRED AND NOT FLAG_FOUND) + +ENDFUNCTION() diff --git a/cmake/Modules/SetFortranFlags.cmake b/cmake/Modules/SetFortranFlags.cmake new file mode 100644 index 000000000..a8c1121e7 --- /dev/null +++ b/cmake/Modules/SetFortranFlags.cmake @@ -0,0 +1,313 @@ +###################################################### +# Determine and set the Fortran compiler flags we want +###################################################### + +#################################################################### +# Make sure that the default build type is RELEASE if not specified. +#################################################################### +INCLUDE(${CMAKE_MODULE_PATH}/SetCompileFlag.cmake) + +# Make sure the build type is uppercase +STRING(TOUPPER "${CMAKE_BUILD_TYPE}" BT) + +IF(BT STREQUAL "RELEASE") + SET(CMAKE_BUILD_TYPE RELEASE CACHE STRING + "Choose the type of build, options are DEBUG, RELEASE, or TESTING." + FORCE) +ELSEIF(BT STREQUAL "DEBUG") + SET (CMAKE_BUILD_TYPE DEBUG CACHE STRING + "Choose the type of build, options are DEBUG, RELEASE, or TESTING." + FORCE) +ELSEIF(BT STREQUAL "TESTING") + SET (CMAKE_BUILD_TYPE TESTING CACHE STRING + "Choose the type of build, options are DEBUG, RELEASE, or TESTING." + FORCE) +ELSEIF(NOT BT) + SET(CMAKE_BUILD_TYPE RELEASE CACHE STRING + "Choose the type of build, options are DEBUG, RELEASE, or TESTING." + FORCE) + MESSAGE(STATUS "CMAKE_BUILD_TYPE not given, defaulting to RELEASE") +ELSE() + MESSAGE(FATAL_ERROR "CMAKE_BUILD_TYPE not valid, choices are DEBUG, RELEASE, or TESTING") +ENDIF(BT STREQUAL "RELEASE") + +######################################################### +# If the compiler flags have already been set, return now +######################################################### + +IF(CMAKE_Fortran_FLAGS_RELEASE AND CMAKE_Fortran_FLAGS_TESTING AND CMAKE_Fortran_FLAGS_DEBUG) + RETURN () +ENDIF(CMAKE_Fortran_FLAGS_RELEASE AND CMAKE_Fortran_FLAGS_TESTING AND CMAKE_Fortran_FLAGS_DEBUG) + +######################################################################## +# Determine the appropriate flags for this compiler for each build type. +# For each option type, a list of possible flags is given that work +# for various compilers. The first flag that works is chosen. +# If none of the flags work, nothing is added (unless the REQUIRED +# flag is given in the call). This way unknown compiles are supported. +####################################################################### + +##################### +### GENERAL FLAGS ### +##################### + +# Don't add underscores in symbols for C-compatability +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}" + Fortran "-fno-underscoring") + +# There is some bug where -march=native doesn't work on Mac +IF(APPLE) + SET(GNUNATIVE "-mtune=native") +ELSE() + SET(GNUNATIVE "-march=native") +ENDIF() +# Optimize for the host's architecture +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}" + Fortran "-xHost" # Intel + "/QxHost" # Intel Windows + ${GNUNATIVE} # GNU + "-ta=host" # Portland Group + ) + +################### +### DEBUG FLAGS ### +################### + +# NOTE: debugging symbols (-g or /debug:full) are already on by default + +# Disable optimizations +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran REQUIRED "-O0" # All compilers not on Windows + "/Od" # Intel Windows + "-Og" # GNU (gfortran) + ) + +# Turn on all warnings +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-warn all" # Intel + "/warn:all" # Intel Windows + "-Wall" # GNU + # Portland Group (on by default) + ) + +# Traceback +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-traceback" # Intel/Portland Group + "/traceback" # Intel Windows + "-fbacktrace" # GNU (gfortran) + "-ftrace=full" # GNU (g95) + ) + +# Check array bounds +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-check bounds" # Intel + "/check:bounds" # Intel Windows + "-fcheck=bounds" # GNU (New style) + "-fbounds-check" # GNU (Old style) + "-Mbounds" # Portland Group + ) + +# Initializes matrices/arrays with NaN values +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-init=snan,arrays" # Intel + ) + +# Does not generate an interface block for each routine in a source file +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-nogen-interfaces" # Intel + ) + +# Does not generate aposition independent executable +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-no-pie" # Intel + ) + +# Does not set denormal results from floating-point calculations to zero +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-no-ftz" # Intel + ) + +# Enables floating-point invalid, divide-by-zero, and overflow exceptions +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-fpe-all=0" # Intel + ) + +# Improves floating-point precision and consistency +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-mp1" # Intel + ) + +# Calls the Matrix Multiply library +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-qopt-matmul" # Intel + ) + +# Strict model for floating-point calculations (precise and except) +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-fp-model strict" # Intel + ) + +# Enables floating-point invalid, divide-by-zero, and overflow exceptions +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-fpe0" # Intel + ) + +# Enables debug info +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-debug all" # Intel + ) + +# Aligns a variable to a specified boundary and offset +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-align all" # Intel + ) + +# Enables changing the variable and array memory layout +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-pad" # Intel + ) + +# Enables additional interprocedural optimizations for a single file cimpilation +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-ip" # Intel + ) + +# Improves precision when dividing floating-points +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-prec-div" # Intel + ) + +# Improves precision when taking the square root of floating-points +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-prec-sqrt" # Intel + ) + +# Treat parentheses in accordance with the Fortran standard (ifort 10 only) +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-assume protect-parens" # Intel + ) + +# Checks the bounds of arrays at run-time +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-CB" # Intel + ) + +# Allows for lines longer than 80 characters without truncation +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" + Fortran "-no-wrap-margin" # Intel + "-ffree-line-length-none" # GNU (gfortran) + ) + +##################### +### TESTING FLAGS ### +##################### + +# Optimizations +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_TESTING "${CMAKE_Fortran_FLAGS_TESTING}" + Fortran REQUIRED "-O2" # All compilers not on Windows + "/O2" # Intel Windows + ) + +##################### +### RELEASE FLAGS ### +##################### + +# NOTE: agressive optimizations (-O3) are already turned on by default + +# Unroll loops +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-funroll-loops" # GNU + "-unroll" # Intel + "/unroll" # Intel Windows + "-Munroll" # Portland Group + ) + +# Inline functions +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-inline" # Intel + "/Qinline" # Intel Windows + "-finline-functions" # GNU + "-Minline" # Portland Group + ) + +# Interprocedural (link-time) optimizations +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-ipo" # Intel + "/Qipo" # Intel Windows + "-flto" # GNU + "-Mipa" # Portland Group + ) + +# Single-file optimizations +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-ip" # Intel + "/Qip" # Intel Windows + ) + +# Vectorize code +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-vec-report0" # Intel + "/Qvec-report0" # Intel Windows + "-Mvect" # Portland Group + ) + +# Allows for lines longer than 80 characters without truncation +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-no-wrap-margin" # Intel + "-ffree-line-length-none" # GNU (gfortran) + ) + +# Disables prefetch insertion optimization +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-qopt-prefetch=0" # Intel + ) + +# Calls the Matrix Multiply library +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-qopt-matmul" # Intel + ) + +# Saves the compiler options and version number to the executable +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-sox" # Intel + ) + +# Enforces vectorization of loops +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-simd" # Intel + ) + +# Generate instructions for the highest instruction set available +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-xhost" # Intel + ) + +# Aligns a variable to a specified boundary and offset +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-align all" # Intel + ) + +# Assume all objects are contiguous in memory +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-assume contiguous_assumed_shape" # Intel + ) + +# Generate an extended set of vector functions +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-vecabi=cmdtarget" # Intel + ) + +# No floating-point exceptions +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-fp-model no-except" # Intel + ) + +# Generate fused multiply-add instructions +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-fma" # Intel + ) + +# Enables agressive optimixation on floating-points +SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-fp-model=fast" # Intel + ) diff --git a/cmake/Modules/SetParallelizationLibrary.cmake b/cmake/Modules/SetParallelizationLibrary.cmake new file mode 100644 index 000000000..603d4299c --- /dev/null +++ b/cmake/Modules/SetParallelizationLibrary.cmake @@ -0,0 +1,39 @@ +# Turns on either OpenMP or MPI +# If both are requested, the other is disabled +# When one is turned on, the other is turned off +# If both are off, we explicitly disable them just in case + +IF (USE_OPENMP AND USE_MPI) + MESSAGE (FATAL_ERROR "Cannot use both OpenMP and MPI") +ELSEIF (USE_OPENMP) + # Find OpenMP + IF (NOT OpenMP_Fortran_FLAGS) + FIND_PACKAGE (OpenMP_Fortran) + IF (NOT OpenMP_Fortran_FLAGS) + MESSAGE (FATAL_ERROR "Fortran compiler does not support OpenMP") + ENDIF (NOT OpenMP_Fortran_FLAGS) + ENDIF (NOT OpenMP_Fortran_FLAGS) + # Turn of MPI + UNSET (MPI_FOUND CACHE) + UNSET (MPI_COMPILER CACHE) + UNSET (MPI_LIBRARY CACHE) +ELSEIF (USE_MPI) + # Find MPI + IF (NOT MPI_Fortran_FOUND) + FIND_PACKAGE (MPI REQUIRED) + ENDIF (NOT MPI_Fortran_FOUND) + # Turn off OpenMP + SET (OMP_NUM_PROCS 0 CACHE + STRING "Number of processors OpenMP may use" FORCE) + UNSET (OpenMP_C_FLAGS CACHE) + UNSET (GOMP_Fortran_LINK_FLAGS CACHE) +ELSE () + # Turn off both OpenMP and MPI + SET (OMP_NUM_PROCS 0 CACHE + STRING "Number of processors OpenMP may use" FORCE) + UNSET (OpenMP_Fortran_FLAGS CACHE) + UNSET (GOMP_Fortran_LINK_FLAGS CACHE) + UNSET (MPI_FOUND CACHE) + UNSET (MPI_COMPILER CACHE) + UNSET (MPI_LIBRARY CACHE) +ENDIF (USE_OPENMP AND USE_MPI) diff --git a/cmake/Modules/SetUpLAPACK.cmake b/cmake/Modules/SetUpLAPACK.cmake new file mode 100644 index 000000000..ae5bdea52 --- /dev/null +++ b/cmake/Modules/SetUpLAPACK.cmake @@ -0,0 +1,11 @@ +# Find LAPACK (finds BLAS also) if not already found +IF(NOT LAPACK_FOUND) + ENABLE_LANGUAGE(C) # Some libraries need a C compiler to find + FIND_PACKAGE(LAPACK REQUIRED) + # Remember that LAPACK (and BLAS) was found. For some reason the + # FindLAPACK routine doesn't place these into the CACHE. + SET(BLAS_FOUND TRUE CACHE INTERNAL "BLAS was found" FORCE) + SET(LAPACK_FOUND TRUE CACHE INTERNAL "LAPACK was found" FORCE) + SET(BLAS_LIBRARIES ${BLAS_LIBRARIES} CACHE INTERNAL "BLAS LIBS" FORCE) + SET(LAPACK_LIBRARIES ${LAPACK_LIBRARIES} CACHE INTERNAL "LAPACK LIBS" FORCE) +ENDIF(NOT LAPACK_FOUND) diff --git a/distclean.cmake b/distclean.cmake new file mode 100644 index 000000000..8e24f9e49 --- /dev/null +++ b/distclean.cmake @@ -0,0 +1,68 @@ +# This CMake script will delete build directories and files to bring the +# package back to it's distribution state + +# We want to start from the top of the source dir, so if we are in build +# we want to start one directory up +GET_FILENAME_COMPONENT(BASEDIR ${CMAKE_SOURCE_DIR} NAME) +IF(${BASEDIR} STREQUAL "build") + SET(TOPDIR "${CMAKE_SOURCE_DIR}/..") +ELSE() + SET(TOPDIR "${CMAKE_SOURCE_DIR}") +ENDIF() + +MACRO(GET_PARENT_DIRECTORIES search_string return_list grandparents) + FILE(GLOB_RECURSE new_list ${search_string}) + SET(dir_list "") + FOREACH(file_path ${new_list}) + GET_FILENAME_COMPONENT(dir_path ${file_path} PATH) + # Remove an extra directory component to return grandparent + IF(${grandparents}) + # Tack on a fake extension to trick CMake into removing a second + # path component + SET(dir_path "${dir_path}.tmp") + GET_FILENAME_COMPONENT(dir_path ${dir_path} PATH) + ENDIF(${grandparents}) + SET(dir_list ${dir_list} ${dir_path}) + ENDFOREACH() + LIST(REMOVE_DUPLICATES dir_list) + SET(${return_list} ${dir_list}) +ENDMACRO() + +# Find directories and files that we will want to remove +FILE(GLOB_RECURSE CMAKECACHE "${TOPDIR}/*CMakeCache.txt") +FILE(GLOB_RECURSE CMAKEINSTALL "${TOPDIR}/*cmake_install.cmake" + "${TOPDIR}/*install_manifest.txt") +FILE(GLOB_RECURSE MAKEFILE "${TOPDIR}/*Makefile") +FILE(GLOB_RECURSE CMAKETESTFILES "${TOPDIR}/*CTestTestfile.cmake") +SET(TOPDIRECTORIES "${TOPDIR}/lib" + "${TOPDIR}/test" + "${TOPDIR}/bin" +) + +# CMake has trouble finding directories recursively, so locate these +# files and then save the parent directory of the files +GET_PARENT_DIRECTORIES(Makefile.cmake CMAKEFILES 0) +GET_PARENT_DIRECTORIES(LastTest.log CMAKETESTING 1) + +# Place these files and directories into a list +SET(DEL ${TOPDIRECTORIES} + ${CMAKECACHE} + ${CMAKEINSTALL} + ${MAKEFILE} + ${CMAKEFILES} + ${CMAKETESTING} + ${CMAKETESTFILES} +) + +# If we are not in the build dir, delete that as well +IF(NOT (${BASEDIR} STREQUAL "build")) + FILE(GLOB BUILD "${TOPDIR}/build") + SET(DEL ${DEL} ${BUILD}) +ENDIF() + +# Loop over the directories and delete each one +FOREACH(D ${DEL}) + IF(EXISTS ${D}) + FILE(REMOVE_RECURSE ${D}) + ENDIF() +ENDFOREACH() diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt new file mode 100644 index 000000000..b621d3204 --- /dev/null +++ b/lib/CMakeLists.txt @@ -0,0 +1,3 @@ +# bar library +SET(BAR_src ${SRCBAR}/libswiftest.a) +ADD_LIBRARY(${BARLIB} STATIC ${BAR_src}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 000000000..021eb0e89 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,134 @@ +######################################## +# Set up how to compile the source files +######################################## + +# Add the source files +SET(FOO_src ${DISCARD}/discard.f90 + ${DRIFT}/drift.f90 + ${ENCOUNTER}/encounter_check.f90 + ${ENCOUNTER}/encounter_io.f90 + ${ENCOUNTER}/encounter_setup.f90 + ${ENCOUNTER}/encounter_util.f90 + ${FRAGGLE}/fraggle_generate.f90 + ${FRAGGLE}/fraggle_io.f90 + ${FRAGGLE}/fraggle_placeholder.f90 + ${FRAGGLE}/fraggle_regime.f90 + ${FRAGGLE}/fraggle_set.f90 + ${FRAGGLE}/fraggle_setup.f90 + ${FRAGGLE}/fraggle_util.f90 + ${GR}/gr.f90 + ${HELIO}/helio_drift.f90 + ${HELIO}/helio_gr.f90 + ${HELIO}/helio_kick.f90 + ${HELIO}/helio_setup.f90 + ${HELIO}/helio_step.f90 + ${HELIO}/helio_util.f90 + ${IO}/io.f90 + ${KICK}/kick.f90 + ${MAIN}/swiftest_driver.f90 + ${MODULES}/encounter_classes.f90 + ${MODULES}/fraggle_classes.f90 + ${MODULES}/helio_classes.f90 + ${MODULES}/lambda_function.f90 + ${MODULES}/rmvs_classes.f90 + ${MODULES}/swiftest_classes.f90 + ${MODULES}/swiftest_globals.f90 + ${MODULES}/swiftest_operators.f90 + ${MODULES}/swiftest.f90 + ${MODULES}/symba_classes.f90 + ${MODULES}/walltime_classes.f90 + ${MODULES}/whm_classes.f90 + ${NETCDF}/netcdf.f90 + ${OBL}/obl.f90 + ${OPERATORS}/operator_cross.f90 + ${OPERATORS}/operator_mag.f90 + ${ORBEL}/orbel.f90 + ${PYTHONBINDINGS}/orbel.f90 + ${RMVS}/rmvs_discard.f90 + ${RMVS}/rmvs_encounter_check.f90 + ${RMVS}/rmvs_io.f90 + ${RMVS}/rmvs_kick.f90 + ${RMVS}/rmvs_setup.f90 + ${RMVS}/rmvs_step.f90 + ${RMVS}/rmvs_util.f90 + ${SETUP}/setup.f90 + ${SYMBA}/symba_collision.f90 + ${SYMBA}/symba_discard.f90 + ${SYMBA}/symba_drift.f90 + ${SYMBA}/symba_encounter_check.f90 + ${SYMBA}/symba_gr.f90 + ${SYMBA}/symba_io.f90 + ${SYMBA}/symba_kick.f90 + ${SYMBA}/symba_setup.f90 + ${SYMBA}/symba_step.f90 + ${SYMBA}/symba_util.f90 +# ${TIDES}/tides_getacch_pl.f90 +# ${TIDES}/tides_spin_step.f90 + ${USER}/user_getacch.f90 + ${UTIL}/util_append.f90 + ${UTIL}/util_coord.f90 + ${UTIL}/util_copy.f90 + ${UTIL}/util_dealloc.f90 + ${UTIL}/util_exit.f90 + ${UTIL}/util_fill.f90 + ${UTIL}/util_flatten.f90 + ${UTIL}/util_get_energy_momentum.f90 + ${UTIL}/util_index_array.f90 + ${UTIL}/util_minimize_bfgs.f90 + ${UTIL}/util_peri.f90 + ${UTIL}/util_rescale.f90 + ${UTIL}/util_resize.f90 + ${UTIL}/util_set.f90 + ${UTIL}/util_solve.f90 + ${UTIL}/util_sort.f90 + ${UTIL}/util_spill.f90 + ${UTIL}/util_valid.f90 + ${UTIL}/util_version.f90 + ${WALLTIME}/walltime.f90 + ${WHM}/whm_coord.f90 + ${WHM}/whm_drift.f90 + ${WHM}/whm_gr.f90 + ${WHM}/whm_kick.f90 + ${WHM}/whm_setup.f90 + ${WHM}/whm_step.f90 + ${WHM}/whm_util.f90 +) + +# Define the executable in terms of the source files +ADD_EXECUTABLE(${FOOEXE} ${FOO_src}) + +##################################################### +# Add the needed libraries and special compiler flags +##################################################### + +# This links foo to the bar library +TARGET_LINK_LIBRARIES(${FOOEXE} ${BARLIB}) + +# Uncomment if you need to link to BLAS and LAPACK +#TARGET_LINK_LIBRARIES(${FOOEXE} ${BLAS_LIBRARIES} +# ${LAPACK_LIBRARIES} +# ${CMAKE_THREAD_LIBS_INIT}) + +# Uncomment if you have parallization +IF(USE_OPENMP) + SET_TARGET_PROPERTIES(${FOOEXE} PROPERTIES + COMPILE_FLAGS "${OpenMP_Fortran_FLAGS}" + LINK_FLAGS "${OpenMP_Fortran_FLAGS}") +ELSEIF(USE_MPI) + SET_TARGET_PROPERTIES(${FOOEXE} PROPERTIES + COMPILE_FLAGS "${MPI_Fortran_COMPILE_FLAGS}" + LINK_FLAGS "${MPI_Fortran_LINK_FLAGS}") + INCLUDE_DIRECTORIES(${MPI_Fortran_INCLUDE_PATH}) + TARGET_LINK_LIBRARIES(${FOOEXE} ${MPI_Fortran_LIBRARIES}) +ENDIF(USE_OPENMP) + +##################################### +# Tell how to install this executable +##################################### + +IF(WIN32) + SET(CMAKE_INSTALL_PREFIX "C:\\Program Files") +ELSE() + SET(CMAKE_INSTALL_PREFIX /usr/local) +ENDIF(WIN32) +INSTALL(TARGETS ${FOOEXE} RUNTIME DESTINATION bin) From 8b27a058dae588186a3ecddb9f3bf699c5ea2c81 Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Thu, 13 Oct 2022 12:49:21 -0400 Subject: [PATCH 03/27] deleted stuff dealing with LAPACK --- CMakeLists.txt | 4 ---- cmake/Modules/SetUpLAPACK.cmake | 11 ----------- 2 files changed, 15 deletions(-) delete mode 100644 cmake/Modules/SetUpLAPACK.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 4699a11ba..f5f1d4690 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,10 +31,6 @@ INCLUDE(${CMAKE_MODULE_PATH}/SetFortranFlags.cmake) # taken care of here, such as the fact that the FindOpenMP routine doesn't know # about Fortran. INCLUDE(${CMAKE_MODULE_PATH}/SetParallelizationLibrary.cmake) -# Setup the LAPACK libraries. This also takes care of peculiarities, such as -# the fact the searching for MKL requires a C compiler, and that the results -# are not stored in the cache. -INCLUDE(${CMAKE_MODULE_PATH}/SetUpLAPACK.cmake) # There is an error in CMAKE with this flag for pgf90. Unset it GET_FILENAME_COMPONENT(FCNAME ${CMAKE_Fortran_COMPILER} NAME) diff --git a/cmake/Modules/SetUpLAPACK.cmake b/cmake/Modules/SetUpLAPACK.cmake deleted file mode 100644 index ae5bdea52..000000000 --- a/cmake/Modules/SetUpLAPACK.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# Find LAPACK (finds BLAS also) if not already found -IF(NOT LAPACK_FOUND) - ENABLE_LANGUAGE(C) # Some libraries need a C compiler to find - FIND_PACKAGE(LAPACK REQUIRED) - # Remember that LAPACK (and BLAS) was found. For some reason the - # FindLAPACK routine doesn't place these into the CACHE. - SET(BLAS_FOUND TRUE CACHE INTERNAL "BLAS was found" FORCE) - SET(LAPACK_FOUND TRUE CACHE INTERNAL "LAPACK was found" FORCE) - SET(BLAS_LIBRARIES ${BLAS_LIBRARIES} CACHE INTERNAL "BLAS LIBS" FORCE) - SET(LAPACK_LIBRARIES ${LAPACK_LIBRARIES} CACHE INTERNAL "LAPACK LIBS" FORCE) -ENDIF(NOT LAPACK_FOUND) From 65f8a65b606c3a202e62e8c19f8e32b23768756b Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Thu, 13 Oct 2022 12:50:05 -0400 Subject: [PATCH 04/27] deleted libraries --- CMakeLists.txt | 7 ++----- lib/CMakeLists.txt | 3 --- src/CMakeLists.txt | 25 ------------------------- 3 files changed, 2 insertions(+), 33 deletions(-) delete mode 100644 lib/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index f5f1d4690..4b9d14944 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,9 +45,6 @@ ENDIF(FCNAME STREQUAL "pgf90") # Define the executable name SET(FOOEXE swiftest_driver) -# Define the library name -SET(BARLIB libswiftest) - # Define some directories SET(SRC ${CMAKE_SOURCE_DIR}/src) SET(LIB ${CMAKE_SOURCE_DIR}/lib) @@ -79,8 +76,8 @@ SET(WHM ${SRC}/whm) # Have the .mod files placed in the lib folder SET(CMAKE_Fortran_MODULE_DIRECTORY ${LIB}) -# The source for the Swiftest library and have it placed in the lib folder -ADD_SUBDIRECTORY(${BARLIB} ${LIB}) +# The source for the FOO binary and have it placed in the bin folder +ADD_SUBDIRECTORY(${EXE} ${BIN}) # The source for the EXE binary and have it placed in the bin folder ADD_SUBDIRECTORY(${FOOEXE} ${BIN}) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt deleted file mode 100644 index b621d3204..000000000 --- a/lib/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -# bar library -SET(BAR_src ${SRCBAR}/libswiftest.a) -ADD_LIBRARY(${BARLIB} STATIC ${BAR_src}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 021eb0e89..494571aac 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -97,31 +97,6 @@ SET(FOO_src ${DISCARD}/discard.f90 # Define the executable in terms of the source files ADD_EXECUTABLE(${FOOEXE} ${FOO_src}) -##################################################### -# Add the needed libraries and special compiler flags -##################################################### - -# This links foo to the bar library -TARGET_LINK_LIBRARIES(${FOOEXE} ${BARLIB}) - -# Uncomment if you need to link to BLAS and LAPACK -#TARGET_LINK_LIBRARIES(${FOOEXE} ${BLAS_LIBRARIES} -# ${LAPACK_LIBRARIES} -# ${CMAKE_THREAD_LIBS_INIT}) - -# Uncomment if you have parallization -IF(USE_OPENMP) - SET_TARGET_PROPERTIES(${FOOEXE} PROPERTIES - COMPILE_FLAGS "${OpenMP_Fortran_FLAGS}" - LINK_FLAGS "${OpenMP_Fortran_FLAGS}") -ELSEIF(USE_MPI) - SET_TARGET_PROPERTIES(${FOOEXE} PROPERTIES - COMPILE_FLAGS "${MPI_Fortran_COMPILE_FLAGS}" - LINK_FLAGS "${MPI_Fortran_LINK_FLAGS}") - INCLUDE_DIRECTORIES(${MPI_Fortran_INCLUDE_PATH}) - TARGET_LINK_LIBRARIES(${FOOEXE} ${MPI_Fortran_LIBRARIES}) -ENDIF(USE_OPENMP) - ##################################### # Tell how to install this executable ##################################### From 1ddc637af6487a7c1afe25a36ada04c50201b62d Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Thu, 13 Oct 2022 12:50:57 -0400 Subject: [PATCH 05/27] Changed project so the compiler will recognize .f90 files --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b9d14944..c28691f0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ ################################################## CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5...3.20.1) -PROJECT(Swiftest) +PROJECT(Swiftest Fortran) # Set the Swiftest version SET(VERSION 1.0.0) @@ -14,9 +14,9 @@ SET(VERSION 1.0.0) SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/") # Uncomment if it is required that Fortran 90 is supported -IF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) - MESSAGE(FATAL_ERROR "Fortran compiler does not support F90") -ENDIF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) +#IF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) +# MESSAGE(FATAL_ERROR "Fortran compiler does not support F90") +#ENDIF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) # Set some options the user may choose # Uncomment the below if you want the user to choose a parallelization library From f2c7c11c33fec6d7aadfaf7c53ca6281971055d7 Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Thu, 13 Oct 2022 12:51:34 -0400 Subject: [PATCH 06/27] updated the path to the executable may have done this wrong bc I can't find the executable after compiling --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c28691f0e..dd6f5b08d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,7 @@ SET(USER ${SRC}/user) SET(UTIL ${SRC}/util) SET(WALLTIME ${SRC}/walltime) SET(WHM ${SRC}/whm) +SET(EXE ${SRC}) # Have the .mod files placed in the lib folder SET(CMAKE_Fortran_MODULE_DIRECTORY ${LIB}) @@ -79,9 +80,6 @@ SET(CMAKE_Fortran_MODULE_DIRECTORY ${LIB}) # The source for the FOO binary and have it placed in the bin folder ADD_SUBDIRECTORY(${EXE} ${BIN}) -# The source for the EXE binary and have it placed in the bin folder -ADD_SUBDIRECTORY(${FOOEXE} ${BIN}) - # Add a distclean target to the Makefile ADD_CUSTOM_TARGET(distclean COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/distclean.cmake From 5adbbb3e256bcad195906cc03b71fcb7a8ffc1a5 Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Thu, 13 Oct 2022 12:52:51 -0400 Subject: [PATCH 07/27] deleted the lib directory --- lib/.gitignore | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 lib/.gitignore diff --git a/lib/.gitignore b/lib/.gitignore deleted file mode 100644 index e69de29bb..000000000 From 07a1a2f7dbc840ca3dcbcc1239d7c1ad459ba572 Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Thu, 13 Oct 2022 12:53:07 -0400 Subject: [PATCH 08/27] deleted the bin directory --- bin/.gitignore | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 bin/.gitignore diff --git a/bin/.gitignore b/bin/.gitignore deleted file mode 100644 index e69de29bb..000000000 From 6042cec0d37bac8c7ad845d40c2fd8db7dabb34c Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Thu, 13 Oct 2022 12:53:23 -0400 Subject: [PATCH 09/27] deleted the makefile --- Makefile | 262 ------------------------------------------------------- 1 file changed, 262 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index 1f5a9828b..000000000 --- a/Makefile +++ /dev/null @@ -1,262 +0,0 @@ -#****************************************************************************** -# -# Unit Name : Makefile -# Unit Type : makefile -# Project : SWIFTEST -# Package : N/A -# Language : GNU makefile syntax -# -# Description : Controls, via the make program, the building of the Swifter -# modules, library, drivers, and tools, as well as initiating -# the build of the FXDR library by means of its own makefile -# -# Input -# Arguments : Zero or more of the following targets: -# (1) all : builds modules, entire Swifter library, FXDR -# library, Swifter drivers and tools -# (2) mod : builds modules -# (3) lib : builds entire Swifter library -# (4) fastdir : compiles local directory source and adds the -# resulting objects to the Swifter library -# (5) drivers : builds Swifter drivers -# (6) tools : builds Swifter tools -# (7) bin : compiles local directory source and installs -# resulting executables to $(SWIFTEST_HOME)/bin -# (8) clean : removes all soft links to Makefile and -# Makefile.Defines from subdirectories of -# $(SWIFTEST_HOME), removes the entire contents -# of $(SWIFTEST_HOME)/lib and $(SWIFTEST_HOME)/bin, -# and removes the include file installed by the -# FXDR makefile -# Terminal : none -# File : Makefile.Defines -# -# Output -# Arguments : none -# Terminal : status messages -# File : none -# -# Invocation : make [all|mod|lib|fastdir|drivers|tools|bin|clean] -# -# Notes : The use of the above arguments as phony targets inside the -# makefile precludes their use as base names of Swifter drivers -# or tools -# -#****************************************************************************** - -SWIFTEST_MODULES = swiftest_globals.f90 \ - swiftest_operators.f90 \ - lambda_function.f90\ - swiftest_classes.f90 \ - encounter_classes.f90 \ - fraggle_classes.f90 \ - whm_classes.f90 \ - rmvs_classes.f90 \ - helio_classes.f90 \ - symba_classes.f90 \ - walltime_classes.f90 \ - swiftest.f90 - - -include Makefile.Defines - -MODULES = $(SWIFTEST_MODULES) $(USER_MODULES) - -.PHONY : all mod fast strict drivers bin clean force - -% : %.f90 force - $(FORTRAN) $(FFLAGS) $(INCLUDES) $< -o $@ \ - -L$(SWIFTEST_HOME)/lib $(LINKS) - $(INSTALL_PROGRAM) $@ $(SWIFTEST_HOME)/bin - rm -f $@ - -all: - cd $(SWIFTEST_HOME); \ - make mod; \ - make fast; \ - make strict; \ - make drivers; \ - -mod: - cd $(SWIFTEST_HOME)/src/modules/; \ - $(FORTRAN) $(FFLAGS) $(INCLUDES) -c $(MODULES); \ - $(AR) rv $(SWIFTEST_HOME)/lib/libswiftest.a *.o; \ - $(INSTALL_DATA) *.mod *.smod $(SWIFTEST_HOME)/include; \ - rm -f *.o *.mod *.smod - -fast: - cd $(SWIFTEST_HOME)/src/discard; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/drift; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/encounter; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/fraggle; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/gr; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/helio; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/io; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/netcdf; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/obl; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/operators; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/orbel; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/rmvs; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/setup; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/symba; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/tides; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/user; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/util; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/walltime; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - cd $(SWIFTEST_HOME)/src/whm; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make fastdir - -strict: - cd $(SWIFTEST_HOME)/src/kick; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make strictdir - cd $(SWIFTEST_HOME)/src/helio; \ - $(FORTRAN) $(FSTRICTFLAGS) $(INCLUDES) -c helio_kick.f90; \ - $(AR) rv $(SWIFTEST_HOME)/lib/libswiftest.a *.o *.smod; \ - $(INSTALL_DATA) *.smod $(SWIFTEST_HOME)/include; \ - rm -f *.o *.smod - cd $(SWIFTEST_HOME)/src/symba; \ - $(FORTRAN) $(FSTRICTFLAGS) $(INCLUDES) -c symba_kick.f90; \ - $(AR) rv $(SWIFTEST_HOME)/lib/libswiftest.a *.o *.smod; \ - $(INSTALL_DATA) *.smod $(SWIFTEST_HOME)/include; \ - rm -f *.o *.smod - cd $(SWIFTEST_HOME)/src/rmvs; \ - $(FORTRAN) $(FSTRICTFLAGS) $(INCLUDES) -c rmvs_kick.f90; \ - $(AR) rv $(SWIFTEST_HOME)/lib/libswiftest.a *.o *.smod; \ - $(INSTALL_DATA) *.smod $(SWIFTEST_HOME)/include; \ - rm -f *.o *.smod - cd $(SWIFTEST_HOME)/src/whm; \ - $(FORTRAN) $(FSTRICTFLAGS) $(INCLUDES) -c whm_kick.f90; \ - $(AR) rv $(SWIFTEST_HOME)/lib/libswiftest.a *.o *.smod; \ - $(INSTALL_DATA) *.smod $(SWIFTEST_HOME)/include; \ - rm -f *.o *.smod - -fastdir: - $(FORTRAN) $(FFLAGS) $(INCLUDES) -c *.f90; \ - $(AR) rv $(SWIFTEST_HOME)/lib/libswiftest.a *.o *.smod; \ - $(INSTALL_DATA) *.smod $(SWIFTEST_HOME)/include; \ - rm -f *.o *.smod - -strictdir: - $(FORTRAN) $(FSTRICTFLAGS) $(INCLUDES) -c *.f90; \ - $(AR) rv $(SWIFTEST_HOME)/lib/libswiftest.a *.o *.smod; \ - $(INSTALL_DATA) *.smod $(SWIFTEST_HOME)/include; \ - rm -f *.o *.smo - -drivers: - cd $(SWIFTEST_HOME)/src/main; \ - rm -f Makefile.Defines Makefile; \ - ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \ - ln -s $(SWIFTEST_HOME)/Makefile .; \ - make bin - -bin: *.f90 - make $(basename $^) - -clean: - cd $(SWIFTEST_HOME)/src/modules; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/discard; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/drift; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/encounter; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/fraggle; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/gr; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/helio; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/io; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/kick; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/main; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/netcdf; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/obl; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/operators; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/orbel; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/rmvs; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/setup; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/symba; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/tides; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/user; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/util; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/walltime; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/src/whm; rm -f Makefile.Defines Makefile *.gc* - cd $(SWIFTEST_HOME)/bin; rm -f swiftest_* - cd $(SWIFTEST_HOME)/bin; rm -f tool_* - cd $(SWIFTEST_HOME)/lib; rm -f lib* - cd $(SWIFTEST_HOME)/include; rm -f *.mod *.smod - cd $(COLLRESOLVE_HOME); rm -rf autom4te.cache aux Makefile stamp-h1 configure config.status config.h config.log aclocal.m4 lib* *.in *.o *.lo cambioni2019/*.o cambioni2019/*.lo - -force: From 777d6a286416bce22f3657893e0c9a4e5d07edb9 Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Thu, 13 Oct 2022 12:58:03 -0400 Subject: [PATCH 10/27] lowercased symba so bell will like it --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd6f5b08d..317b3cec1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,7 @@ SET(ORBEL ${SRC}/orbel) SET(PYTHONBINDINGS ${SRC}/python_bindings) SET(RMVS ${SRC}/rmvs) SET(SETUP ${SRC}/setup) -SET(SYMBA ${SRC}/SYMBA) +SET(SYMBA ${SRC}/symba) #SET(TIDES ${SRC}/tides) SET(USER ${SRC}/user) SET(UTIL ${SRC}/util) From 10fa26e6708066d7e971f3e6619ddacb99d58897 Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Thu, 13 Oct 2022 13:27:28 -0400 Subject: [PATCH 11/27] deleted the lib directory --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 317b3cec1..51b36722b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,6 @@ SET(FOOEXE swiftest_driver) # Define some directories SET(SRC ${CMAKE_SOURCE_DIR}/src) -SET(LIB ${CMAKE_SOURCE_DIR}/lib) SET(BIN ${CMAKE_SOURCE_DIR}/bin) SET(DISCARD ${SRC}/discard) SET(DRIFT ${SRC}/drift) From b362783a7d9aa2df6bbcae32b3fd6650010e240e Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Thu, 13 Oct 2022 13:30:00 -0400 Subject: [PATCH 12/27] deleted the bin directory --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51b36722b..aacefaa1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,6 @@ SET(FOOEXE swiftest_driver) # Define some directories SET(SRC ${CMAKE_SOURCE_DIR}/src) -SET(BIN ${CMAKE_SOURCE_DIR}/bin) SET(DISCARD ${SRC}/discard) SET(DRIFT ${SRC}/drift) SET(ENCOUNTER ${SRC}/encounter) From f807e7409caa82be40f810c7590bf9ff60c4982c Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Thu, 13 Oct 2022 13:32:01 -0400 Subject: [PATCH 13/27] added the bin directory back in --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index aacefaa1b..51b36722b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,7 @@ SET(FOOEXE swiftest_driver) # Define some directories SET(SRC ${CMAKE_SOURCE_DIR}/src) +SET(BIN ${CMAKE_SOURCE_DIR}/bin) SET(DISCARD ${SRC}/discard) SET(DRIFT ${SRC}/drift) SET(ENCOUNTER ${SRC}/encounter) From 8aae06c8001ba17cdcb711b2c2725a626d0f897b Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Thu, 13 Oct 2022 14:48:05 -0400 Subject: [PATCH 14/27] Took the src subdirectories out of the topmost CMakeLists.txt --- CMakeLists.txt | 31 +------ src/CMakeLists.txt | 201 +++++++++++++++++++++++---------------------- 2 files changed, 105 insertions(+), 127 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51b36722b..70f290749 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,42 +42,17 @@ ENDIF(FCNAME STREQUAL "pgf90") # Define the actual files and folders that make up the build ############################################################ -# Define the executable name -SET(FOOEXE swiftest_driver) - # Define some directories SET(SRC ${CMAKE_SOURCE_DIR}/src) +SET(LIB ${CMAKE_SOURCE_DIR}/lib) SET(BIN ${CMAKE_SOURCE_DIR}/bin) -SET(DISCARD ${SRC}/discard) -SET(DRIFT ${SRC}/drift) -SET(ENCOUNTER ${SRC}/encounter) -SET(FRAGGLE ${SRC}/fraggle) -SET(GR ${SRC}/gr) -SET(HELIO ${SRC}/helio) -SET(IO ${SRC}/io) -SET(KICK ${SRC}/kick) -SET(MAIN ${SRC}/main) -SET(MODULES ${SRC}/modules) -SET(NETCDF ${SRC}/netcdf) -SET(OBL ${SRC}/obl) -SET(OPERATORS ${SRC}/operators) -SET(ORBEL ${SRC}/orbel) -SET(PYTHONBINDINGS ${SRC}/python_bindings) -SET(RMVS ${SRC}/rmvs) -SET(SETUP ${SRC}/setup) -SET(SYMBA ${SRC}/symba) -#SET(TIDES ${SRC}/tides) -SET(USER ${SRC}/user) -SET(UTIL ${SRC}/util) -SET(WALLTIME ${SRC}/walltime) -SET(WHM ${SRC}/whm) -SET(EXE ${SRC}) +SET(SRCOPT ${SRC}) # Have the .mod files placed in the lib folder SET(CMAKE_Fortran_MODULE_DIRECTORY ${LIB}) # The source for the FOO binary and have it placed in the bin folder -ADD_SUBDIRECTORY(${EXE} ${BIN}) +ADD_SUBDIRECTORY(${SRCOPT} ${BIN}) # Add a distclean target to the Makefile ADD_CUSTOM_TARGET(distclean diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 494571aac..e8f81357a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,107 +3,110 @@ ######################################## # Add the source files -SET(FOO_src ${DISCARD}/discard.f90 - ${DRIFT}/drift.f90 - ${ENCOUNTER}/encounter_check.f90 - ${ENCOUNTER}/encounter_io.f90 - ${ENCOUNTER}/encounter_setup.f90 - ${ENCOUNTER}/encounter_util.f90 - ${FRAGGLE}/fraggle_generate.f90 - ${FRAGGLE}/fraggle_io.f90 - ${FRAGGLE}/fraggle_placeholder.f90 - ${FRAGGLE}/fraggle_regime.f90 - ${FRAGGLE}/fraggle_set.f90 - ${FRAGGLE}/fraggle_setup.f90 - ${FRAGGLE}/fraggle_util.f90 - ${GR}/gr.f90 - ${HELIO}/helio_drift.f90 - ${HELIO}/helio_gr.f90 - ${HELIO}/helio_kick.f90 - ${HELIO}/helio_setup.f90 - ${HELIO}/helio_step.f90 - ${HELIO}/helio_util.f90 - ${IO}/io.f90 - ${KICK}/kick.f90 - ${MAIN}/swiftest_driver.f90 - ${MODULES}/encounter_classes.f90 - ${MODULES}/fraggle_classes.f90 - ${MODULES}/helio_classes.f90 - ${MODULES}/lambda_function.f90 - ${MODULES}/rmvs_classes.f90 - ${MODULES}/swiftest_classes.f90 - ${MODULES}/swiftest_globals.f90 - ${MODULES}/swiftest_operators.f90 - ${MODULES}/swiftest.f90 - ${MODULES}/symba_classes.f90 - ${MODULES}/walltime_classes.f90 - ${MODULES}/whm_classes.f90 - ${NETCDF}/netcdf.f90 - ${OBL}/obl.f90 - ${OPERATORS}/operator_cross.f90 - ${OPERATORS}/operator_mag.f90 - ${ORBEL}/orbel.f90 - ${PYTHONBINDINGS}/orbel.f90 - ${RMVS}/rmvs_discard.f90 - ${RMVS}/rmvs_encounter_check.f90 - ${RMVS}/rmvs_io.f90 - ${RMVS}/rmvs_kick.f90 - ${RMVS}/rmvs_setup.f90 - ${RMVS}/rmvs_step.f90 - ${RMVS}/rmvs_util.f90 - ${SETUP}/setup.f90 - ${SYMBA}/symba_collision.f90 - ${SYMBA}/symba_discard.f90 - ${SYMBA}/symba_drift.f90 - ${SYMBA}/symba_encounter_check.f90 - ${SYMBA}/symba_gr.f90 - ${SYMBA}/symba_io.f90 - ${SYMBA}/symba_kick.f90 - ${SYMBA}/symba_setup.f90 - ${SYMBA}/symba_step.f90 - ${SYMBA}/symba_util.f90 -# ${TIDES}/tides_getacch_pl.f90 -# ${TIDES}/tides_spin_step.f90 - ${USER}/user_getacch.f90 - ${UTIL}/util_append.f90 - ${UTIL}/util_coord.f90 - ${UTIL}/util_copy.f90 - ${UTIL}/util_dealloc.f90 - ${UTIL}/util_exit.f90 - ${UTIL}/util_fill.f90 - ${UTIL}/util_flatten.f90 - ${UTIL}/util_get_energy_momentum.f90 - ${UTIL}/util_index_array.f90 - ${UTIL}/util_minimize_bfgs.f90 - ${UTIL}/util_peri.f90 - ${UTIL}/util_rescale.f90 - ${UTIL}/util_resize.f90 - ${UTIL}/util_set.f90 - ${UTIL}/util_solve.f90 - ${UTIL}/util_sort.f90 - ${UTIL}/util_spill.f90 - ${UTIL}/util_valid.f90 - ${UTIL}/util_version.f90 - ${WALLTIME}/walltime.f90 - ${WHM}/whm_coord.f90 - ${WHM}/whm_drift.f90 - ${WHM}/whm_gr.f90 - ${WHM}/whm_kick.f90 - ${WHM}/whm_setup.f90 - ${WHM}/whm_step.f90 - ${WHM}/whm_util.f90 +SET(OPT_src ${SRCOPT}/discard/discard.f90 + ${SRCOPT}/drift/drift.f90 + ${SRCOPT}/encounter/encounter_check.f90 + ${SRCOPT}/encounter/encounter_io.f90 + ${SRCOPT}/encounter/encounter_setup.f90 + ${SRCOPT}/encounter/encounter_util.f90 + ${SRCOPT}/fraggle/fraggle_generate.f90 + ${SRCOPT}/fraggle/fraggle_io.f90 + ${SRCOPT}/fraggle/fraggle_placeholder.f90 + ${SRCOPT}/fraggle/fraggle_regime.f90 + ${SRCOPT}/fraggle/fraggle_set.f90 + ${SRCOPT}/fraggle/fraggle_setup.f90 + ${SRCOPT}/fraggle/fraggle_util.f90 + ${SRCOPT}/gr/gr.f90 + ${SRCOPT}/helio/helio_drift.f90 + ${SRCOPT}/helio/helio_gr.f90 + ${SRCOPT}/helio/helio_kick.f90 + ${SRCOPT}/helio/helio_setup.f90 + ${SRCOPT}/helio/helio_step.f90 + ${SRCOPT}/helio/helio_util.f90 + ${SRCOPT}/io/io.f90 + ${SRCOPT}/kick/kick.f90 + ${SRCOPT}/main/swiftest_driver.f90 + ${SRCOPT}/modules/encounter_classes.f90 + ${SRCOPT}/modules/fraggle_classes.f90 + ${SRCOPT}/modules/helio_classes.f90 + ${SRCOPT}/modules/lambda_function.f90 + ${SRCOPT}/modules/rmvs_classes.f90 + ${SRCOPT}/modules/swiftest_classes.f90 + ${SRCOPT}/modules/swiftest_globals.f90 + ${SRCOPT}/modules/swiftest_operators.f90 + ${SRCOPT}/modules/swiftest.f90 + ${SRCOPT}/modules/symba_classes.f90 + ${SRCOPT}/modules/walltime_classes.f90 + ${SRCOPT}/modules/whm_classes.f90 + ${SRCOPT}/netcdf/netcdf.f90 + ${SRCOPT}/obl/obl.f90 + ${SRCOPT}/operators/operator_cross.f90 + ${SRCOPT}/operators/operator_mag.f90 + ${SRCOPT}/orbel/orbel.f90 +# ${SRCOPT}/python_bindings/orbel.f90 + ${SRCOPT}/rmvs/rmvs_discard.f90 + ${SRCOPT}/rmvs/rmvs_encounter_check.f90 + ${SRCOPT}/rmvs/rmvs_io.f90 + ${SRCOPT}/rmvs/rmvs_kick.f90 + ${SRCOPT}/rmvs/rmvs_setup.f90 + ${SRCOPT}/rmvs/rmvs_step.f90 + ${SRCOPT}/rmvs/rmvs_util.f90 + ${SRCOPT}/setup/setup.f90 + ${SRCOPT}/symba/symba_collision.f90 + ${SRCOPT}/symba/symba_discard.f90 + ${SRCOPT}/symba/symba_drift.f90 + ${SRCOPT}/symba/symba_encounter_check.f90 + ${SRCOPT}/symba/symba_gr.f90 + ${SRCOPT}/symba/symba_io.f90 + ${SRCOPT}/symba/symba_kick.f90 + ${SRCOPT}/symba/symba_setup.f90 + ${SRCOPT}/symba/symba_step.f90 + ${SRCOPT}/symba/symba_util.f90 +# ${SRCOPT}/tides/tides_getacch_pl.f90 +# ${SRCOPT}/tides/tides_spin_step.f90 + ${SRCOPT}/user/user_getacch.f90 + ${SRCOPT}/util/util_append.f90 + ${SRCOPT}/util/util_coord.f90 + ${SRCOPT}/util/util_copy.f90 + ${SRCOPT}/util/util_dealloc.f90 + ${SRCOPT}/util/util_exit.f90 + ${SRCOPT}/util/util_fill.f90 + ${SRCOPT}/util/util_flatten.f90 + ${SRCOPT}/util/util_get_energy_momentum.f90 + ${SRCOPT}/util/util_index_array.f90 + ${SRCOPT}/util/util_minimize_bfgs.f90 + ${SRCOPT}/util/util_peri.f90 + ${SRCOPT}/util/util_rescale.f90 + ${SRCOPT}/util/util_resize.f90 + ${SRCOPT}/util/util_set.f90 + ${SRCOPT}/util/util_solve.f90 + ${SRCOPT}/util/util_sort.f90 + ${SRCOPT}/util/util_spill.f90 + ${SRCOPT}/util/util_valid.f90 + ${SRCOPT}/util/util_version.f90 + ${SRCOPT}/walltime/walltime.f90 + ${SRCOPT}/whm/whm_coord.f90 + ${SRCOPT}/whm/whm_drift.f90 + ${SRCOPT}/whm/whm_gr.f90 + ${SRCOPT}/whm/whm_kick.f90 + ${SRCOPT}/whm/whm_setup.f90 + ${SRCOPT}/whm/whm_step.f90 + ${SRCOPT}/whm/whm_util.f90 ) # Define the executable in terms of the source files -ADD_EXECUTABLE(${FOOEXE} ${FOO_src}) +FOREACH(SRCFILES ${OPT_src}) + GET_FILENAME_COMPONENT(OPTEXE ${SRCFILES} NAME_WE) + ADD_EXECUTABLE(${OPTEXE} ${OPT_src} ${SRCFILES}) -##################################### -# Tell how to install this executable -##################################### + ##################################### + # Tell how to install this executable + ##################################### -IF(WIN32) - SET(CMAKE_INSTALL_PREFIX "C:\\Program Files") -ELSE() - SET(CMAKE_INSTALL_PREFIX /usr/local) -ENDIF(WIN32) -INSTALL(TARGETS ${FOOEXE} RUNTIME DESTINATION bin) + IF(WIN32) + SET(CMAKE_INSTALL_PREFIX "C:\\Program Files") + ELSE() + SET(CMAKE_INSTALL_PREFIX ~/.local/) + ENDIF(WIN32) + INSTALL(TARGETS ${OPTEXE} RUNTIME DESTINATION bin) +ENDFOREACH(SRCFILES ${OPT_exe_src}) From 1bcd1ebc178391c4e2fced562da74ec1e2453087 Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Fri, 14 Oct 2022 11:13:12 -0400 Subject: [PATCH 15/27] restructured creation of exe --- src/CMakeLists.txt | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e8f81357a..94a6205f3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,7 +3,7 @@ ######################################## # Add the source files -SET(OPT_src ${SRCOPT}/discard/discard.f90 +SET(FOO_src ${SRCOPT}/discard/discard.f90 ${SRCOPT}/drift/drift.f90 ${SRCOPT}/encounter/encounter_check.f90 ${SRCOPT}/encounter/encounter_io.f90 @@ -95,18 +95,15 @@ SET(OPT_src ${SRCOPT}/discard/discard.f90 ) # Define the executable in terms of the source files -FOREACH(SRCFILES ${OPT_src}) - GET_FILENAME_COMPONENT(OPTEXE ${SRCFILES} NAME_WE) - ADD_EXECUTABLE(${OPTEXE} ${OPT_src} ${SRCFILES}) +ADD_EXECUTABLE(${FOOEXE} ${FOO_src}) - ##################################### - # Tell how to install this executable - ##################################### +##################################### +# Tell how to install this executable +##################################### - IF(WIN32) - SET(CMAKE_INSTALL_PREFIX "C:\\Program Files") - ELSE() - SET(CMAKE_INSTALL_PREFIX ~/.local/) - ENDIF(WIN32) - INSTALL(TARGETS ${OPTEXE} RUNTIME DESTINATION bin) -ENDFOREACH(SRCFILES ${OPT_exe_src}) +IF(WIN32) + SET(CMAKE_INSTALL_PREFIX "C:\\Program Files") +ELSE() + SET(CMAKE_INSTALL_PREFIX /usr/local) +ENDIF(WIN32) +INSTALL(TARGETS ${FOOEXE} RUNTIME DESTINATION bin) \ No newline at end of file From f1855c3918c36493924b2426614bc723509e7ddb Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Fri, 14 Oct 2022 11:13:30 -0400 Subject: [PATCH 16/27] defined the swiftest_driver exe --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 70f290749..9f59a4fb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,9 @@ ENDIF(FCNAME STREQUAL "pgf90") # Define the actual files and folders that make up the build ############################################################ +# Define the executable name +SET(FOOEXE swiftest_driver) + # Define some directories SET(SRC ${CMAKE_SOURCE_DIR}/src) SET(LIB ${CMAKE_SOURCE_DIR}/lib) From 94a0e10d8b660794ec7a2d7a2acbeab7ca4bb25d Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Fri, 14 Oct 2022 11:35:03 -0400 Subject: [PATCH 17/27] renamed SRCOPT > SRC variable --- CMakeLists.txt | 3 +- src/CMakeLists.txt | 178 ++++++++++++++++++++++----------------------- 2 files changed, 90 insertions(+), 91 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f59a4fb8..93c669a3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,13 +49,12 @@ SET(FOOEXE swiftest_driver) SET(SRC ${CMAKE_SOURCE_DIR}/src) SET(LIB ${CMAKE_SOURCE_DIR}/lib) SET(BIN ${CMAKE_SOURCE_DIR}/bin) -SET(SRCOPT ${SRC}) # Have the .mod files placed in the lib folder SET(CMAKE_Fortran_MODULE_DIRECTORY ${LIB}) # The source for the FOO binary and have it placed in the bin folder -ADD_SUBDIRECTORY(${SRCOPT} ${BIN}) +ADD_SUBDIRECTORY(${SRC} ${BIN}) # Add a distclean target to the Makefile ADD_CUSTOM_TARGET(distclean diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 94a6205f3..ee3c64528 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,95 +3,95 @@ ######################################## # Add the source files -SET(FOO_src ${SRCOPT}/discard/discard.f90 - ${SRCOPT}/drift/drift.f90 - ${SRCOPT}/encounter/encounter_check.f90 - ${SRCOPT}/encounter/encounter_io.f90 - ${SRCOPT}/encounter/encounter_setup.f90 - ${SRCOPT}/encounter/encounter_util.f90 - ${SRCOPT}/fraggle/fraggle_generate.f90 - ${SRCOPT}/fraggle/fraggle_io.f90 - ${SRCOPT}/fraggle/fraggle_placeholder.f90 - ${SRCOPT}/fraggle/fraggle_regime.f90 - ${SRCOPT}/fraggle/fraggle_set.f90 - ${SRCOPT}/fraggle/fraggle_setup.f90 - ${SRCOPT}/fraggle/fraggle_util.f90 - ${SRCOPT}/gr/gr.f90 - ${SRCOPT}/helio/helio_drift.f90 - ${SRCOPT}/helio/helio_gr.f90 - ${SRCOPT}/helio/helio_kick.f90 - ${SRCOPT}/helio/helio_setup.f90 - ${SRCOPT}/helio/helio_step.f90 - ${SRCOPT}/helio/helio_util.f90 - ${SRCOPT}/io/io.f90 - ${SRCOPT}/kick/kick.f90 - ${SRCOPT}/main/swiftest_driver.f90 - ${SRCOPT}/modules/encounter_classes.f90 - ${SRCOPT}/modules/fraggle_classes.f90 - ${SRCOPT}/modules/helio_classes.f90 - ${SRCOPT}/modules/lambda_function.f90 - ${SRCOPT}/modules/rmvs_classes.f90 - ${SRCOPT}/modules/swiftest_classes.f90 - ${SRCOPT}/modules/swiftest_globals.f90 - ${SRCOPT}/modules/swiftest_operators.f90 - ${SRCOPT}/modules/swiftest.f90 - ${SRCOPT}/modules/symba_classes.f90 - ${SRCOPT}/modules/walltime_classes.f90 - ${SRCOPT}/modules/whm_classes.f90 - ${SRCOPT}/netcdf/netcdf.f90 - ${SRCOPT}/obl/obl.f90 - ${SRCOPT}/operators/operator_cross.f90 - ${SRCOPT}/operators/operator_mag.f90 - ${SRCOPT}/orbel/orbel.f90 -# ${SRCOPT}/python_bindings/orbel.f90 - ${SRCOPT}/rmvs/rmvs_discard.f90 - ${SRCOPT}/rmvs/rmvs_encounter_check.f90 - ${SRCOPT}/rmvs/rmvs_io.f90 - ${SRCOPT}/rmvs/rmvs_kick.f90 - ${SRCOPT}/rmvs/rmvs_setup.f90 - ${SRCOPT}/rmvs/rmvs_step.f90 - ${SRCOPT}/rmvs/rmvs_util.f90 - ${SRCOPT}/setup/setup.f90 - ${SRCOPT}/symba/symba_collision.f90 - ${SRCOPT}/symba/symba_discard.f90 - ${SRCOPT}/symba/symba_drift.f90 - ${SRCOPT}/symba/symba_encounter_check.f90 - ${SRCOPT}/symba/symba_gr.f90 - ${SRCOPT}/symba/symba_io.f90 - ${SRCOPT}/symba/symba_kick.f90 - ${SRCOPT}/symba/symba_setup.f90 - ${SRCOPT}/symba/symba_step.f90 - ${SRCOPT}/symba/symba_util.f90 -# ${SRCOPT}/tides/tides_getacch_pl.f90 -# ${SRCOPT}/tides/tides_spin_step.f90 - ${SRCOPT}/user/user_getacch.f90 - ${SRCOPT}/util/util_append.f90 - ${SRCOPT}/util/util_coord.f90 - ${SRCOPT}/util/util_copy.f90 - ${SRCOPT}/util/util_dealloc.f90 - ${SRCOPT}/util/util_exit.f90 - ${SRCOPT}/util/util_fill.f90 - ${SRCOPT}/util/util_flatten.f90 - ${SRCOPT}/util/util_get_energy_momentum.f90 - ${SRCOPT}/util/util_index_array.f90 - ${SRCOPT}/util/util_minimize_bfgs.f90 - ${SRCOPT}/util/util_peri.f90 - ${SRCOPT}/util/util_rescale.f90 - ${SRCOPT}/util/util_resize.f90 - ${SRCOPT}/util/util_set.f90 - ${SRCOPT}/util/util_solve.f90 - ${SRCOPT}/util/util_sort.f90 - ${SRCOPT}/util/util_spill.f90 - ${SRCOPT}/util/util_valid.f90 - ${SRCOPT}/util/util_version.f90 - ${SRCOPT}/walltime/walltime.f90 - ${SRCOPT}/whm/whm_coord.f90 - ${SRCOPT}/whm/whm_drift.f90 - ${SRCOPT}/whm/whm_gr.f90 - ${SRCOPT}/whm/whm_kick.f90 - ${SRCOPT}/whm/whm_setup.f90 - ${SRCOPT}/whm/whm_step.f90 - ${SRCOPT}/whm/whm_util.f90 +SET(FOO_src ${SRC}/discard/discard.f90 + ${SRC}/drift/drift.f90 + ${SRC}/encounter/encounter_check.f90 + ${SRC}/encounter/encounter_io.f90 + ${SRC}/encounter/encounter_setup.f90 + ${SRC}/encounter/encounter_util.f90 + ${SRC}/fraggle/fraggle_generate.f90 + ${SRC}/fraggle/fraggle_io.f90 + ${SRC}/fraggle/fraggle_placeholder.f90 + ${SRC}/fraggle/fraggle_regime.f90 + ${SRC}/fraggle/fraggle_set.f90 + ${SRC}/fraggle/fraggle_setup.f90 + ${SRC}/fraggle/fraggle_util.f90 + ${SRC}/gr/gr.f90 + ${SRC}/helio/helio_drift.f90 + ${SRC}/helio/helio_gr.f90 + ${SRC}/helio/helio_kick.f90 + ${SRC}/helio/helio_setup.f90 + ${SRC}/helio/helio_step.f90 + ${SRC}/helio/helio_util.f90 + ${SRC}/io/io.f90 + ${SRC}/kick/kick.f90 + ${SRC}/main/swiftest_driver.f90 + ${SRC}/modules/encounter_classes.f90 + ${SRC}/modules/fraggle_classes.f90 + ${SRC}/modules/helio_classes.f90 + ${SRC}/modules/lambda_function.f90 + ${SRC}/modules/rmvs_classes.f90 + ${SRC}/modules/swiftest_classes.f90 + ${SRC}/modules/swiftest_globals.f90 + ${SRC}/modules/swiftest_operators.f90 + ${SRC}/modules/swiftest.f90 + ${SRC}/modules/symba_classes.f90 + ${SRC}/modules/walltime_classes.f90 + ${SRC}/modules/whm_classes.f90 + ${SRC}/netcdf/netcdf.f90 + ${SRC}/obl/obl.f90 + ${SRC}/operators/operator_cross.f90 + ${SRC}/operators/operator_mag.f90 + ${SRC}/orbel/orbel.f90 +# ${SRC}/python_bindings/orbel.f90 + ${SRC}/rmvs/rmvs_discard.f90 + ${SRC}/rmvs/rmvs_encounter_check.f90 + ${SRC}/rmvs/rmvs_io.f90 + ${SRC}/rmvs/rmvs_kick.f90 + ${SRC}/rmvs/rmvs_setup.f90 + ${SRC}/rmvs/rmvs_step.f90 + ${SRC}/rmvs/rmvs_util.f90 + ${SRC}/setup/setup.f90 + ${SRC}/symba/symba_collision.f90 + ${SRC}/symba/symba_discard.f90 + ${SRC}/symba/symba_drift.f90 + ${SRC}/symba/symba_encounter_check.f90 + ${SRC}/symba/symba_gr.f90 + ${SRC}/symba/symba_io.f90 + ${SRC}/symba/symba_kick.f90 + ${SRC}/symba/symba_setup.f90 + ${SRC}/symba/symba_step.f90 + ${SRC}/symba/symba_util.f90 +# ${SRC}/tides/tides_getacch_pl.f90 +# ${SRC}/tides/tides_spin_step.f90 + ${SRC}/user/user_getacch.f90 + ${SRC}/util/util_append.f90 + ${SRC}/util/util_coord.f90 + ${SRC}/util/util_copy.f90 + ${SRC}/util/util_dealloc.f90 + ${SRC}/util/util_exit.f90 + ${SRC}/util/util_fill.f90 + ${SRC}/util/util_flatten.f90 + ${SRC}/util/util_get_energy_momentum.f90 + ${SRC}/util/util_index_array.f90 + ${SRC}/util/util_minimize_bfgs.f90 + ${SRC}/util/util_peri.f90 + ${SRC}/util/util_rescale.f90 + ${SRC}/util/util_resize.f90 + ${SRC}/util/util_set.f90 + ${SRC}/util/util_solve.f90 + ${SRC}/util/util_sort.f90 + ${SRC}/util/util_spill.f90 + ${SRC}/util/util_valid.f90 + ${SRC}/util/util_version.f90 + ${SRC}/walltime/walltime.f90 + ${SRC}/whm/whm_coord.f90 + ${SRC}/whm/whm_drift.f90 + ${SRC}/whm/whm_gr.f90 + ${SRC}/whm/whm_kick.f90 + ${SRC}/whm/whm_setup.f90 + ${SRC}/whm/whm_step.f90 + ${SRC}/whm/whm_util.f90 ) # Define the executable in terms of the source files From a65eed86e051721595df92c04cd7a15ff2fde4ba Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Fri, 14 Oct 2022 15:53:41 -0400 Subject: [PATCH 18/27] Added the NetCDF libraries --- CMakeLists.txt | 2 ++ cmake/Modules/SetUpNetCDF.cmake | 9 +++++++++ src/CMakeLists.txt | 8 ++++++++ 3 files changed, 19 insertions(+) create mode 100644 cmake/Modules/SetUpNetCDF.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 93c669a3d..df809a500 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,8 @@ INCLUDE(${CMAKE_MODULE_PATH}/SetFortranFlags.cmake) # about Fortran. INCLUDE(${CMAKE_MODULE_PATH}/SetParallelizationLibrary.cmake) +INCLUDE(${CMAKE_MODULE_PATH}/SetUpNetCDF.cmake) + # There is an error in CMAKE with this flag for pgf90. Unset it GET_FILENAME_COMPONENT(FCNAME ${CMAKE_Fortran_COMPILER} NAME) IF(FCNAME STREQUAL "pgf90") diff --git a/cmake/Modules/SetUpNetCDF.cmake b/cmake/Modules/SetUpNetCDF.cmake new file mode 100644 index 000000000..eac9cb543 --- /dev/null +++ b/cmake/Modules/SetUpNetCDF.cmake @@ -0,0 +1,9 @@ +# Find NetCDF if not already found +IF(NOT NETCDF_FOUND) + ENABLE_LANGUAGE(C) # Some libraries need a C compiler to find + FIND_PACKAGE(NETCDF REQUIRED) + SET(NETCDF_FOUND TRUE CACHE INTERNAL "NETCDF was found" FORCE) + SET(NETCDFFORTRAN_FOUND TRUE CACHE INTERNAL "NETCDFFORTRAN was found" FORCE) + SET(NETCDF_LIBRARIES ${NETCDF_LIBRARIES} CACHE INTERNAL "NETCDF LIBS" FORCE) + SET(NETCDFFORTRAN_LIBRARIES ${NETCDFFORTRAN_LIBRARIES} CACHE INTERNAL "NETCDFFORTRAN LIBS" FORCE) +ENDIF(NOT NETCDF_FOUND) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ee3c64528..7b4960f43 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -97,6 +97,14 @@ SET(FOO_src ${SRC}/discard/discard.f90 # Define the executable in terms of the source files ADD_EXECUTABLE(${FOOEXE} ${FOO_src}) +##################################################### +# Add the needed libraries and special compiler flags +##################################################### + +# Uncomment if you need to link to BLAS and LAPACK +TARGET_LINK_LIBRARIES(${FOOEXE} ${NETCDF_LIBRARIES} + ${NETCDFFORTRAN_LIBRARIES}) + ##################################### # Tell how to install this executable ##################################### From 13cf14b5f3b894854bf7716684afecb53c1d984a Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Fri, 14 Oct 2022 15:53:54 -0400 Subject: [PATCH 19/27] uncommented parallelization --- CMakeLists.txt | 4 ++-- src/CMakeLists.txt | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index df809a500..efecbc4d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,8 +20,8 @@ SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/") # Set some options the user may choose # Uncomment the below if you want the user to choose a parallelization library -#OPTION(USE_MPI "Use the MPI library for parallelization" OFF) -#OPTION(USE_OPENMP "Use OpenMP for parallelization" OFF) +OPTION(USE_MPI "Use the MPI library for parallelization" OFF) +OPTION(USE_OPENMP "Use OpenMP for parallelization" OFF) # This INCLUDE statement executes code that sets the compile flags for DEBUG, # RELEASE, and TESTING. You should review this file and make sure the flags diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7b4960f43..e0bc0750b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -105,6 +105,21 @@ ADD_EXECUTABLE(${FOOEXE} ${FOO_src}) TARGET_LINK_LIBRARIES(${FOOEXE} ${NETCDF_LIBRARIES} ${NETCDFFORTRAN_LIBRARIES}) +# Uncomment if you have parallization +IF(USE_OPENMP) + SET_TARGET_PROPERTIES(${FOOEXE} PROPERTIES + COMPILE_FLAGS "${OpenMP_Fortran_FLAGS}" + LINK_FLAGS "${OpenMP_Fortran_FLAGS}") +ELSEIF(USE_MPI) + SET_TARGET_PROPERTIES(${FOOEXE} PROPERTIES + COMPILE_FLAGS "${MPI_Fortran_COMPILE_FLAGS}" + LINK_FLAGS "${MPI_Fortran_LINK_FLAGS}") + INCLUDE_DIRECTORIES(${MPI_Fortran_INCLUDE_PATH}) + TARGET_LINK_LIBRARIES(${FOOEXE} ${MPI_Fortran_LIBRARIES}) +ENDIF(USE_OPENMP) + + + ##################################### # Tell how to install this executable ##################################### From 571f26de197967672cb77a0aa0870b8e1e6d555d Mon Sep 17 00:00:00 2001 From: David Minton Date: Fri, 14 Oct 2022 16:15:11 -0400 Subject: [PATCH 20/27] Minor maintenence on cmake stuff --- CMakeLists.txt | 6 +++--- cmake/Modules/SetFortranFlags.cmake | 14 +------------ src/CMakeLists.txt | 3 --- src/python_bindings/orbel.f90 | 32 ----------------------------- 4 files changed, 4 insertions(+), 51 deletions(-) delete mode 100644 src/python_bindings/orbel.f90 diff --git a/CMakeLists.txt b/CMakeLists.txt index efecbc4d3..776f386e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,9 +14,9 @@ SET(VERSION 1.0.0) SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/") # Uncomment if it is required that Fortran 90 is supported -#IF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) -# MESSAGE(FATAL_ERROR "Fortran compiler does not support F90") -#ENDIF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) +IF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) + MESSAGE(FATAL_ERROR "Fortran compiler does not support F90") +ENDIF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) # Set some options the user may choose # Uncomment the below if you want the user to choose a parallelization library diff --git a/cmake/Modules/SetFortranFlags.cmake b/cmake/Modules/SetFortranFlags.cmake index a8c1121e7..9d3e6bfb0 100644 --- a/cmake/Modules/SetFortranFlags.cmake +++ b/cmake/Modules/SetFortranFlags.cmake @@ -63,7 +63,7 @@ ELSE() ENDIF() # Optimize for the host's architecture SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}" - Fortran "-xHost" # Intel + Fortran "-xhost" # Intel "/QxHost" # Intel Windows ${GNUNATIVE} # GNU "-ta=host" # Portland Group @@ -244,13 +244,6 @@ SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" "/Qip" # Intel Windows ) -# Vectorize code -SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" - Fortran "-vec-report0" # Intel - "/Qvec-report0" # Intel Windows - "-Mvect" # Portland Group - ) - # Allows for lines longer than 80 characters without truncation SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" Fortran "-no-wrap-margin" # Intel @@ -277,11 +270,6 @@ SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" Fortran "-simd" # Intel ) -# Generate instructions for the highest instruction set available -SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" - Fortran "-xhost" # Intel - ) - # Aligns a variable to a specified boundary and offset SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" Fortran "-align all" # Intel diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e0bc0750b..24b545ea2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,7 +43,6 @@ SET(FOO_src ${SRC}/discard/discard.f90 ${SRC}/operators/operator_cross.f90 ${SRC}/operators/operator_mag.f90 ${SRC}/orbel/orbel.f90 -# ${SRC}/python_bindings/orbel.f90 ${SRC}/rmvs/rmvs_discard.f90 ${SRC}/rmvs/rmvs_encounter_check.f90 ${SRC}/rmvs/rmvs_io.f90 @@ -62,8 +61,6 @@ SET(FOO_src ${SRC}/discard/discard.f90 ${SRC}/symba/symba_setup.f90 ${SRC}/symba/symba_step.f90 ${SRC}/symba/symba_util.f90 -# ${SRC}/tides/tides_getacch_pl.f90 -# ${SRC}/tides/tides_spin_step.f90 ${SRC}/user/user_getacch.f90 ${SRC}/util/util_append.f90 ${SRC}/util/util_coord.f90 diff --git a/src/python_bindings/orbel.f90 b/src/python_bindings/orbel.f90 deleted file mode 100644 index 59f24e8b2..000000000 --- a/src/python_bindings/orbel.f90 +++ /dev/null @@ -1,32 +0,0 @@ -module orbel - use swiftest - private - public :: xv2el -contains - pure elemental subroutine xv2el(mu, px, py, pz, vx, vy, vz, a, e, inc, capom, omega, capm) - use swiftest_classes, only : orbel_xv2el - implicit none - ! Arguments - real*8, intent(in) :: mu, px, py, pz, vx, vy, vz - real*8, intent(out) :: a, e, inc, capom, omega, capm - !$f2py intent(in) mu - !$f2py intent(in) px - !$f2py intent(in) py - !$f2py intent(in) pz - !$f2py intent(in) vx - !$f2py intent(in) vy - !$f2py intent(in) vz - !$f2py intent(out) a - !$f2py intent(out) e - !$f2py intent(out) inc - !$f2py intent(out) capom - !$f2py intent(out) omega - !$f2py intent(out) capm - ! Internals - real*8, dimension(3) :: x, v - x = [px, py, pz] - v = [vx, vy, vz] - call orbel_xv2el(mu, x(:), v(:), a, e, inc, capom, omega, capm) - return - end subroutine xv2el -end module orbel \ No newline at end of file From 15c5602b024b69f503f0a52bd0ea0ca75515d3ef Mon Sep 17 00:00:00 2001 From: David Minton Date: Fri, 14 Oct 2022 16:16:44 -0400 Subject: [PATCH 21/27] Added .gitignore files to bin and build directories so that they are empty on the git --- bin/.gitignore | 2 ++ build/.gitignore | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 bin/.gitignore create mode 100644 build/.gitignore diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 000000000..d6b7ef32c --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/build/.gitignore b/build/.gitignore new file mode 100644 index 000000000..d6b7ef32c --- /dev/null +++ b/build/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore From 1948d585865818c62a3f980bf5b1cbf3d2c9b01d Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Mon, 17 Oct 2022 12:08:13 -0400 Subject: [PATCH 22/27] module pure > pure module --- src/encounter/encounter_check.f90 | 2 +- src/gr/gr.f90 | 14 +++---- src/helio/helio_gr.f90 | 8 ++-- src/kick/kick.f90 | 4 +- src/modules/encounter_classes.f90 | 2 +- src/modules/helio_classes.f90 | 8 ++-- src/modules/swiftest_classes.f90 | 60 +++++++++++++++--------------- src/modules/swiftest_operators.f90 | 40 ++++++++++---------- src/modules/symba_classes.f90 | 4 +- src/modules/whm_classes.f90 | 8 ++-- src/operators/operator_cross.f90 | 28 +++++++------- src/operators/operator_mag.f90 | 10 ++--- src/orbel/orbel.f90 | 8 ++-- src/symba/symba_gr.f90 | 4 +- src/util/util_flatten.f90 | 4 +- src/util/util_sort.f90 | 28 +++++++------- src/whm/whm_gr.f90 | 8 ++-- 17 files changed, 120 insertions(+), 120 deletions(-) diff --git a/src/encounter/encounter_check.f90 b/src/encounter/encounter_check.f90 index 20fcb3bd5..8acbc4315 100644 --- a/src/encounter/encounter_check.f90 +++ b/src/encounter/encounter_check.f90 @@ -865,7 +865,7 @@ subroutine encounter_check_remove_duplicates(n, nenc, index1, index2, lvdotr) end subroutine encounter_check_remove_duplicates - module pure subroutine encounter_check_sort_aabb_1D(self, n, extent_arr) + pure module subroutine encounter_check_sort_aabb_1D(self, n, extent_arr) !! author: David A. Minton !! !! Sorts the bounding box extents along a single dimension prior to the sweep phase. diff --git a/src/gr/gr.f90 b/src/gr/gr.f90 index b05465e98..73a182729 100644 --- a/src/gr/gr.f90 +++ b/src/gr/gr.f90 @@ -2,7 +2,7 @@ use swiftest contains - module pure subroutine gr_kick_getaccb_ns_body(self, system, param) + pure module subroutine gr_kick_getaccb_ns_body(self, system, param) !! author: David A. Minton !! !! Add relativistic correction acceleration for non-symplectic integrators. @@ -45,7 +45,7 @@ module pure subroutine gr_kick_getaccb_ns_body(self, system, param) end subroutine gr_kick_getaccb_ns_body - module pure subroutine gr_kick_getacch(mu, x, lmask, n, inv_c2, agr) + pure module subroutine gr_kick_getacch(mu, x, lmask, n, inv_c2, agr) !! author: David A. Minton !! !! Compute relativisitic accelerations of massive bodies @@ -75,7 +75,7 @@ module pure subroutine gr_kick_getacch(mu, x, lmask, n, inv_c2, agr) end subroutine gr_kick_getacch - module pure subroutine gr_p4_pos_kick(param, x, v, dt) + pure module subroutine gr_p4_pos_kick(param, x, v, dt) !! author: David A. Minton !! !! Position kick due to p**4 term in the post-Newtonian correction @@ -104,7 +104,7 @@ module pure subroutine gr_p4_pos_kick(param, x, v, dt) end subroutine gr_p4_pos_kick - module pure subroutine gr_pseudovel2vel(param, mu, xh, pv, vh) + pure module subroutine gr_pseudovel2vel(param, mu, xh, pv, vh) !! author: David A. Minton !! !! Converts the relativistic pseudovelocity back into a veliocentric velocity @@ -136,7 +136,7 @@ module pure subroutine gr_pseudovel2vel(param, mu, xh, pv, vh) end subroutine gr_pseudovel2vel - module pure subroutine gr_pv2vh_body(self, param) + pure module subroutine gr_pv2vh_body(self, param) !! author: David A. Minton !! !! Wrapper function that converts from pseudovelocity to heliocentric velocity for swiftest bodies @@ -161,7 +161,7 @@ module pure subroutine gr_pv2vh_body(self, param) end subroutine gr_pv2vh_body - module pure subroutine gr_vel2pseudovel(param, mu, xh, vh, pv) + pure module subroutine gr_vel2pseudovel(param, mu, xh, vh, pv) !! author: David A. Minton !! !! Converts the heliocentric velocity into a pseudovelocity with relativistic corrections. @@ -238,7 +238,7 @@ module pure subroutine gr_vel2pseudovel(param, mu, xh, vh, pv) end subroutine gr_vel2pseudovel - module pure subroutine gr_vh2pv_body(self, param) + pure module subroutine gr_vh2pv_body(self, param) !! author: David A. Minton !! !! Wrapper function that converts from heliocentric velocity to pseudovelocity for Swiftest bodies diff --git a/src/helio/helio_gr.f90 b/src/helio/helio_gr.f90 index 1ff8eb5d5..2c99d0016 100644 --- a/src/helio/helio_gr.f90 +++ b/src/helio/helio_gr.f90 @@ -2,7 +2,7 @@ use swiftest contains - module pure subroutine helio_gr_kick_getacch_pl(self, param) + pure module subroutine helio_gr_kick_getacch_pl(self, param) !! author: David A. Minton !! !! Compute relativisitic accelerations of massive bodies @@ -30,7 +30,7 @@ module pure subroutine helio_gr_kick_getacch_pl(self, param) end subroutine helio_gr_kick_getacch_pl - module pure subroutine helio_gr_kick_getacch_tp(self, param) + pure module subroutine helio_gr_kick_getacch_tp(self, param) !! author: David A. Minton !! !! Compute relativisitic accelerations of test particles @@ -56,7 +56,7 @@ module pure subroutine helio_gr_kick_getacch_tp(self, param) end subroutine helio_gr_kick_getacch_tp - module pure subroutine helio_gr_p4_pl(self, system, param, dt) + pure module subroutine helio_gr_p4_pl(self, system, param, dt) !! author: David A. Minton !! !! Position kick to massive bodies due to p**4 term in the post-Newtonian correction @@ -84,7 +84,7 @@ module pure subroutine helio_gr_p4_pl(self, system, param, dt) end subroutine helio_gr_p4_pl - module pure subroutine helio_gr_p4_tp(self, system, param, dt) + pure module subroutine helio_gr_p4_tp(self, system, param, dt) !! author: David A. Minton !! !! Position kick to test particles due to p**4 term in the post-Newtonian correction diff --git a/src/kick/kick.f90 b/src/kick/kick.f90 index e680fde98..a9a5e8d7a 100644 --- a/src/kick/kick.f90 +++ b/src/kick/kick.f90 @@ -255,7 +255,7 @@ module subroutine kick_getacch_int_all_tp(ntp, npl, xtp, xpl, GMpl, lmask, acc) end subroutine kick_getacch_int_all_tp - module pure subroutine kick_getacch_int_one_pl(rji2, xr, yr, zr, Gmi, Gmj, axi, ayi, azi, axj, ayj, azj) + pure module subroutine kick_getacch_int_one_pl(rji2, xr, yr, zr, Gmi, Gmj, axi, ayi, azi, axj, ayj, azj) !! author: David A. Minton !! !! Compute direct cross (third) term heliocentric accelerations for a single pair of massive bodies @@ -286,7 +286,7 @@ module pure subroutine kick_getacch_int_one_pl(rji2, xr, yr, zr, Gmi, Gmj, axi, end subroutine kick_getacch_int_one_pl - module pure subroutine kick_getacch_int_one_tp(rji2, xr, yr, zr, GMpl, ax, ay, az) + pure module subroutine kick_getacch_int_one_tp(rji2, xr, yr, zr, GMpl, ax, ay, az) !! author: David A. Minton !! !! Compute direct cross (third) term heliocentric accelerations of a single test particle massive body pair. diff --git a/src/modules/encounter_classes.f90 b/src/modules/encounter_classes.f90 index f7758ef54..39b88ae05 100644 --- a/src/modules/encounter_classes.f90 +++ b/src/modules/encounter_classes.f90 @@ -128,7 +128,7 @@ module subroutine encounter_check_collapse_ragged_list(ragged_list, n1, nenc, in logical, dimension(:), allocatable, intent(out), optional :: lvdotr !! Array indicating which bodies are approaching end subroutine encounter_check_collapse_ragged_list - module pure subroutine encounter_check_sort_aabb_1D(self, n, extent_arr) + pure module subroutine encounter_check_sort_aabb_1D(self, n, extent_arr) implicit none class(encounter_bounding_box_1D), intent(inout) :: self !! Bounding box structure along a single dimension integer(I4B), intent(in) :: n !! Number of bodies with extents diff --git a/src/modules/helio_classes.f90 b/src/modules/helio_classes.f90 index 78a4bdc34..81d600c48 100644 --- a/src/modules/helio_classes.f90 +++ b/src/modules/helio_classes.f90 @@ -108,21 +108,21 @@ module subroutine helio_drift_linear_tp(self, cb, dt, lbeg) logical, intent(in) :: lbeg !! Argument that determines whether or not this is the beginning or end of the step end subroutine helio_drift_linear_tp - module pure subroutine helio_gr_kick_getacch_pl(self, param) + pure module subroutine helio_gr_kick_getacch_pl(self, param) use swiftest_classes, only : swiftest_parameters implicit none class(helio_pl), intent(inout) :: self !! Helio massive body particle data structure class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters end subroutine helio_gr_kick_getacch_pl - module pure subroutine helio_gr_kick_getacch_tp(self, param) + pure module subroutine helio_gr_kick_getacch_tp(self, param) use swiftest_classes, only : swiftest_parameters implicit none class(helio_tp), intent(inout) :: self !! Helio massive body particle data structure class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters end subroutine helio_gr_kick_getacch_tp - module pure subroutine helio_gr_p4_pl(self, system, param, dt) + pure module subroutine helio_gr_p4_pl(self, system, param, dt) use swiftest_classes, only : swiftest_parameters, swiftest_nbody_system implicit none class(helio_pl), intent(inout) :: self !! Swiftest particle object @@ -131,7 +131,7 @@ module pure subroutine helio_gr_p4_pl(self, system, param, dt) real(DP), intent(in) :: dt !! Step size end subroutine helio_gr_p4_pl - module pure subroutine helio_gr_p4_tp(self, system, param, dt) + pure module subroutine helio_gr_p4_tp(self, system, param, dt) use swiftest_classes, only : swiftest_parameters, swiftest_nbody_system implicit none class(helio_tp), intent(inout) :: self !! Swiftest particle object diff --git a/src/modules/swiftest_classes.f90 b/src/modules/swiftest_classes.f90 index ca2d97347..d2f1adeef 100644 --- a/src/modules/swiftest_classes.f90 +++ b/src/modules/swiftest_classes.f90 @@ -518,14 +518,14 @@ module pure elemental subroutine drift_one(mu, px, py, pz, vx, vy, vz, dt, iflag integer(I4B), intent(out) :: iflag !! iflag : error status flag for Danby drift (0 = OK, nonzero = ERROR) end subroutine drift_one - module pure subroutine gr_kick_getaccb_ns_body(self, system, param) + pure module subroutine gr_kick_getaccb_ns_body(self, system, param) implicit none class(swiftest_body), intent(inout) :: self !! Swiftest generic body object class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters end subroutine gr_kick_getaccb_ns_body - module pure subroutine gr_kick_getacch(mu, x, lmask, n, inv_c2, agr) + pure module subroutine gr_kick_getacch(mu, x, lmask, n, inv_c2, agr) implicit none real(DP), dimension(:), intent(in) :: mu !! Gravitational constant real(DP), dimension(:,:), intent(in) :: x !! Position vectors @@ -535,7 +535,7 @@ module pure subroutine gr_kick_getacch(mu, x, lmask, n, inv_c2, agr) real(DP), dimension(:,:), intent(out) :: agr !! Accelerations end subroutine gr_kick_getacch - module pure subroutine gr_p4_pos_kick(param, x, v, dt) + pure module subroutine gr_p4_pos_kick(param, x, v, dt) implicit none class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters real(DP), dimension(:), intent(inout) :: x !! Position vector @@ -543,7 +543,7 @@ module pure subroutine gr_p4_pos_kick(param, x, v, dt) real(DP), intent(in) :: dt !! Step size end subroutine gr_p4_pos_kick - module pure subroutine gr_pseudovel2vel(param, mu, xh, pv, vh) + pure module subroutine gr_pseudovel2vel(param, mu, xh, pv, vh) implicit none class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters real(DP), intent(in) :: mu !! G * (Mcb + m), G = gravitational constant, Mcb = mass of central body, m = mass of body @@ -552,13 +552,13 @@ module pure subroutine gr_pseudovel2vel(param, mu, xh, pv, vh) real(DP), dimension(:), intent(out) :: vh !! Swiftestcentric velocity vector end subroutine gr_pseudovel2vel - module pure subroutine gr_pv2vh_body(self, param) + pure module subroutine gr_pv2vh_body(self, param) implicit none class(swiftest_body), intent(inout) :: self !! Swiftest particle object class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters end subroutine gr_pv2vh_body - module pure subroutine gr_vel2pseudovel(param, mu, xh, vh, pv) + pure module subroutine gr_vel2pseudovel(param, mu, xh, vh, pv) implicit none class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters real(DP), intent(in) :: mu !! G * (Mcb + m), G = gravitational constant, Mcb = mass of central body, m = mass of body @@ -567,7 +567,7 @@ module pure subroutine gr_vel2pseudovel(param, mu, xh, vh, pv) real(DP), dimension(:), intent(out) :: pv !! Pseudovelocity vector - see Saha & Tremain (1994), eq. (32) end subroutine gr_vel2pseudovel - module pure subroutine gr_vh2pv_body(self, param) + pure module subroutine gr_vh2pv_body(self, param) implicit none class(swiftest_body), intent(inout) :: self !! Swiftest particle object class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters @@ -869,7 +869,7 @@ module subroutine kick_getacch_int_all_tp(ntp, npl, xtp, xpl, GMpl, lmask, acc) real(DP), dimension(:,:), intent(inout) :: acc !! Acceleration vector array end subroutine kick_getacch_int_all_tp - module pure subroutine kick_getacch_int_one_pl(rji2, xr, yr, zr, Gmi, Gmj, axi, ayi, azi, axj, ayj, azj) + pure module subroutine kick_getacch_int_one_pl(rji2, xr, yr, zr, Gmi, Gmj, axi, ayi, azi, axj, ayj, azj) !$omp declare simd(kick_getacch_int_one_pl) implicit none real(DP), intent(in) :: rji2 !! Square of distance between the two bodies @@ -880,7 +880,7 @@ module pure subroutine kick_getacch_int_one_pl(rji2, xr, yr, zr, Gmi, Gmj, axi, real(DP), intent(inout) :: axj, ayj, azj !! Acceleration vector components of body j end subroutine kick_getacch_int_one_pl - module pure subroutine kick_getacch_int_one_tp(rji2, xr, yr, zr, Gmpl, ax, ay, az) + pure module subroutine kick_getacch_int_one_tp(rji2, xr, yr, zr, Gmpl, ax, ay, az) !$omp declare simd(kick_getacch_int_one_tp) implicit none real(DP), intent(in) :: rji2 !! Square of distance between the test particle and massive body @@ -1006,14 +1006,14 @@ module subroutine orbel_el2xv_vec(self, cb) class(swiftest_cb), intent(inout) :: cb !! Swiftest central body object end subroutine orbel_el2xv_vec - module pure subroutine orbel_scget(angle, sx, cx) + pure module subroutine orbel_scget(angle, sx, cx) !$omp declare simd(orbel_scget) implicit none real(DP), intent(in) :: angle real(DP), intent(out) :: sx, cx end subroutine orbel_scget - module pure subroutine orbel_xv2aeq(mu, px, py, pz, vx, vy, vz, a, e, q) + pure module subroutine orbel_xv2aeq(mu, px, py, pz, vx, vy, vz, a, e, q) !$omp declare simd(orbel_xv2aeq) implicit none real(DP), intent(in) :: mu !! Gravitational constant @@ -1024,7 +1024,7 @@ module pure subroutine orbel_xv2aeq(mu, px, py, pz, vx, vy, vz, a, e, q) real(DP), intent(out) :: q !! periapsis end subroutine orbel_xv2aeq - module pure subroutine orbel_xv2aqt(mu, px, py, pz, vx, vy, vz, a, q, capm, tperi) + pure module subroutine orbel_xv2aqt(mu, px, py, pz, vx, vy, vz, a, q, capm, tperi) !$omp declare simd(orbel_xv2aqt) implicit none real(DP), intent(in) :: mu !! Gravitational constant @@ -1036,7 +1036,7 @@ module pure subroutine orbel_xv2aqt(mu, px, py, pz, vx, vy, vz, a, q, capm, tper real(DP), intent(out) :: tperi !! time of pericenter passage end subroutine orbel_xv2aqt - module pure subroutine orbel_xv2el(mu, px, py, pz, vx, vy, vz, a, e, inc, capom, omega, capm) + pure module subroutine orbel_xv2el(mu, px, py, pz, vx, vy, vz, a, e, inc, capom, omega, capm) implicit none real(DP), intent(in) :: mu !! Gravitational constant real(DP), intent(in) :: px,py,pz !! Position vector @@ -1361,7 +1361,7 @@ end subroutine util_fill_arr_logical end interface interface - module pure subroutine util_flatten_eucl_ij_to_k(n, i, j, k) + pure module subroutine util_flatten_eucl_ij_to_k(n, i, j, k) !$omp declare simd(util_flatten_eucl_ij_to_k) implicit none integer(I4B), intent(in) :: n !! Number of bodies @@ -1370,7 +1370,7 @@ module pure subroutine util_flatten_eucl_ij_to_k(n, i, j, k) integer(I8B), intent(out) :: k !! Index of the flattened matrix end subroutine util_flatten_eucl_ij_to_k - module pure subroutine util_flatten_eucl_k_to_ij(n, k, i, j) + pure module subroutine util_flatten_eucl_k_to_ij(n, k, i, j) implicit none integer(I4B), intent(in) :: n !! Number of bodies integer(I8B), intent(in) :: k !! Index of the flattened matrix @@ -1596,46 +1596,46 @@ end function util_solve_rkf45 end interface interface util_sort - module pure subroutine util_sort_i4b(arr) + pure module subroutine util_sort_i4b(arr) implicit none integer(I4B), dimension(:), intent(inout) :: arr end subroutine util_sort_i4b - module pure subroutine util_sort_index_i4b(arr,ind) + pure module subroutine util_sort_index_i4b(arr,ind) implicit none integer(I4B), dimension(:), intent(in) :: arr integer(I4B), dimension(:), allocatable, intent(inout) :: ind end subroutine util_sort_index_i4b - module pure subroutine util_sort_index_I4B_I8Bind(arr,ind) + pure module subroutine util_sort_index_I4B_I8Bind(arr,ind) implicit none integer(I4B), dimension(:), intent(in) :: arr integer(I8B), dimension(:), allocatable, intent(inout) :: ind end subroutine util_sort_index_I4b_I8Bind - module pure subroutine util_sort_index_I8B_I8Bind(arr,ind) + pure module subroutine util_sort_index_I8B_I8Bind(arr,ind) implicit none integer(I8B), dimension(:), intent(in) :: arr integer(I8B), dimension(:), allocatable, intent(inout) :: ind end subroutine util_sort_index_I8B_I8Bind - module pure subroutine util_sort_sp(arr) + pure module subroutine util_sort_sp(arr) implicit none real(SP), dimension(:), intent(inout) :: arr end subroutine util_sort_sp - module pure subroutine util_sort_index_sp(arr,ind) + pure module subroutine util_sort_index_sp(arr,ind) implicit none real(SP), dimension(:), intent(in) :: arr integer(I4B), dimension(:), allocatable, intent(inout) :: ind end subroutine util_sort_index_sp - module pure subroutine util_sort_dp(arr) + pure module subroutine util_sort_dp(arr) implicit none real(DP), dimension(:), intent(inout) :: arr end subroutine util_sort_dp - module pure subroutine util_sort_index_dp(arr,ind) + pure module subroutine util_sort_index_dp(arr,ind) implicit none real(DP), dimension(:), intent(in) :: arr integer(I4B), dimension(:), allocatable, intent(inout) :: ind @@ -1643,35 +1643,35 @@ end subroutine util_sort_index_dp end interface util_sort interface util_sort_rearrange - module pure subroutine util_sort_rearrange_arr_char_string(arr, ind, n) + pure module subroutine util_sort_rearrange_arr_char_string(arr, ind, n) implicit none character(len=STRMAX), dimension(:), allocatable, intent(inout) :: arr !! Destination array integer(I4B), dimension(:), intent(in) :: ind !! Index to rearrange against integer(I4B), intent(in) :: n !! Number of elements in arr and ind to rearrange end subroutine util_sort_rearrange_arr_char_string - module pure subroutine util_sort_rearrange_arr_DP(arr, ind, n) + pure module subroutine util_sort_rearrange_arr_DP(arr, ind, n) implicit none real(DP), dimension(:), allocatable, intent(inout) :: arr !! Destination array integer(I4B), dimension(:), intent(in) :: ind !! Index to rearrange against integer(I4B), intent(in) :: n !! Number of elements in arr and ind to rearrange end subroutine util_sort_rearrange_arr_DP - module pure subroutine util_sort_rearrange_arr_DPvec(arr, ind, n) + pure module subroutine util_sort_rearrange_arr_DPvec(arr, ind, n) implicit none real(DP), dimension(:,:), allocatable, intent(inout) :: arr !! Destination array integer(I4B), dimension(:), intent(in) :: ind !! Index to rearrange against integer(I4B), intent(in) :: n !! Number of elements in arr and ind to rearrange end subroutine util_sort_rearrange_arr_DPvec - module pure subroutine util_sort_rearrange_arr_I4B(arr, ind, n) + pure module subroutine util_sort_rearrange_arr_I4B(arr, ind, n) implicit none integer(I4B), dimension(:), allocatable, intent(inout) :: arr !! Destination array integer(I4B), dimension(:), intent(in) :: ind !! Index to rearrange against integer(I4B), intent(in) :: n !! Number of elements in arr and ind to rearrange end subroutine util_sort_rearrange_arr_I4B - module pure subroutine util_sort_rearrange_arr_I4B_I8Bind(arr, ind, n) + pure module subroutine util_sort_rearrange_arr_I4B_I8Bind(arr, ind, n) implicit none integer(I4B), dimension(:), allocatable, intent(inout) :: arr !! Destination array integer(I8B), dimension(:), intent(in) :: ind !! Index to rearrange against @@ -1685,14 +1685,14 @@ module subroutine util_sort_rearrange_arr_info(arr, ind, n) integer(I4B), intent(in) :: n !! Number of elements in arr and ind to rearrange end subroutine util_sort_rearrange_arr_info - module pure subroutine util_sort_rearrange_arr_logical(arr, ind, n) + pure module subroutine util_sort_rearrange_arr_logical(arr, ind, n) implicit none logical, dimension(:), allocatable, intent(inout) :: arr !! Destination array integer(I4B), dimension(:), intent(in) :: ind !! Index to rearrange against integer(I4B), intent(in) :: n !! Number of elements in arr and ind to rearrange end subroutine util_sort_rearrange_arr_logical - module pure subroutine util_sort_rearrange_arr_logical_I8Bind(arr, ind, n) + pure module subroutine util_sort_rearrange_arr_logical_I8Bind(arr, ind, n) implicit none logical, dimension(:), allocatable, intent(inout) :: arr !! Destination array integer(I8B), dimension(:), intent(in) :: ind !! Index to rearrange against diff --git a/src/modules/swiftest_operators.f90 b/src/modules/swiftest_operators.f90 index 13cb57839..770bc0047 100644 --- a/src/modules/swiftest_operators.f90 +++ b/src/modules/swiftest_operators.f90 @@ -14,92 +14,92 @@ module swiftest_operators !******************************************************************************************************************************** interface operator(.cross.) - module pure function operator_cross_sp(A, B) result(C) + pure module function operator_cross_sp(A, B) result(C) !$omp declare simd(operator_cross_sp) implicit none real(SP), dimension(:), intent(in) :: A, B real(SP), dimension(3) :: C end function operator_cross_sp - module pure function operator_cross_dp(A, B) result(C) + pure module function operator_cross_dp(A, B) result(C) !$omp declare simd(operator_cross_dp) implicit none real(DP), dimension(:), intent(in) :: A, B real(DP), dimension(3) :: C end function operator_cross_dp - module pure function operator_cross_qp(A, B) result(C) + pure module function operator_cross_qp(A, B) result(C) !$omp declare simd(operator_cross_qp) implicit none real(QP), dimension(:), intent(in) :: A, B real(QP), dimension(3) :: C end function operator_cross_qp - module pure function operator_cross_i1b(A, B) result(C) + pure module function operator_cross_i1b(A, B) result(C) !$omp declare simd(operator_cross_i1b) implicit none integer(I1B), dimension(:), intent(in) :: A, B integer(I1B), dimension(3) :: C end function operator_cross_i1b - module pure function operator_cross_i2b(A, B) result(C) + pure module function operator_cross_i2b(A, B) result(C) !$omp declare simd(operator_cross_i2b) implicit none integer(I2B), dimension(:), intent(in) :: A, B integer(I2B), dimension(3) :: C end function operator_cross_i2b - module pure function operator_cross_i4b(A, B) result(C) + pure module function operator_cross_i4b(A, B) result(C) !$omp declare simd(operator_cross_i4b) implicit none integer(I4B), dimension(:), intent(in) :: A, B integer(I4B), dimension(3) :: C end function operator_cross_i4b - module pure function operator_cross_i8b(A, B) result(C) + pure module function operator_cross_i8b(A, B) result(C) !$omp declare simd(operator_cross_i8b) implicit none integer(I8B), dimension(:), intent(in) :: A, B integer(I8B), dimension(3) :: C end function operator_cross_i8b - module pure function operator_cross_el_sp(A, B) result(C) + pure module function operator_cross_el_sp(A, B) result(C) implicit none real(SP), dimension(:,:), intent(in) :: A, B real(SP), dimension(:,:), allocatable :: C end function operator_cross_el_sp - module pure function operator_cross_el_dp(A, B) result(C) + pure module function operator_cross_el_dp(A, B) result(C) implicit none real(DP), dimension(:,:), intent(in) :: A, B real(DP), dimension(:,:), allocatable :: C end function operator_cross_el_dp - module pure function operator_cross_el_qp(A, B) result(C) + pure module function operator_cross_el_qp(A, B) result(C) implicit none real(QP), dimension(:,:), intent(in) :: A, B real(QP), dimension(:,:), allocatable :: C end function operator_cross_el_qp - module pure function operator_cross_el_i1b(A, B) result(C) + pure module function operator_cross_el_i1b(A, B) result(C) implicit none integer(I1B), dimension(:,:), intent(in) :: A, B integer(I1B), dimension(:,:), allocatable :: C end function operator_cross_el_i1b - module pure function operator_cross_el_i2b(A, B) result(C) + pure module function operator_cross_el_i2b(A, B) result(C) implicit none integer(I2B), dimension(:,:), intent(in) :: A, B integer(I2B), dimension(:,:), allocatable :: C end function operator_cross_el_i2b - module pure function operator_cross_el_i4b(A, B) result(C) + pure module function operator_cross_el_i4b(A, B) result(C) implicit none integer(I4B), dimension(:,:), intent(in) :: A, B integer(I4B), dimension(:,:), allocatable :: C end function operator_cross_el_i4b - module pure function operator_cross_el_i8b(A, B) result(C) + pure module function operator_cross_el_i8b(A, B) result(C) implicit none integer(I8B), dimension(:,:), intent(in) :: A, B integer(I8B), dimension(:,:), allocatable :: C @@ -111,40 +111,40 @@ end function operator_cross_el_i8b !******************************************************************************************************************************** interface operator(.mag.) - module pure function operator_mag_sp(A) result(B) + pure module function operator_mag_sp(A) result(B) !$omp declare simd(operator_mag_sp) implicit none real(SP), dimension(:), intent(in) :: A real(SP) :: B end function operator_mag_sp - module pure function operator_mag_dp(A) result(B) + pure module function operator_mag_dp(A) result(B) !$omp declare simd(operator_mag_dp) implicit none real(DP), dimension(:), intent(in) :: A real(DP) :: B end function operator_mag_dp - module pure function operator_mag_qp(A) result(B) + pure module function operator_mag_qp(A) result(B) !$omp declare simd(operator_mag_qp) implicit none real(QP), dimension(:), intent(in) :: A real(QP) :: B end function operator_mag_qp - module pure function operator_mag_el_sp(A) result(B) + pure module function operator_mag_el_sp(A) result(B) implicit none real(SP), dimension(:,:), intent(in) :: A real(SP), dimension(:), allocatable :: B end function operator_mag_el_sp - module pure function operator_mag_el_dp(A) result(B) + pure module function operator_mag_el_dp(A) result(B) implicit none real(DP), dimension(:,:), intent(in) :: A real(DP), dimension(:), allocatable :: B end function operator_mag_el_dp - module pure function operator_mag_el_qp(A) result(B) + pure module function operator_mag_el_qp(A) result(B) implicit none real(QP), dimension(:,:), intent(in) :: A real(QP), dimension(:), allocatable :: B diff --git a/src/modules/symba_classes.f90 b/src/modules/symba_classes.f90 index a01d60e6a..f501c1f4f 100644 --- a/src/modules/symba_classes.f90 +++ b/src/modules/symba_classes.f90 @@ -306,7 +306,7 @@ module function symba_encounter_check_tp(self, param, system, dt, irec) result(l logical :: lany_encounter !! Returns true if there is at least one close encounter end function symba_encounter_check_tp - module pure subroutine symba_gr_p4_pl(self, system, param, dt) + pure module subroutine symba_gr_p4_pl(self, system, param, dt) use swiftest_classes, only : swiftest_parameters, swiftest_nbody_system implicit none class(symba_pl), intent(inout) :: self !! SyMBA massive body object @@ -315,7 +315,7 @@ module pure subroutine symba_gr_p4_pl(self, system, param, dt) real(DP), intent(in) :: dt !! Step size end subroutine symba_gr_p4_pl - module pure subroutine symba_gr_p4_tp(self, system, param, dt) + pure module subroutine symba_gr_p4_tp(self, system, param, dt) use swiftest_classes, only : swiftest_parameters, swiftest_nbody_system implicit none class(symba_tp), intent(inout) :: self !! SyMBA test particle object diff --git a/src/modules/whm_classes.f90 b/src/modules/whm_classes.f90 index a7cd2f49c..2069564e9 100644 --- a/src/modules/whm_classes.f90 +++ b/src/modules/whm_classes.f90 @@ -156,21 +156,21 @@ module subroutine whm_kick_vh_tp(self, system, param, t, dt, lbeg) logical, intent(in) :: lbeg !! Logical flag indicating whether this is the beginning of the half step or not. end subroutine whm_kick_vh_tp - module pure subroutine whm_gr_kick_getacch_pl(self, param) + pure module subroutine whm_gr_kick_getacch_pl(self, param) use swiftest_classes, only : swiftest_cb, swiftest_parameters implicit none class(whm_pl), intent(inout) :: self !! WHM massive body particle data structure class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters end subroutine whm_gr_kick_getacch_pl - module pure subroutine whm_gr_kick_getacch_tp(self, param) + pure module subroutine whm_gr_kick_getacch_tp(self, param) use swiftest_classes, only : swiftest_cb, swiftest_parameters implicit none class(whm_tp), intent(inout) :: self !! WHM test particle data structure class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters end subroutine whm_gr_kick_getacch_tp - module pure subroutine whm_gr_p4_pl(self, system, param, dt) + pure module subroutine whm_gr_p4_pl(self, system, param, dt) use swiftest_classes, only : swiftest_parameters implicit none class(whm_pl), intent(inout) :: self !! WHM massive body object @@ -179,7 +179,7 @@ module pure subroutine whm_gr_p4_pl(self, system, param, dt) real(DP), intent(in) :: dt !! Step size end subroutine whm_gr_p4_pl - module pure subroutine whm_gr_p4_tp(self, system, param, dt) + pure module subroutine whm_gr_p4_tp(self, system, param, dt) use swiftest_classes, only : swiftest_parameters implicit none class(whm_tp), intent(inout) :: self !! WHM test particle object diff --git a/src/operators/operator_cross.f90 b/src/operators/operator_cross.f90 index 5a9f8fd28..edb802535 100644 --- a/src/operators/operator_cross.f90 +++ b/src/operators/operator_cross.f90 @@ -7,7 +7,7 @@ !! Vector list implementations: C(1:3, :) = A(1:3, :) .cross. B(1:3, :) contains - module pure function operator_cross_sp(A, B) result(C) + pure module function operator_cross_sp(A, B) result(C) implicit none real(SP), dimension(:), intent(in) :: A, B real(SP), dimension(3) :: C @@ -17,7 +17,7 @@ module pure function operator_cross_sp(A, B) result(C) return end function operator_cross_sp - module pure function operator_cross_dp(A, B) result(C) + pure module function operator_cross_dp(A, B) result(C) implicit none real(DP), dimension(:), intent(in) :: A, B real(DP), dimension(3) :: C @@ -27,7 +27,7 @@ module pure function operator_cross_dp(A, B) result(C) return end function operator_cross_dp - module pure function operator_cross_qp(A, B) result(C) + pure module function operator_cross_qp(A, B) result(C) implicit none real(QP), dimension(:), intent(in) :: A, B real(QP), dimension(3) :: C @@ -37,7 +37,7 @@ module pure function operator_cross_qp(A, B) result(C) return end function operator_cross_qp - module pure function operator_cross_i1b(A, B) result(C) + pure module function operator_cross_i1b(A, B) result(C) implicit none integer(I1B), dimension(:), intent(in) :: A, B integer(I1B), dimension(3) :: C @@ -47,7 +47,7 @@ module pure function operator_cross_i1b(A, B) result(C) return end function operator_cross_i1b - module pure function operator_cross_i2b(A, B) result(C) + pure module function operator_cross_i2b(A, B) result(C) implicit none integer(I2B), dimension(:), intent(in) :: A, B integer(I2B), dimension(3) :: C @@ -57,7 +57,7 @@ module pure function operator_cross_i2b(A, B) result(C) return end function operator_cross_i2b - module pure function operator_cross_i4b(A, B) result(C) + pure module function operator_cross_i4b(A, B) result(C) implicit none integer(I4B), dimension(:), intent(in) :: A, B integer(I4B), dimension(3) :: C @@ -67,7 +67,7 @@ module pure function operator_cross_i4b(A, B) result(C) return end function operator_cross_i4b - module pure function operator_cross_i8b(A, B) result(C) + pure module function operator_cross_i8b(A, B) result(C) implicit none integer(I8B), dimension(:), intent(in) :: A, B integer(I8B), dimension(3) :: C @@ -77,7 +77,7 @@ module pure function operator_cross_i8b(A, B) result(C) return end function operator_cross_i8b - module pure function operator_cross_el_sp(A, B) result(C) + pure module function operator_cross_el_sp(A, B) result(C) implicit none real(SP), dimension(:,:), intent(in) :: A, B real(SP), dimension(:,:), allocatable :: C @@ -91,7 +91,7 @@ module pure function operator_cross_el_sp(A, B) result(C) return end function operator_cross_el_sp - module pure function operator_cross_el_dp(A, B) result(C) + pure module function operator_cross_el_dp(A, B) result(C) implicit none real(DP), dimension(:,:), intent(in) :: A, B real(DP), dimension(:,:), allocatable :: C @@ -105,7 +105,7 @@ module pure function operator_cross_el_dp(A, B) result(C) return end function operator_cross_el_dp - module pure function operator_cross_el_qp(A, B) result(C) + pure module function operator_cross_el_qp(A, B) result(C) implicit none real(QP), dimension(:,:), intent(in) :: A, B real(QP), dimension(:,:), allocatable :: C @@ -119,7 +119,7 @@ module pure function operator_cross_el_qp(A, B) result(C) return end function operator_cross_el_qp - module pure function operator_cross_el_i1b(A, B) result(C) + pure module function operator_cross_el_i1b(A, B) result(C) implicit none integer(I1B), dimension(:,:), intent(in) :: A, B integer(I1B), dimension(:,:), allocatable :: C @@ -133,7 +133,7 @@ module pure function operator_cross_el_i1b(A, B) result(C) return end function operator_cross_el_i1b - module pure function operator_cross_el_i2b(A, B) result(C) + pure module function operator_cross_el_i2b(A, B) result(C) implicit none integer(I2B), dimension(:,:), intent(in) :: A, B integer(I2B), dimension(:,:), allocatable :: C @@ -147,7 +147,7 @@ module pure function operator_cross_el_i2b(A, B) result(C) return end function operator_cross_el_i2b - module pure function operator_cross_el_i4b(A, B) result(C) + pure module function operator_cross_el_i4b(A, B) result(C) implicit none integer(I4B), dimension(:,:), intent(in) :: A, B integer(I4B), dimension(:,:), allocatable :: C @@ -161,7 +161,7 @@ module pure function operator_cross_el_i4b(A, B) result(C) return end function operator_cross_el_i4b - module pure function operator_cross_el_i8b(A, B) result(C) + pure module function operator_cross_el_i8b(A, B) result(C) implicit none integer(I8B), dimension(:,:), intent(in) :: A, B integer(I8B), dimension(:,:), allocatable :: C diff --git a/src/operators/operator_mag.f90 b/src/operators/operator_mag.f90 index 5a054d5ce..92c19cb4b 100644 --- a/src/operators/operator_mag.f90 +++ b/src/operators/operator_mag.f90 @@ -6,7 +6,7 @@ !! Vector list implementations: B(:) = .mag. A(1:3, :) contains - module pure function operator_mag_sp(A) result(B) + pure module function operator_mag_sp(A) result(B) implicit none real(SP), dimension(:), intent(in) :: A real(SP) :: B @@ -14,7 +14,7 @@ module pure function operator_mag_sp(A) result(B) return end function operator_mag_sp - module pure function operator_mag_dp(A) result(B) + pure module function operator_mag_dp(A) result(B) implicit none real(DP), dimension(:), intent(in) :: A real(DP) :: B @@ -22,7 +22,7 @@ module pure function operator_mag_dp(A) result(B) return end function operator_mag_dp - module pure function operator_mag_el_sp(A) result(B) + pure module function operator_mag_el_sp(A) result(B) implicit none real(SP), dimension(:,:), intent(in) :: A real(SP), dimension(:), allocatable :: B @@ -36,7 +36,7 @@ module pure function operator_mag_el_sp(A) result(B) return end function operator_mag_el_sp - module pure function operator_mag_el_dp(A) result(B) + pure module function operator_mag_el_dp(A) result(B) implicit none real(DP), dimension(:,:), intent(in) :: A real(DP), dimension(:), allocatable :: B @@ -50,7 +50,7 @@ module pure function operator_mag_el_dp(A) result(B) return end function operator_mag_el_dp - module pure function operator_mag_el_qp(A) result(B) + pure module function operator_mag_el_qp(A) result(B) implicit none real(QP), dimension(:,:), intent(in) :: A real(QP), dimension(:), allocatable :: B diff --git a/src/orbel/orbel.f90 b/src/orbel/orbel.f90 index e35d1e20f..31f7f23c3 100644 --- a/src/orbel/orbel.f90 +++ b/src/orbel/orbel.f90 @@ -128,7 +128,7 @@ pure subroutine orbel_el2xv(mu, a, ie, inc, capom, omega, capm, x, v) end subroutine orbel_el2xv - module pure subroutine orbel_scget(angle, sx, cx) + pure module subroutine orbel_scget(angle, sx, cx) !! author: David A. Minton !! !! Efficiently compute the sine and cosine of an input angle @@ -683,7 +683,7 @@ real(DP) pure function orbel_fhybrid(e,n) end function orbel_fhybrid - module pure subroutine orbel_xv2aeq(mu, px, py, pz, vx, vy, vz, a, e, q) + pure module subroutine orbel_xv2aeq(mu, px, py, pz, vx, vy, vz, a, e, q) !! author: David A. Minton !! !! Compute semimajor axis, eccentricity, and pericentric distance from relative Cartesian position and velocity @@ -748,7 +748,7 @@ module pure subroutine orbel_xv2aeq(mu, px, py, pz, vx, vy, vz, a, e, q) end subroutine orbel_xv2aeq - module pure subroutine orbel_xv2aqt(mu, px, py, pz, vx, vy, vz, a, q, capm, tperi) + pure module subroutine orbel_xv2aqt(mu, px, py, pz, vx, vy, vz, a, q, capm, tperi) !! author: David A. Minton !! !! Compute semimajor axis, pericentric distance, mean anomaly, and time to nearest pericenter passage from @@ -888,7 +888,7 @@ module subroutine orbel_xv2el_vec(self, cb) end subroutine orbel_xv2el_vec - module pure subroutine orbel_xv2el(mu, px, py, pz, vx, vy, vz, a, e, inc, capom, omega, capm) + pure module subroutine orbel_xv2el(mu, px, py, pz, vx, vy, vz, a, e, inc, capom, omega, capm) !! author: David A. Minton !! !! Compute osculating orbital elements from relative Cartesian position and velocity diff --git a/src/symba/symba_gr.f90 b/src/symba/symba_gr.f90 index f743b124a..6340bd429 100644 --- a/src/symba/symba_gr.f90 +++ b/src/symba/symba_gr.f90 @@ -2,7 +2,7 @@ use swiftest contains - module pure subroutine symba_gr_p4_pl(self, system, param, dt) + pure module subroutine symba_gr_p4_pl(self, system, param, dt) !! author: David A. Minton !! !! Position kick to massive bodies due to p**4 term in the post-Newtonian correction @@ -31,7 +31,7 @@ module pure subroutine symba_gr_p4_pl(self, system, param, dt) end subroutine symba_gr_p4_pl - module pure subroutine symba_gr_p4_tp(self, system, param, dt) + pure module subroutine symba_gr_p4_tp(self, system, param, dt) !! author: David A. Minton !! !! Position kick to test particles due to p**4 term in the post-Newtonian correction diff --git a/src/util/util_flatten.f90 b/src/util/util_flatten.f90 index 1f6f60fe6..5305b2fe7 100644 --- a/src/util/util_flatten.f90 +++ b/src/util/util_flatten.f90 @@ -2,7 +2,7 @@ use swiftest contains - module pure subroutine util_flatten_eucl_ij_to_k(n, i, j, k) + pure module subroutine util_flatten_eucl_ij_to_k(n, i, j, k) !! author: Jacob R. Elliott and David A. Minton !! !! Turns i,j indices into k index for use in the Euclidean distance matrix for pl-pl interactions. @@ -29,7 +29,7 @@ module pure subroutine util_flatten_eucl_ij_to_k(n, i, j, k) end subroutine util_flatten_eucl_ij_to_k - module pure subroutine util_flatten_eucl_k_to_ij(n, k, i, j) + pure module subroutine util_flatten_eucl_k_to_ij(n, k, i, j) !! author: Jacob R. Elliott and David A. Minton !! !! Turns k index into i,j indices for use in the Euclidean distance matrix for pl-pl interactions. diff --git a/src/util/util_sort.f90 b/src/util/util_sort.f90 index 453c3a2d3..ebc6223c4 100644 --- a/src/util/util_sort.f90 +++ b/src/util/util_sort.f90 @@ -57,7 +57,7 @@ module subroutine util_sort_body(self, sortby, ascending) end subroutine util_sort_body - module pure subroutine util_sort_dp(arr) + pure module subroutine util_sort_dp(arr) !! author: David A. Minton !! !! Sort input DP precision array in place into ascending numerical order using quicksort. @@ -72,7 +72,7 @@ module pure subroutine util_sort_dp(arr) end subroutine util_sort_dp - module pure subroutine util_sort_index_dp(arr, ind) + pure module subroutine util_sort_index_dp(arr, ind) !! author: David A. Minton !! !! Sort input DP precision array by index in ascending numerical order using quick sort. @@ -186,7 +186,7 @@ pure subroutine partition_DP(arr, marker, ind) end subroutine partition_DP - module pure subroutine util_sort_i4b(arr) + pure module subroutine util_sort_i4b(arr) !! author: David A. Minton !! !! Sort input integer array in place into ascending numerical order using quick sort. @@ -202,7 +202,7 @@ module pure subroutine util_sort_i4b(arr) end subroutine util_sort_i4b - module pure subroutine util_sort_index_I4B(arr, ind) + pure module subroutine util_sort_index_I4B(arr, ind) !! author: David A. Minton !! !! Sort input integer array by index in ascending numerical order using quicksort. @@ -230,7 +230,7 @@ module pure subroutine util_sort_index_I4B(arr, ind) end subroutine util_sort_index_I4B - module pure subroutine util_sort_index_I4B_I8Bind(arr, ind) + pure module subroutine util_sort_index_I4B_I8Bind(arr, ind) !! author: David A. Minton !! !! Sort input integer array by index in ascending numerical order using quicksort. @@ -510,7 +510,7 @@ pure subroutine partition_I8B_I8Bind(arr, marker, ind) end subroutine partition_I8B_I8Bind - module pure subroutine util_sort_sp(arr) + pure module subroutine util_sort_sp(arr) !! author: David A. Minton !! !! Sort input DP precision array in place into ascending numerical order using quicksort. @@ -525,7 +525,7 @@ module pure subroutine util_sort_sp(arr) end subroutine util_sort_sp - module pure subroutine util_sort_index_sp(arr, ind) + pure module subroutine util_sort_index_sp(arr, ind) !! author: David A. Minton !! !! Sort input DP precision array by index in ascending numerical order using quicksort. @@ -774,7 +774,7 @@ module subroutine util_sort_rearrange_body(self, ind) end subroutine util_sort_rearrange_body - module pure subroutine util_sort_rearrange_arr_char_string(arr, ind, n) + pure module subroutine util_sort_rearrange_arr_char_string(arr, ind, n) !! author: David A. Minton !! !! Rearrange a single array of character string in-place from an index list. @@ -795,7 +795,7 @@ module pure subroutine util_sort_rearrange_arr_char_string(arr, ind, n) end subroutine util_sort_rearrange_arr_char_string - module pure subroutine util_sort_rearrange_arr_DP(arr, ind, n) + pure module subroutine util_sort_rearrange_arr_DP(arr, ind, n) !! author: David A. Minton !! !! Rearrange a single array of DP type in-place from an index list. @@ -816,7 +816,7 @@ module pure subroutine util_sort_rearrange_arr_DP(arr, ind, n) end subroutine util_sort_rearrange_arr_DP - module pure subroutine util_sort_rearrange_arr_DPvec(arr, ind, n) + pure module subroutine util_sort_rearrange_arr_DPvec(arr, ind, n) !! author: David A. Minton !! !! Rearrange a single array of (NDIM,n) DP-type vectors in-place from an index list. @@ -837,7 +837,7 @@ module pure subroutine util_sort_rearrange_arr_DPvec(arr, ind, n) end subroutine util_sort_rearrange_arr_DPvec - module pure subroutine util_sort_rearrange_arr_I4B(arr, ind, n) + pure module subroutine util_sort_rearrange_arr_I4B(arr, ind, n) !! author: David A. Minton !! !! Rearrange a single array of integers in-place from an index list. @@ -857,7 +857,7 @@ module pure subroutine util_sort_rearrange_arr_I4B(arr, ind, n) return end subroutine util_sort_rearrange_arr_I4B - module pure subroutine util_sort_rearrange_arr_I4B_I8Bind(arr, ind, n) + pure module subroutine util_sort_rearrange_arr_I4B_I8Bind(arr, ind, n) !! author: David A. Minton !! !! Rearrange a single array of integers in-place from an index list. @@ -878,7 +878,7 @@ module pure subroutine util_sort_rearrange_arr_I4B_I8Bind(arr, ind, n) end subroutine util_sort_rearrange_arr_I4B_I8Bind - module pure subroutine util_sort_rearrange_arr_logical(arr, ind, n) + pure module subroutine util_sort_rearrange_arr_logical(arr, ind, n) !! author: David A. Minton !! !! Rearrange a single array of logicals in-place from an index list. @@ -899,7 +899,7 @@ module pure subroutine util_sort_rearrange_arr_logical(arr, ind, n) end subroutine util_sort_rearrange_arr_logical - module pure subroutine util_sort_rearrange_arr_logical_I8Bind(arr, ind, n) + pure module subroutine util_sort_rearrange_arr_logical_I8Bind(arr, ind, n) !! author: David A. Minton !! !! Rearrange a single array of logicals in-place from an index list. diff --git a/src/whm/whm_gr.f90 b/src/whm/whm_gr.f90 index 12ae82a35..36ca5629e 100644 --- a/src/whm/whm_gr.f90 +++ b/src/whm/whm_gr.f90 @@ -2,7 +2,7 @@ use swiftest contains - module pure subroutine whm_gr_kick_getacch_pl(self, param) + pure module subroutine whm_gr_kick_getacch_pl(self, param) !! author: David A. Minton !! !! Compute relativisitic accelerations of massive bodies @@ -35,7 +35,7 @@ module pure subroutine whm_gr_kick_getacch_pl(self, param) end subroutine whm_gr_kick_getacch_pl - module pure subroutine whm_gr_kick_getacch_tp(self, param) + pure module subroutine whm_gr_kick_getacch_tp(self, param) !! author: David A. Minton !! !! Compute relativisitic accelerations of test particles @@ -61,7 +61,7 @@ module pure subroutine whm_gr_kick_getacch_tp(self, param) end subroutine whm_gr_kick_getacch_tp - module pure subroutine whm_gr_p4_pl(self, system, param, dt) + pure module subroutine whm_gr_p4_pl(self, system, param, dt) !! author: David A. Minton !! !! Position kick to massive bodies due to p**4 term in the post-Newtonian correction @@ -88,7 +88,7 @@ module pure subroutine whm_gr_p4_pl(self, system, param, dt) end subroutine whm_gr_p4_pl - module pure subroutine whm_gr_p4_tp(self, system, param, dt) + pure module subroutine whm_gr_p4_tp(self, system, param, dt) !! author: David A. Minton !! !! Position kick to test particles due to p**4 term in the post-Newtonian correction From 81fde886c96fc1e91185f24daa298906e4439668 Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Mon, 17 Oct 2022 12:08:44 -0400 Subject: [PATCH 23/27] module elemental > elemental module --- src/drift/drift.f90 | 2 +- src/encounter/encounter_check.f90 | 2 +- src/modules/encounter_classes.f90 | 2 +- src/modules/swiftest_classes.f90 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/drift/drift.f90 b/src/drift/drift.f90 index a5b7631c9..3acc88609 100644 --- a/src/drift/drift.f90 +++ b/src/drift/drift.f90 @@ -92,7 +92,7 @@ module subroutine drift_all(mu, x, v, n, param, dt, lmask, iflag) end subroutine drift_all - module pure elemental subroutine drift_one(mu, px, py, pz, vx, vy, vz, dt, iflag) + pure elemental module subroutine drift_one(mu, px, py, pz, vx, vy, vz, dt, iflag) !! author: The Purdue Swiftest Team - David A. Minton, Carlisle A. Wishard, Jennifer L.L. Pouplin, and Jacob R. Elliott !! !! Perform Danby drift for one body, redoing drift with smaller substeps if original accuracy is insufficient diff --git a/src/encounter/encounter_check.f90 b/src/encounter/encounter_check.f90 index 8acbc4315..e790abf5a 100644 --- a/src/encounter/encounter_check.f90 +++ b/src/encounter/encounter_check.f90 @@ -683,7 +683,7 @@ subroutine encounter_check_all_triangular_pltp(npl, ntp, xpl, vpl, xtp, vtp, ren end subroutine encounter_check_all_triangular_pltp - module elemental subroutine encounter_check_one(xr, yr, zr, vxr, vyr, vzr, renc, dt, lencounter, lvdotr) + elemental module subroutine encounter_check_one(xr, yr, zr, vxr, vyr, vzr, renc, dt, lencounter, lvdotr) !! author: David A. Minton !! !! Determine whether a test particle and planet are having or will have an encounter within the next time step diff --git a/src/modules/encounter_classes.f90 b/src/modules/encounter_classes.f90 index 39b88ae05..17f7ea0ad 100644 --- a/src/modules/encounter_classes.f90 +++ b/src/modules/encounter_classes.f90 @@ -107,7 +107,7 @@ module subroutine encounter_check_all_pltp(param, npl, ntp, xpl, vpl, xtp, vtp, logical, dimension(:), allocatable, intent(out) :: lvdotr !! Logical flag indicating the sign of v .dot. x end subroutine encounter_check_all_pltp - module elemental subroutine encounter_check_one(xr, yr, zr, vxr, vyr, vzr, renc, dt, lencounter, lvdotr) + elemental module subroutine encounter_check_one(xr, yr, zr, vxr, vyr, vzr, renc, dt, lencounter, lvdotr) !$omp declare simd(encounter_check_one) implicit none real(DP), intent(in) :: xr, yr, zr !! Relative distance vector components diff --git a/src/modules/swiftest_classes.f90 b/src/modules/swiftest_classes.f90 index d2f1adeef..f64bba576 100644 --- a/src/modules/swiftest_classes.f90 +++ b/src/modules/swiftest_classes.f90 @@ -509,7 +509,7 @@ module subroutine drift_body(self, system, param, dt) real(DP), intent(in) :: dt !! Stepsize end subroutine drift_body - module pure elemental subroutine drift_one(mu, px, py, pz, vx, vy, vz, dt, iflag) + pure elemental module subroutine drift_one(mu, px, py, pz, vx, vy, vz, dt, iflag) !$omp declare simd(drift_one) implicit none real(DP), intent(in) :: mu !! G * (Mcb + m), G = gravitational constant, Mcb = mass of central body, m = mass of body to drift From 97b015d31c49aac5811158eb607a4d9c7c2ea8dc Mon Sep 17 00:00:00 2001 From: Carlisle Wishard Date: Mon, 17 Oct 2022 15:18:33 -0400 Subject: [PATCH 24/27] commented out the netcdf-fortran library --- cmake/Modules/SetUpNetCDF.cmake | 8 ++++---- src/CMakeLists.txt | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/Modules/SetUpNetCDF.cmake b/cmake/Modules/SetUpNetCDF.cmake index eac9cb543..d4ee7d43c 100644 --- a/cmake/Modules/SetUpNetCDF.cmake +++ b/cmake/Modules/SetUpNetCDF.cmake @@ -1,9 +1,9 @@ # Find NetCDF if not already found IF(NOT NETCDF_FOUND) - ENABLE_LANGUAGE(C) # Some libraries need a C compiler to find - FIND_PACKAGE(NETCDF REQUIRED) + ENABLE_LANGUAGE(C) # Some libraries need a C compiler to find + FIND_PACKAGE(netcdf REQUIRED) SET(NETCDF_FOUND TRUE CACHE INTERNAL "NETCDF was found" FORCE) - SET(NETCDFFORTRAN_FOUND TRUE CACHE INTERNAL "NETCDFFORTRAN was found" FORCE) SET(NETCDF_LIBRARIES ${NETCDF_LIBRARIES} CACHE INTERNAL "NETCDF LIBS" FORCE) - SET(NETCDFFORTRAN_LIBRARIES ${NETCDFFORTRAN_LIBRARIES} CACHE INTERNAL "NETCDFFORTRAN LIBS" FORCE) + #SET(NETCDFFORTRAN_FOUND TRUE CACHE INTERNAL "NETCDF-FORTRAN was found" FORCE) + #SET(NETCDFFORTRAN_LIBRARIES ${NETCDFFORTRAN_LIBRARIES} CACHE INTERNAL "NETCDFFORTRAN LIBS" FORCE) ENDIF(NOT NETCDF_FOUND) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 24b545ea2..8af404c73 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -99,8 +99,8 @@ ADD_EXECUTABLE(${FOOEXE} ${FOO_src}) ##################################################### # Uncomment if you need to link to BLAS and LAPACK -TARGET_LINK_LIBRARIES(${FOOEXE} ${NETCDF_LIBRARIES} - ${NETCDFFORTRAN_LIBRARIES}) +TARGET_LINK_LIBRARIES(${FOOEXE} ${NETCDF_LIBRARIES}) + #${NETCDFFORTRAN_LIBRARIES}) # Uncomment if you have parallization IF(USE_OPENMP) From 0f9c026a5dbcbd8d1def0cfbaa10495fb7d9cb06 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Tue, 25 Oct 2022 13:56:09 -0400 Subject: [PATCH 25/27] Fixed cmake to allow for NetCDF libraries to be found --- Makefile.Defines | 84 ------------------------------ Makefile.Defines_example | 90 --------------------------------- bin/.gitignore | 2 - build/.gitignore | 1 - cmake/Modules/FindNETCDF.cmake | 9 ++++ cmake/Modules/SetUpNetCDF.cmake | 6 +-- src/CMakeLists.txt | 34 +++++++------ src/modules/symba_classes.f90 | 2 +- src/symba/symba_step.f90 | 2 +- 9 files changed, 30 insertions(+), 200 deletions(-) delete mode 100644 Makefile.Defines delete mode 100644 Makefile.Defines_example delete mode 100644 bin/.gitignore create mode 100644 cmake/Modules/FindNETCDF.cmake diff --git a/Makefile.Defines b/Makefile.Defines deleted file mode 100644 index c73eb3910..000000000 --- a/Makefile.Defines +++ /dev/null @@ -1,84 +0,0 @@ -#****************************************************************************** -# -# Unit Name : Makefile.Defines -# Unit Type : makefile -# Project : SWIFTEST -# Package : N/A -# Language : GNU makefile syntax -# -# Description : Contains user-modifiable macro definitions used in the build -# process for the Swifter library, drivers and tools, as well as -# the FXDR library -# -# Input -# Arguments : none -# Terminal : none -# File : none -# -# Output -# Arguments : none -# Terminal : none -# File : none -# -# Invocation : include Makefile.Defines (from within another makefile) -# -# Notes : -# -#****************************************************************************** - -# System utilities - -SHELL = /bin/sh -AR = ar -RANLIB = ranlib -INSTALL = install -INSTALL_PROGRAM = $(INSTALL) -m 755 -INSTALL_DATA = $(INSTALL) -m 644 -ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) -# Swifter definitions - -SWIFTEST_HOME = $(ROOT_DIR) -USER_MODULES = -COLLRESOLVE_HOME = $(ROOT_DIR)/collresolve/ - -# Compiler definitions - -# DO NOT include in FFLAGS the "-c" option to compile object only -# this is done explicitly as needed in the Makefile -IDEBUG = -O0 -init=snan,arrays -nogen-interfaces -no-pie -no-ftz -fpe-all=0 -g -traceback -mp1 -qopt-matmul -fp-model strict -fpe0 -debug all -align all -pad -ip -prec-div -prec-sqrt -assume protect-parens -CB -no-wrap-margin -STRICTREAL = -fp-model=precise -prec-div -prec-sqrt -assume protect-parens -SIMDVEC = -simd -xhost -align all -assume contiguous_assumed_shape -vecabi=cmdtarget -fp-model no-except -fma -PAR = -qopenmp -HEAPARR = -heap-arrays 4194304 -OPTREPORT = -qopt-report=5 -IPRODUCTION = -no-wrap-margin -O3 -qopt-prefetch=0 -qopt-matmul -sox $(PAR) $(SIMDVEC) #$(HEAPARR) - -#gfortran flags -GDEBUG = -g -Og -fbacktrace -fbounds-check -ffree-line-length-none -GPAR = -fopenmp -ftree-parallelize-loops=4 -GMEM = -fsanitize-address-use-after-scope -fstack-check -fsanitize=bounds-strict -fsanitize=undefined -fsanitize=signed-integer-overflow -fsanitize=object-size -fstack-protector-all -GWARNINGS = -Wall -Warray-bounds -Wimplicit-interface -Wextra -Warray-temporaries -GPRODUCTION = -O3 -ffree-line-length-none $(GPAR) - -INCLUDES = -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include -I$(MKLROOT)/include -LINKS = -L$(MKLROOT)/lib/intel64 -L$(NETCDF_FORTRAN_HOME)/lib -lswiftest -lnetcdf -lnetcdff -qopt-matmul $(PAR) - -FSTRICTFLAGS = $(IPRODUCTION) $(STRICTREAL) -FFLAGS = $(IPRODUCTION) -fp-model=fast - -FORTRAN = ifort -AR = xiar -CC = icc - -#FORTRAN = gfortran -#FFLAGS = $(GDEBUG) $(GMEM) #$(GPAR) -#FSTRICTFLAGS = $(GDEBUG) $(GMEM) #$(GPAR) -#AR = ar -#CC = cc - -# DO NOT include in CFLAGS the "-c" option to compile object only -# this is done explicitly as needed in the Makefile - -CFLAGS = -O3 -w -m64 -std=c99 - -64_BIT_REALS = -r8 diff --git a/Makefile.Defines_example b/Makefile.Defines_example deleted file mode 100644 index b21710254..000000000 --- a/Makefile.Defines_example +++ /dev/null @@ -1,90 +0,0 @@ -#****************************************************************************** -# -# Unit Name : Makefile.Defines -# Unit Type : makefile -# Project : SWIFTER -# Package : N/A -# Language : GNU makefile syntax -# -# Description : Contains user-modifiable macro definitions used in the build -# process for the Swifter library, drivers and tools, as well as -# the FXDR library -# -# Input -# Arguments : none -# Terminal : none -# File : none -# -# Output -# Arguments : none -# Terminal : none -# File : none -# -# Invocation : include Makefile.Defines (from within another makefile) -# -# Notes : -# -#****************************************************************************** - -# System utilities - -SHELL = /bin/sh -AR = ar -RANLIB = ranlib -INSTALL = install -INSTALL_PROGRAM = $(INSTALL) -m 755 -INSTALL_DATA = $(INSTALL) -m 644 - -# Swifter definitions - -SWIFTER_HOME = # Full path to your Swifter directory goes here -USER_MODULES = - -# Compiler definitions - -# DO NOT include in FFLAGS the "-c" option to compile object only -# this is done explicitly as needed in the Makefile - -#FORTRAN = ifort -#FFLAGS = -O3 -openmp -132 -align all -pad -ip -fp-model strict -prec-div -prec-sqrt -ftz -assume protect-parens - -FORTRAN = gfortran -FFLAGS = -O3 - -# DO NOT include in CFLAGS the "-c" option to compile object only -# this is done explicitly as needed in the Makefile - -CC = cc -CFLAGS = -O - -64_BIT_REALS = -r8 - -# FXDR Makefile compatibility - DO NOT ALTER - -F77CMD = $(FORTRAN) -F77OPTS = $(FFLAGS) -CCCMD = $(CC) -CCOPTS = $(CFLAGS) - -#****************************************************************************** -# -# Author(s) : David E. Kaufmann -# -# Revision Control System (RCS) Information -# -# Source File : $RCSfile: Makefile.Defines,v $ -# Full Path : $Source: /d1/kaufmann/development/RCS/Makefile.Defines,v $ -# Revision : $Revision: 0.1 $ -# Date : $Date: 2003/04/15 22:56:57 $ -# Programmer : $Author: kaufmann $ -# Locked By : $Locker: $ -# State : $State: Exp $ -# -# Modification History: -# -# $Log: Makefile.Defines,v $ -# Revision 0.1 2003/04/15 22:56:57 kaufmann -# Initial implementation -# -# -#****************************************************************************** diff --git a/bin/.gitignore b/bin/.gitignore deleted file mode 100644 index d6b7ef32c..000000000 --- a/bin/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/build/.gitignore b/build/.gitignore index d6b7ef32c..72e8ffc0d 100644 --- a/build/.gitignore +++ b/build/.gitignore @@ -1,2 +1 @@ * -!.gitignore diff --git a/cmake/Modules/FindNETCDF.cmake b/cmake/Modules/FindNETCDF.cmake new file mode 100644 index 000000000..f8e97dbca --- /dev/null +++ b/cmake/Modules/FindNETCDF.cmake @@ -0,0 +1,9 @@ +# - Finds the NetCDF libraries +find_path(NETCDF_INCLUDE_DIR NAMES netcdf.mod HINTS ENV NETCDF_FORTRAN_HOME) +find_library(NETCDF_LIBRARY NAMES netcdf HINTS ENV NETCDF_FORTRAN_HOME) +find_library(NETCDF_FORTRAN_LIBRARY NAMES netcdff HINTS ENV NETCDF_FORTRAN_HOME) + +set(NETCDF_FOUND TRUE) +set(NETCDF_INCLUDE_DIRS ${NETCDF_INCLUDE_DIR}) +set(NETCDF_LIBRARIES ${NETCDF_LIBRARY} ${NETCDF_FORTRAN_LIBRARY}) +mark_as_advanced(NETCDF_LIBRARY NETCDF_FORTRAN_LIBRARY NETCDF_INCLUDE_DIR) \ No newline at end of file diff --git a/cmake/Modules/SetUpNetCDF.cmake b/cmake/Modules/SetUpNetCDF.cmake index d4ee7d43c..dbfe44c4b 100644 --- a/cmake/Modules/SetUpNetCDF.cmake +++ b/cmake/Modules/SetUpNetCDF.cmake @@ -1,9 +1,5 @@ # Find NetCDF if not already found IF(NOT NETCDF_FOUND) ENABLE_LANGUAGE(C) # Some libraries need a C compiler to find - FIND_PACKAGE(netcdf REQUIRED) - SET(NETCDF_FOUND TRUE CACHE INTERNAL "NETCDF was found" FORCE) - SET(NETCDF_LIBRARIES ${NETCDF_LIBRARIES} CACHE INTERNAL "NETCDF LIBS" FORCE) - #SET(NETCDFFORTRAN_FOUND TRUE CACHE INTERNAL "NETCDF-FORTRAN was found" FORCE) - #SET(NETCDFFORTRAN_LIBRARIES ${NETCDFFORTRAN_LIBRARIES} CACHE INTERNAL "NETCDFFORTRAN LIBS" FORCE) + FIND_PACKAGE(NETCDF REQUIRED) ENDIF(NOT NETCDF_FOUND) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8af404c73..5ea24cc0d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,7 +3,20 @@ ######################################## # Add the source files -SET(FOO_src ${SRC}/discard/discard.f90 +SET(FOO_src + ${SRC}/modules/encounter_classes.f90 + ${SRC}/modules/fraggle_classes.f90 + ${SRC}/modules/helio_classes.f90 + ${SRC}/modules/lambda_function.f90 + ${SRC}/modules/rmvs_classes.f90 + ${SRC}/modules/swiftest_classes.f90 + ${SRC}/modules/swiftest_globals.f90 + ${SRC}/modules/swiftest_operators.f90 + ${SRC}/modules/swiftest.f90 + ${SRC}/modules/symba_classes.f90 + ${SRC}/modules/walltime_classes.f90 + ${SRC}/modules/whm_classes.f90 + ${SRC}/discard/discard.f90 ${SRC}/drift/drift.f90 ${SRC}/encounter/encounter_check.f90 ${SRC}/encounter/encounter_io.f90 @@ -25,19 +38,6 @@ SET(FOO_src ${SRC}/discard/discard.f90 ${SRC}/helio/helio_util.f90 ${SRC}/io/io.f90 ${SRC}/kick/kick.f90 - ${SRC}/main/swiftest_driver.f90 - ${SRC}/modules/encounter_classes.f90 - ${SRC}/modules/fraggle_classes.f90 - ${SRC}/modules/helio_classes.f90 - ${SRC}/modules/lambda_function.f90 - ${SRC}/modules/rmvs_classes.f90 - ${SRC}/modules/swiftest_classes.f90 - ${SRC}/modules/swiftest_globals.f90 - ${SRC}/modules/swiftest_operators.f90 - ${SRC}/modules/swiftest.f90 - ${SRC}/modules/symba_classes.f90 - ${SRC}/modules/walltime_classes.f90 - ${SRC}/modules/whm_classes.f90 ${SRC}/netcdf/netcdf.f90 ${SRC}/obl/obl.f90 ${SRC}/operators/operator_cross.f90 @@ -61,6 +61,8 @@ SET(FOO_src ${SRC}/discard/discard.f90 ${SRC}/symba/symba_setup.f90 ${SRC}/symba/symba_step.f90 ${SRC}/symba/symba_util.f90 + ${SRC}/tides/tides_getacch_pl.f90 + ${SRC}/tides/tides_spin_step.f90 ${SRC}/user/user_getacch.f90 ${SRC}/util/util_append.f90 ${SRC}/util/util_coord.f90 @@ -89,6 +91,7 @@ SET(FOO_src ${SRC}/discard/discard.f90 ${SRC}/whm/whm_setup.f90 ${SRC}/whm/whm_step.f90 ${SRC}/whm/whm_util.f90 + ${SRC}/main/swiftest_driver.f90 ) # Define the executable in terms of the source files @@ -99,8 +102,7 @@ ADD_EXECUTABLE(${FOOEXE} ${FOO_src}) ##################################################### # Uncomment if you need to link to BLAS and LAPACK -TARGET_LINK_LIBRARIES(${FOOEXE} ${NETCDF_LIBRARIES}) - #${NETCDFFORTRAN_LIBRARIES}) +TARGET_LINK_LIBRARIES(${FOOEXE} ${NETCDF_LIBRARIES} ${NETCDF_FORTRAN_LIBRARIES}) # Uncomment if you have parallization IF(USE_OPENMP) diff --git a/src/modules/symba_classes.f90 b/src/modules/symba_classes.f90 index f501c1f4f..525013500 100644 --- a/src/modules/symba_classes.f90 +++ b/src/modules/symba_classes.f90 @@ -485,7 +485,7 @@ module subroutine symba_step_set_recur_levels_system(self, ireci) integer(I4B), intent(in) :: ireci !! Input recursion level end subroutine symba_step_set_recur_levels_system - module recursive subroutine symba_step_recur_system(self, param, t, ireci) + recursive module subroutine symba_step_recur_system(self, param, t, ireci) use swiftest_classes, only : swiftest_parameters implicit none class(symba_nbody_system), intent(inout) :: self !! SyMBA nbody system object diff --git a/src/symba/symba_step.f90 b/src/symba/symba_step.f90 index c5e37c576..99c324286 100644 --- a/src/symba/symba_step.f90 +++ b/src/symba/symba_step.f90 @@ -150,7 +150,7 @@ module subroutine symba_step_set_recur_levels_system(self, ireci) end subroutine symba_step_set_recur_levels_system - module recursive subroutine symba_step_recur_system(self, param, t, ireci) + recursive module subroutine symba_step_recur_system(self, param, t, ireci) !! author: David A. Minton !! !! Step interacting planets and active test particles ahead in democratic heliocentric coordinates at the current From cd1bf8d49ede438573d8f5fb094c2f6c1d98084e Mon Sep 17 00:00:00 2001 From: David A Minton Date: Tue, 25 Oct 2022 14:01:20 -0400 Subject: [PATCH 26/27] Added instructions on using cmake --- README.md | 24 ++- README.swifter | 440 ------------------------------------------------- 2 files changed, 23 insertions(+), 441 deletions(-) delete mode 100644 README.swifter diff --git a/README.md b/README.md index d5873e584..b8cf563d6 100644 --- a/README.md +++ b/README.md @@ -1 +1,23 @@ -swifter-omp +## Configuring the build ## + +First create a `build/` directory at the top level of your project and build there. + + $ mkdir build + $ cd build + $ cmake .. + $ make + +When you do this, temporary CMake files will not be created in your `src/` directory. + +As written, this template will allow you to specify one of three different sets of compiler flags. The default is RELEASE. You can change this using to TESTING or DEBUG using + + $ cmake .. -DCMAKE_BUILD_TYPE=DEBUG + +or + + $ cmake .. -DCMAKE_BUILD_TYPE=TESTING + +The Swiftest project requires you to have installed NetCDF and NetCDF Fortran libraries somewher on your system. If the paths to the library and module files aree not located in standard paths, you can either create an environment variable called NETCDF_FORTRAN_HOME that contains the path to the install location, or when you configure the project you can set the path manually with + + + $ cmake .. -CMAKE_PREFIX_PATH=/path/to/netcdf/ diff --git a/README.swifter b/README.swifter deleted file mode 100644 index df518b08a..000000000 --- a/README.swifter +++ /dev/null @@ -1,440 +0,0 @@ -******************************************************************************* - Swifter README - (A Preliminary User's Guide to Swifter) -******************************************************************************* -Author: David E. Kaufmann -Date : 01 September 2005 - - INTRODUCTION - - The Swifter subroutine package provided here is designed to integrate a -set of mutually gravitationally interacting massive bodies together with a -group of massless test particles which feel the gravitational influence of the -massive bodies but do not affect each other or the massive bodies. (NOTE: the -SyMBA integrator supports a second class of massive bodies whose masses are -less than some user-specified value, MTINY. These bodies gravitationally -affect and are affected by the more massive bodies, but do not interact with -themselves.) Seven integration techniques are included thus far: - - 1) Wisdom-Holman Mapping (WHM). This is the N-body mapping - method of Wisdom & Holman (1991; AJ, 102, 1528). - 2) Regularized Mixed Variable Symplectic (RMVS) method. This is an - extension of WHM that handles close approaches between test - particles and massive bodies. See Levison & Duncan (1994; Icarus, - 108, 18). - 3) Democratic Heliocentric (DH, or HELIO) method. This is a basic - symplectic integrator (i.e., no close encounters) that uses - democratic heliocentric coordinates. See Duncan, Levison, & Lee - (1998; AJ, 116, 2067). - 4) Symplectic Massive Body Algorithm (SyMBA). This is an extension - of HELIO that handles close approaches between massive bodies - (with mass greater than or equal to MTINY) and any other type of - object (massive body of any mass or massless test particle). This - algorithm is also described in Duncan, Levison, & Lee (1998). See - also Levison & Duncan (2000; AJ, 120, 2117). - 5) A fourth-order T+U Symplectic (TU4) method. This is the T+U - method of Candy & Rozmus (1991; J. Comp. Phys., 92, 230). Also - see Gladman, Duncan, & Candy (1991; CeMDA, 52, 221). - 6) A nonsymplectic fifteenth-order integrator that uses Gauss-Radau - spacings (RA15). This algorithm is described by Everhart (1985; - ASSL Vol. 115: IAU Colloq. 83: Dynamics of Comets: Their Origin - and Evolution, 185). - 7) A Bulirsch-Stoer (BS) method. This is a Bulirsch-Stoer from - Press, Teukolsky, Vetterling, & Flannery (1992; Numerical Recipes - in FORTRAN). - - In order to get to this file you have presumably obtained, uncompressed -and untar-ed the swifter.tar.Z file. You will now find various files and -subdirectories. Most of the directories contain the subroutines that make up -Swifter. However, fully functional examples of working drivers are found in -the subdirectory "main". The subroutines used are grouped by function in -subdirectories with what we hope to be good internal documentation. - - - COMPILING Swifter - - There is one file that must be edited in order to compile the Swifter -library and drivers. In the top Swifter directory, you will find a file called -"Makefile.Defines". This file contains variable definitions that the "make" -program uses to control the building of the Swifter library and drivers (via -the supplied "Makefile") as well as the FXDR library (via the supplied -"Makefile.fxdr"). (The FXDR library and XDR, the eXternal Data Representation, -are described further at the end of this file.) Edit "Makefile.Defines". You -may have to change the values of: - - SWIFTER_HOME : the top-level Swifter directory (this directory should - be specified by its full pathname) - USER_MODULES : space-separated list of any additional modules that you - write and place in directory $(SWIFTER_HOME)/module for - inclusion in the Swifter library - FORTRAN : the command to run the Fortran 90/95 compiler on your - machine - FFLAGS : the flags you use for your Fortran (NOTE: this flag list - should NOT include the switch, typically "-c", used to - cause the compiler to generate an object file only) - CC : the command to run the C compiler on your machine - CFLAGS : the flags you use for your C (NOTE: this flag list - should NOT include the switch, typically "-c", used to - cause the compiler to generate an object file only) - SHELL : the shell "make" uses to execute commands in a rule (the - default is the Bourne shell "/bin/sh" and should NOT - need to be changed in general) - AR : the library archive command on your machine (the default - is "ar" and should NOT need to be changed in general) - RANLIB : the command to generate an index to a library archive - (the default is "ranlib", which should be available on - most machines; an alternative would be "ar -s") - INSTALL : the command to install a file in a filesystem (the - default is "install" and should NOT need to be changed - in general) - INSTALL_PROGRAM : the command to install an executable file in a - filesystem (the default is "$(INSTALL) -m 755" and - should NOT need to be changed in general) - INSTALL_DATA : the command to install a non-executable file in a - filesystem (the default is "$(INSTALL) -m 644" and - should NOT need to be changed in general) - - Also present in "Makefile.Defines" are definitions of the variables -F77CMD, F77OPTS, CCCMD and CCOPTS. These are needed for compatibility with -the FXDR library makefile and SHOULD NOT BE CHANGED. - - After editing "Makefile.Defines", type "make" or "make all". This will -cause the following actions to be taken: - - (1) The modules in directory $(SWIFTER_HOME)/module will be compiled to - object code and added to the Swifter library (libswifter.a) located - in $(SWIFTER_HOME)/lib. Also, all the ".mod" files generated will - be installed to $(SWIFTER_HOME)/lib as well. These files are needed - for subsequent compilation of other source files that reference the - modules. (NOTE: DO NOT CHANGE the ordering of the modules in the - definition of $(SWIFTER_MODULES) in the Makefile, as the successful - compilation of some of the modules depends on this ordering.) - (2) The remaining Swifter library source code located in the various - subdirectories of $(SWIFTER_HOME) will be compiled to object code - and added to libswifter.a. - (3) The FXDR library (libfxdr.a) will be regenerated from source, tested, - then installed in $(SWIFTER_HOME)/lib. - (4) Any Swifter drivers located in $(SWIFTER_HOME)/main will be compiled - and linked with libswifter.a and libfxdr.a, and the resulting - executables installed in $(SWIFTER_HOME)/bin. The name of the - resulting executable will by default be the name of the original - source file minus the ".f90" suffix (e.g., swifter_whm.f90 -> - swifter_whm) - (5) Any tools located in $(SWIFTER_HOME)/tool will be compiled, linked, - installed and named in exactly the same manner as were the drivers - in Step (4) above. - - One by-product of the initial call to "make" or "make all" is the creation -of soft links to the files "Makefile" and "Makefile.Defines" from each Swifter -subdirectory containing source code. This facilitates subsequent compilation -directly from these subdirectories, although the make processes described below -should work correctly, unless otherwise noted, from any directory having access -to these two files. - - (1) "make mod" - recompiles the module source code located in - $(SWIFTER_HOME)/module, replaces these objects within - libswifter.a, located in $(SWIFTER_HOME)/lib, and - installs the ".mod" files to $(SWIFTER_HOME)/lib - (2) "make lib" - rebuilds the entire Swifter library libswifter.a from - source, replacing all the old archive members - (3) "make libdir" - rebuilds only the libswifter.a source code LOCATED IN - THE CURRENT WORKING DIRECTORY, replacing the old - archive members - (4) "make fxdr" - rebuilds the FXDR library from source, tests it, and - installs it to $(SWIFTER_HOME)/lib - (5) "make drivers" - recompiles all the driver source code located in - $(SWIFTER_HOME)/main, links to the Swifter and FXDR - libraries, and installs the resulting executables in - $(SWIFTER_HOME)/bin - (6) "make tools" - performs exactly the same steps as for the driver - source code above, but on the tools source code - located in $(SWIFTER_HOME)/tools - (7) "make bin" - recompiles all the source code LOCATED IN THE CURRENT - WORKING DIRECTORY, links to the Swifter and FXDR - libraries, and installs the resulting executables in - $(SWIFTER_HOME)/bin - (8) "make clean" - removes any soft links to the files "Makefile" and - "Makefile.Defines" from subdirectories of - $(SWIFTER_HOME), removes all executables from - $(SWIFTER_HOME)/bin, removes all libraries (lib*.a) - and compiled modules (*.mod) from $(SWIFTER_HOME)/lib - and the FXDR include file "fxdr.inc" from - $(SWIFTER_HOME)/include - - - THE DRIVERS - - All of the drivers are designed to take essentially the same input files -and to produce the same type of output. The basic step for all of them begins -with heliocentric positions and velocities and advances them a timestep dt. - -swifter_whm : The basic WHM integrator when particles are to be removed at the - time of close planetary encounters. Arbitrarily close solar - encounters can occur. -swifter_rmvs : The RMVS integrator that is like WHM, except that it can handle - arbitrarily close encounters between massive bodies and massless - test particles. -swifter_helio: The basic HELIO integrator (uses democratic heliocentric - coordinates) when particles are to be removed at the time of - close planetary encounters. Close encounters with the sun are - NOT allowed by the HELIO integrator. -swifter_symba: The SyMBA integrator, based on HELIO, can follow arbitrarily - close encounters between the massive bodies (i.e., planets with - masses greater than MTINY) and any of the other bodies in the - simulation (except the Sun). We are working to include the - version that handles close encounters with the sun, but it is - not available yet in this beta release. -swifter_tu4 : Symplectic fourth-order T+V integrator when particles are to be - removed at the time of close planetary or solar encounters. -swifter_ra15 : Nonsymplectic fifteenth-order RADAU integrator. This integrator - can follow arbitrarily close encounters between any of the - objects, but is much less efficient than the included symplectic - integrators. The accuracy is controlled by an error tolerance - input by the user. -swifter_bs : Nonsymplectic Bulirsch-Stoer integrator. This integrator can - follow arbitrarily close encounters between any of the objects, - but is much less efficient than the included symplectic - integrators. The accuracy is controlled by an error tolerance - input by the user. - - - INPUT/OUTPUT - - Swifter takes input from three files: a parameter file, a planet file, -and a test particle file. The user inputs the name of the parameter file at -the prompting of the program. The names of the other two files are contained -in the parameter file. - -Parameter File: This file contains all the run-time parameters - -The structure of the parameter file is a list of "PARAMETER VALUE" pairs. The -list of recognized parameters is given below. The leftmost column indicates -the type of parameter (R=real, I=integer, S=string, F=flag [flag values are the -strings "YES" and "NO". If the value is "YES", the flag will be set internally -to .TRUE., if "NO", then .FALSE.]) The second column gives the parameter name, -and the third column describes the parameter. Default values, if applicable, -are enclosed in [brackets]. The parameter names and values are NOT case -sensitive. - -I NPLMAX maximum number of planets [-1] (not yet used) -I NTPMAX maximum number of test particles [-1] (not yet used) -R T0 initial time (REQUIRED) [0.0] -R TSTOP time to stop the integration (REQUIRED) [0.0] -R DT time step (REQUIRED) [0.0] -S PL_IN planet data filename (REQUIRED) [""] -S TP_IN test particle data filename [""] -S IN_TYPE format of PL_IN, TP_IN ["ASCII"] | "XDR8" -I ISTEP_OUT number of time steps between outputs [-1] -S BIN_OUT binary output filename (REQUIRED if ISTEP_OUT > 0) [""] -S OUT_TYPE format of binary output file (REQUIRES BIN_OUT) - "REAL4" | "REAL8" | ["XDR4"] | "XDR8" -S OUT_FORM data stored in binary output file (REQUIRES BIN_OUT) - "EL" | ["XV"] | "FILT" -S OUT_STAT binary output file status (REQUIRES BIN_OUT) - ["NEW"] | "UNKNOWN" | "APPEND" -I ISTEP_DUMP number of time steps between dumps [-1] -R J2 spher. harm. term J_2*R^2, R = central body radius [0.0] -R J4 spher. harm. term J_4*R^4, R = central body radius [0.0] -F CHK_CLOSE check for test particle/planet close encounters - "YES" | ["NO"] -R CHK_RMIN heliocentric distance at which a test particle is stopped - as being too close to the central body [-1.0] -R CHK_RMAX heliocentric distance at which a test particle is stopped - as being too distant from the central body [-1.0] -R CHK_EJECT heliocentric distance at which an energetically unbound - test particle is stopped as being too distant from the - central body [-1.0] -R CHK_QMIN pericenter distance at which a test particle is stopped - as being too close to the pericenter [-1.0] (the - pericenter is interpreted either as the center of the - central body or the system barycenter, depending on the - value of CHK_QMIN_COORD) -S CHK_QMIN_COORD coordinate frame to use for CHK_QMIN (REQUIRES CHK_QMIN) - ["HELIO"] | "BARY" -R R CHK_QMIN_RANGE lower and upper boundaries of semimajor axis range to - perform the CHK_QMIN check (REQUIRES CHK_QMIN) [-1.0,-1.0] -S ENC_OUT encounter filename [""] -F EXTRA_FORCE use additional user-specified force routines - "YES" | ["NO"] -F BIG_DISCARD include data for all bodies > MTINY for each discard - record "YES" | ["NO"] -F RHILL_PRESENT Hill sphere radius is included for each planet in PL_IN - "YES" | ["NO"] - -Sample Parameter File: contents between the "=" lines - -=============================================================================== -! -! start the run at time = 0 -! -!NPLMAX 51 -!NTPMAX 1001 -T0 0.0E0 -TSTOP 3.6525E7 -DT 36.525E0 ! stepsize is 1/10 year -PL_IN pl.in -TP_IN tp.in -IN_TYPE ASCII -ISTEP_OUT 10000 -BIN_OUT bin.dat -OUT_TYPE XDR4 -OUT_FORM EL -OUT_STAT NEW -ISTEP_DUMP 10000 -!J2 0.01 -!J4 0.001 -CHK_CLOSE yes -CHK_RMIN 1.0 -CHK_RMAX 60.0 -CHK_EJECT -1.0 -CHK_QMIN 1.0 -CHK_QMIN_COORD HELIO -CHK_QMIN_RANGE 0.5 100.0 -ENC_OUT enc.dat -!EXTRA_FORCE no -BIG_DISCARD yes -!RHILL_PRESENT no -=============================================================================== - -In the parameter file, portions of input lines following an exclamation point -('!') are treated as comments and ignored. Thus parameters NPLMAX, NTPMAX, J2, -J4, EXTRA_FORCE and RHILL_PRESENT are not seen by the code and take their -default values, -1, -1, 0.0, 0.0, .FALSE. and .FALSE., respectively. - -Every ISTEP_OUT timesteps, the code outputs various quantities to the binary -file specified by BIN_OUT. The exact data (and format thereof) written to this -file are specified by OUT_TYPE and OUT_FORM. If - OUT_TYPE = "REAL4", data is written in 4-byte native Fortran binary format - = "REAL8", data is written in 8-byte native Fortran binary format - = "XDR4", data is written in 4-byte XDR format - = "XDR8", data is written in 8-byte XDR format - OUT_FORM = "EL", osculating orbital elements are written - = "XV", heliocentric position and velocity components are written - = "FILT", TBD filtered values are written (not yet implemented) - -Every ISTEP_DUMP timesteps, the code dumps all of the information needed to -resume the integration at that time in case of power failures or in case one -wishes to resume an integration from its endpoint. The information is in 3 -files called dump_pl1.bin, dump_tp1.bin, and dump_param1.dat (OR dump_pl2.bin, -dump_tp2.bin, and dump_param2.dat). The first dump is written to the first -set of files (set "1"), and subsequent dumps alternate between the two. This -is done so that at least one set of dump files will be preserved intact should -the program die during the writing of the dump files. The format of -dump_param#.dat is ASCII, that of dump_pl#.bin and dump_tp#.bin is XDR8, -regardless of the format of the original input files. Note that TO in -dump_param#.dat records the time of the dump and that OUT_STAT is changed to -"APPEND", so that these files can be used to restart a stopped integration. -Depending on the situation, one may wish to increase TSTOP in order to extend -an integration. - -Planet file (PL_IN): This file contains all the initial planet data - -The code requires units in which the gravitational constant G is unity. Any -combination of lengths, masses, and times that keeps that true is OK. For -example, one could use lengths specified in AU and time in days, thus forcing -the Solar mass to be approximately 2.96E-4. Alternatively, one could use units -in which lengths are in AU and the Solar Mass is unity, but then the orbital -period of a test particle at r = 1 AU would be 2*PI. A third useful set of -units has lengths specified in AU and time in years, yielding a Solar mass of -4*PI^2. The format is simple: - -first the # of bodies on the first line (INCLUDING the Sun), then - -3 lines for the Sun giving - ID and mass on the first line - heliocentric x,y,z on the next line and - heliocentric vx,vy,vz on the third - (NOTE: x,y,z and vx,vy,vz for the Sun MUST be 0!!) - -3 (or 4) lines for each subsequent massive body giving - ID and mass (and Hill sphere radius if RHILL_PRESENT = .TRUE.) on line 1 - (planet radius on line 2 only if CHK_CLOSE = .TRUE.) - heliocentric x,y,z on line 2 (or 3 if CHK_CLOSE = .TRUE.) - heliocentric vx,vy,vz on line 3 (or 4 if CHK_CLOSE = .TRUE.) - -If PL_IN is in XDR8 format, the ordering of the data in the file is identical -to that described above even though line numbers lose their meaning. The ID -for each body is an integer tag to help the code identify the body, thus no -two planets can have the same ID. Furthermore, no planet can have the same ID -as a test particle. - -Test particle file (TP_IN): This file contains all the initial test particle - data - -In the same units as PL_IN, the first line is the number of test particles. -The test particles are assumed to be massless, so for each particle there -are 3 lines giving - test particle ID on the first - heliocentric x,y,z on the second and - heliocentric vx,vy,vz on the third - -No test particle can have the same ID as any planet or any other test particle. - -Binary output file (BIN_OUT): This file, if defined in the input parameter - file, contains snapshot frames of the system - every ISTEP_OUT time steps, starting with the - system prior to the first time step. - -The data stored and its format are determined by the OUT_FORM and OUT_TYPE -parameters defined above. Generally, each frame consists of a header record -containing the time, the number of planets in the frame, the number of active -test particles in the frame, and an integer identifier as to what type of data -is being stored. Next, data for the planets are written. These are the ID, -the mass, and the six quantities specifying its heliocentric orbit, either -the osculating orbital elements or the heliocentric positions and velocities. -Finally, data for the active test particles are written. These are identical -to the planet data except that the mass, which is zero, is omitted. The tool -tool_follow in the $(SWIFTER_HOME)/tool subdirectory shows how to access the -data in this file. This particular tool will output to an ASCII file the data -for a given body (specified by the ID value given by the user at the command -line when the tool is run). - -Discard file ("discard.out"): This ASCII formatted file, which has a fixed name - in the current release, stores information on all - discarded planets and test particles. First, the - time, the number of bodies discarded this time - step, and the value of BIG_DISCARD is output. - Then, for each discarded body, it stores "-1" if - the body has been discarded, "+1" if the body has - been added (this only occurs for newly merged - bodies in SyMBA), the body ID, an integer code - (defined in module_parameters.f90) giving the - reason for the discard, and the heliocentric - position and velocity components of the body at - the time of discard. If BIG_DISCARD is defined - to be "yes" in the input parameter file, then - similar data for the remaining active planets are - also output after the discarded bodies. - -Encounter file (ENC_OUT): This file, if defined in the input parameter file, - contains output information on all close encounters - that occurred during the run. (NOTE: this file is - currently only used by the swifter_rmvs and - swifter_symba integrators. - -The tool tool_encounter_read in the $(SWIFTER_HOME)/tool subdirectory shows how -to access the data in the encounter file. For each encounter, the time of -encounter, the ID's of the two bodies, their masses, heliocentric positions and -velocities are given. The format of the encounter file is determined by the -OUT_TYPE parameter. The tool_encounter_read tool will output all of the -encounter data to an ASCII file. - - - XDR FILE FORMAT - -XDR is a platform independent binary file format. That is, it writes binary -files that any machine can read. So, the user does not have to worry about -things like big endian vs. little endian. We have adopted a package for -reading and writing XDR called FXDR (for FORTRAN XDR). FXDR was written by -David W. Pierce of Scripps Institution of Oceanography. Information about FXDR -can be found at: - - http://meteora.ucsd.edu/~pierce/fxdr_home_page.html - -We are currently using version 2.1c. - - - EXAMPLE - -An example set of input files and an associated README file can be found in the -$(SWIFTER_HOME)/example subdirectory. From 6e1bb0bc2d0047c63a85e14a9b06c0a0375beeb6 Mon Sep 17 00:00:00 2001 From: David Minton Date: Tue, 25 Oct 2022 14:02:11 -0400 Subject: [PATCH 27/27] Added bin folder to ignore list --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index e9a3a409d..4bd2e288d 100644 --- a/.gitignore +++ b/.gitignore @@ -77,3 +77,5 @@ python/swiftest/tests/convert_code_type/swifter2swiftest/pl.swifter2swiftest.in python/swiftest/tests/convert_code_type/swifter2swiftest/tp.swifter2swiftest.in !python/swiftest/requirements.txt + +bin/