From c0850062a35900bd4b57a37a1a53c0f1ea995d70 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Wed, 12 Feb 2025 17:33:01 -0500 Subject: [PATCH] Finally fixed the the Cmakelists.txt for everything to build correctly. mehsfem2d/3d can also build standalone now. including configuration --- fortran/meshfem2d/CMakeLists.txt | 32 +- fortran/meshfem2d/setup/CMakeLists.txt | 93 +- fortran/meshfem2d/setup/config.h.in | 4 +- fortran/meshfem2d/version.fh | 4 - fortran/meshfem3d/CMakeLists.txt | 29 +- .../generate_databases/CMakeLists.txt | 4 +- fortran/meshfem3d/meshfem3D/CMakeLists.txt | 5 +- fortran/meshfem3d/setup/CMakeLists.txt | 495 +++++----- fortran/meshfem3d/setup/config.fh | 111 --- fortran/meshfem3d/setup/config.h | 143 --- fortran/meshfem3d/setup/config.h.in | 172 ++-- fortran/meshfem3d/setup/constants.h | 894 ------------------ ...tomography.h => constants_tomography_nu.h} | 0 fortran/meshfem3d/setup/precision.h | 39 - fortran/meshfem3d/setup/version.fh | 4 - fortran/meshfem3d/shared/CMakeLists.txt | 14 +- 16 files changed, 447 insertions(+), 1596 deletions(-) delete mode 100644 fortran/meshfem2d/version.fh delete mode 100644 fortran/meshfem3d/setup/config.fh delete mode 100644 fortran/meshfem3d/setup/config.h delete mode 100644 fortran/meshfem3d/setup/constants.h rename fortran/meshfem3d/setup/{constants_tomography.h => constants_tomography_nu.h} (100%) delete mode 100644 fortran/meshfem3d/setup/precision.h delete mode 100644 fortran/meshfem3d/setup/version.fh diff --git a/fortran/meshfem2d/CMakeLists.txt b/fortran/meshfem2d/CMakeLists.txt index ae27b7d5f..7808bc99c 100644 --- a/fortran/meshfem2d/CMakeLists.txt +++ b/fortran/meshfem2d/CMakeLists.txt @@ -14,22 +14,18 @@ message("-- MESHFEM2D is build without SCOTCH support") option(ENABLE_DOUBLE_PRECISION "Enable double precision" OFF) option(WITH_MPI "Build with MPI support" OFF) option(WITH_SCOTCH "Build with SCOTCH support" OFF) +option(FORCE_VECTORIZATION "Force vectorization" OFF) # Set output file directories set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/archive) -message("-- CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") -message("-- CMAKE_Fortran_MODULE_DIRECTORY: ${CMAKE_Fortran_MODULE_DIRECTORY}") -message("-- CMAKE_ARCHIVE_OUTPUT_DIRECTORY: ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}") -message("-- CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}") - # Custom variables set(SETUP_DIR ${CMAKE_CURRENT_BINARY_DIR}/setup) # Set include directories -include_directories("${CMAKE_CURRENT_BINARY_DIR}/modules") +include_directories("${CMAKE_Fortran_MODULE_DIRECTORY}") include_directories(${SETUP_DIR}) # Setting values dependent on options @@ -84,24 +80,6 @@ endif() message("-- CFLAGS: ${CFLAGS}") - -# Set Header interfaces -add_library(meshfem2D_constants INTERFACE ${SETUP_DIR}/constants.h) -add_library(meshfem2D::constants ALIAS meshfem2D_constants) - -add_library(meshfem2D_precision INTERFACE ${SETUP_DIR}/precision.h) -add_library(meshfem2D::precision ALIAS meshfem2D_precision) - -add_library(meshfem2D_version INTERFACE ${SETUP_DIR}/version.fh) -add_library(meshfem2D::version ALIAS meshfem2D_version) - -add_library(meshfem2D_config INTERFACE ${SETUP_DIR}/config.h) -add_library(meshfem2D::config ALIAS meshfem2D_config) - -add_library(meshfem2D_fh_config INTERFACE ${SETUP_DIR}/config.fh) -add_library(meshfem2D::fh_config ALIAS meshfem2D_fh_config) - - # Shared Fortran Module add_library(meshfem2D_shared_module shared_par.f90) add_library(meshfem2D::shared_module ALIAS meshfem2D_shared_module) @@ -196,7 +174,8 @@ add_library(meshfem2D_mesh save_stations_file.f90 ) add_library(meshfem2D::mesh ALIAS meshfem2D_mesh) -target_link_libraries(meshfem2D_mesh PRIVATE +target_link_libraries(meshfem2D_mesh + PRIVATE meshfem2D::shared_module meshfem2D::parameters) @@ -211,7 +190,8 @@ add_library(meshfem2D_mesh_mpi meshfem2D.F90 ) add_library(meshfem2D::mesh_mpi ALIAS meshfem2D_mesh_mpi) -target_link_libraries(meshfem2D_mesh_mpi PRIVATE +target_link_libraries(meshfem2D_mesh_mpi + PRIVATE meshfem2D::shared_module meshfem2D::parameters meshfem2D::mesh diff --git a/fortran/meshfem2d/setup/CMakeLists.txt b/fortran/meshfem2d/setup/CMakeLists.txt index 8513b650e..f7ac61bed 100644 --- a/fortran/meshfem2d/setup/CMakeLists.txt +++ b/fortran/meshfem2d/setup/CMakeLists.txt @@ -4,10 +4,7 @@ cmake_minimum_required(VERSION 3.10) message("-- Configuring meshfem2D headers...") enable_language(Fortran) - -set(SETUP_DIR ${CMAKE_CURRENT_BINARY_DIR}) - -# ===================== config.h.in START ===================== +enable_language(C) include(CheckIncludeFile) include(CheckFunctionExists) @@ -23,9 +20,32 @@ foreach(header inttypes.h pthread.h scotch.h stdint.h stdio.h stdlib.h strings.h check_include_file(${header} HAVE_${UPPER_HEADER}) endforeach() -# ----------------------------------------------------------------------------- + +# Define package information +set(PACKAGE_NAME "SPECFEM2D") +set(PACKAGE_VERSION "8.0.0") +set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") +set(PACKAGE_TARNAME "specfem2d") +set(PACKAGE_URL "https://github.com/geodynamics/specfem2d") +set(PACKAGE_BUGREPORT "support@specfem2d.org") + +# Git-related details (can be dynamically retrieved) +set(SPECFEM2D_GIT_BRANCH "main") # You can use 'git rev-parse --abbrev-ref HEAD' dynamically +set(SPECFEM2D_GIT_DATE "2024-02-11") +set(SPECFEM2D_GIT_HASH "abcd1234") +set(SPECFEM2D_GIT_REVISION "abcd1234") +set(SPECFEM2D_VERSION "${PACKAGE_VERSION}") +set(SPECFEM2D_RELEASE_VERSION 1) + +set(GIT_PACKAGE_VERSION "v8.0.0-11-gf8c66778") +set(GIT_COMMIT_VERSION "f8c66778e3bcff99be726113a1aca338255ed87e") +set(GIT_DATE_VERSION "2023-03-21 19:54:51 +0100") + + +# ====== FIGURE OUT THE FORTRAN NAME MANGLING START =========== + # Write test Fortran subroutines -file(WRITE "${CMAKE_BINARY_DIR}/test.f90" " +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test.f90" " subroutine foobar() return end @@ -71,7 +91,7 @@ foreach(TEST_CASE endif() # Write C test file - file(WRITE "${CMAKE_BINARY_DIR}/test.c" " + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test.c" " extern void ${NAME1}(void); extern void ${NAME2}(void); int main() { @@ -82,10 +102,10 @@ foreach(TEST_CASE ") try_compile(COMPILE_SUCCESS - ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} SOURCES - "${CMAKE_BINARY_DIR}/test.f90" - "${CMAKE_BINARY_DIR}/test.c" + "${CMAKE_CURRENT_BINARY_DIR}/test.f90" + "${CMAKE_CURRENT_BINARY_DIR}/test.c" OUTPUT_VARIABLE COMPILE_OUTPUT ) @@ -146,55 +166,58 @@ else() endif() endif() -# ----------------------------------------------------------------------------- +# ====== FIGURE OUT THE FORTRAN NAME MANGLING END ============= + +# ===================== config.h.in START ===================== # Generate config.h file configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in - ${SETUP_DIR}/config.h @ONLY) + ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY) # ===================== config.h.in END ===================== # ===================== config.fh.in START ================== configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.fh.in - ${SETUP_DIR}/config.fh @ONLY) + ${CMAKE_CURRENT_BINARY_DIR}/config.fh @ONLY) # ===================== config.fh.in END ==================== # ===================== constants.h.in START ================ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/constants.h.in - ${SETUP_DIR}/constants.h @ONLY) + ${CMAKE_CURRENT_BINARY_DIR}/constants.h @ONLY) # ===================== constants.h.in END ================== # ===================== precision.h.in START ================ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/precision.h.in - ${SETUP_DIR}/precision.h @ONLY) + ${CMAKE_CURRENT_BINARY_DIR}/precision.h @ONLY) # ===================== precision.h.in END ================== # ===================== version.fh.in START ================ -# Define package information -set(PACKAGE_NAME "SPECFEM2D") -set(PACKAGE_VERSION "8.0.0") -set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") -set(PACKAGE_TARNAME "specfem2d") -set(PACKAGE_URL "https://github.com/geodynamics/specfem2d") -set(PACKAGE_BUGREPORT "support@specfem2d.org") +# Configure the config.h file +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.fh.in + ${CMAKE_CURRENT_BINARY_DIR}/version.fh @ONLY) -# Git-related details (can be dynamically retrieved) -set(SPECFEM2D_GIT_BRANCH "main") # You can use 'git rev-parse --abbrev-ref HEAD' dynamically -set(SPECFEM2D_GIT_DATE "2024-02-11") -set(SPECFEM2D_GIT_HASH "abcd1234") -set(SPECFEM2D_GIT_REVISION "abcd1234") -set(SPECFEM2D_RELEASE_VERSION 0) # Set to 1 if it's a stable release +# ===================== version.h.in START ================ -set(GIT_PACKAGE_VERSION "v8.0.0-11-gf8c66778") -set(GIT_COMMIT_VERSION "f8c66778e3bcff99be726113a1aca338255ed87e") -set(GIT_DATE_VERSION "2023-03-21 19:54:51 +0100") +# Set Header interfaces +add_library(meshfem2D_constants INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/constants.h) +add_library(meshfem2D::constants ALIAS meshfem2D_constants) +target_include_directories(meshfem2D_constants INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) -# Configure the config.h file -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.fh.in - ${SETUP_DIR}/version.fh @ONLY) +add_library(meshfem2D_precision INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/precision.h) +add_library(meshfem2D::precision ALIAS meshfem2D_precision) +target_include_directories(meshfem2D_precision INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) +add_library(meshfem2D_version INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/version.fh) +add_library(meshfem2D::version ALIAS meshfem2D_version) +target_include_directories(meshfem2D_version INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) -# ===================== version.h.in START ================ +add_library(meshfem2D_config INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/config.h) +add_library(meshfem2D::config ALIAS meshfem2D_config) +target_include_directories(meshfem2D_config INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) + +add_library(meshfem2D_fh_config INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/config.fh) +add_library(meshfem2D::fh_config ALIAS meshfem2D_fh_config) +target_include_directories(meshfem2D_fh_config INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/fortran/meshfem2d/setup/config.h.in b/fortran/meshfem2d/setup/config.h.in index e972b0e4c..0feda824b 100644 --- a/fortran/meshfem2d/setup/config.h.in +++ b/fortran/meshfem2d/setup/config.h.in @@ -53,7 +53,7 @@ #cmakedefine01 HAVE_UNISTD_H /* Define if xmmintrin.h exists */ -#cmakedefine HAVE_XMMINTRIN +#cmakedefine01 HAVE_XMMINTRIN /* Define to the address where bug reports for this package should be sent. */ #cmakedefine PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" @@ -89,7 +89,7 @@ #cmakedefine SPECFEM2D_GIT_REVISION "@SPECFEM2D_GIT_REVISION@" /* Set to 0 if source is from GIT, 1 otherwise. */ -#cmakedefine SPECFEM2D_RELEASE_VERSION +#cmakedefine SPECFEM2D_RELEASE_VERSION @SPECFEM2D_RELEASE_VERSION@ /* Define SPECFEM2D version */ #cmakedefine SPECFEM2D_VERSION "@SPECFEM2D_VERSION@" diff --git a/fortran/meshfem2d/version.fh b/fortran/meshfem2d/version.fh deleted file mode 100644 index e3b26aa58..000000000 --- a/fortran/meshfem2d/version.fh +++ /dev/null @@ -1,4 +0,0 @@ -! version information -character(len=*), parameter :: git_package_version = "v8.0.0-11-gf8c66778" -character(len=*), parameter :: git_commit_version = "f8c66778e3bcff99be726113a1aca338255ed87e" -character(len=*), parameter :: git_date_version = "2023-03-21 19:54:51 +0100" diff --git a/fortran/meshfem3d/CMakeLists.txt b/fortran/meshfem3d/CMakeLists.txt index 5117bcdef..892ecde6a 100644 --- a/fortran/meshfem3d/CMakeLists.txt +++ b/fortran/meshfem3d/CMakeLists.txt @@ -1,24 +1,37 @@ -# Minimum CMake version required -cmake_minimum_required(VERSION 3.10) - # Project name and language project(meshfem3D LANGUAGES Fortran C) -# Set the Fortran standard to 95 -set(CMAKE_Fortran_STANDARD 95) -set(CMAKE_Fortran_STANDARD_REQUIRED ON) +# Minimum CMake version required +cmake_minimum_required(VERSION 3.10) # languages enable_language(Fortran) enable_language(C) +# Set the Fortran standard to 95 +set(CMAKE_Fortran_STANDARD 95) +set(CMAKE_Fortran_STANDARD_REQUIRED ON) + option(ENABLE_DOUBLE_PRECISION "Enable double precision" OFF) option(WITH_MPI "Build with MPI support" OFF) option(WITH_SCOTCH "Build with SCOTCH support" OFF) option(WITH_ADIOS "Build with ADIOS support" OFF) +option(FORCE_VECTORIZATION "Force vectorization" OFF) +option(BEOWULF_CLUSTER "Build for Beowulf cluster" OFF) + +# For the runtime we use the same directory as the main project +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +# For output files we use the current directory +set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/archive) + +# Custom variables +set(SETUP_DIR ${CMAKE_CURRENT_BINARY_DIR}/setup) -set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/fortran/meshfem3d/modules) -include_directories("${CMAKE_BINARY_DIR}/fortran/meshfem3d/modules") +# include_directories +include_directories(${CMAKE_Fortran_MODULE_DIRECTORY}) +include_directories(${SETUP_DIR}) # Setting values dependent on options if (ENABLE_DOUBLE_PRECISION) diff --git a/fortran/meshfem3d/generate_databases/CMakeLists.txt b/fortran/meshfem3d/generate_databases/CMakeLists.txt index 1c19c2cd7..cbd3e08d9 100644 --- a/fortran/meshfem3d/generate_databases/CMakeLists.txt +++ b/fortran/meshfem3d/generate_databases/CMakeLists.txt @@ -8,8 +8,8 @@ project(MESHFEM3D_MESHFEM3D LANGUAGES Fortran C) set(CMAKE_Fortran_STANDARD 95) set(CMAKE_Fortran_STANDARD_REQUIRED ON) -set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/fortran/meshfem3d/modules) -include_directories("${CMAKE_BINARY_DIR}/fortran/meshfem3d/modules") +# set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../modules) +# include_directories(CMAKE_Fortran_MODULE_DIRECTORY) set(MESHFEM3D_GENERATE_DATABASES_MODULE calc_jacobian.f90 diff --git a/fortran/meshfem3d/meshfem3D/CMakeLists.txt b/fortran/meshfem3d/meshfem3D/CMakeLists.txt index 8d43da05f..95fded747 100644 --- a/fortran/meshfem3d/meshfem3D/CMakeLists.txt +++ b/fortran/meshfem3d/meshfem3D/CMakeLists.txt @@ -8,9 +8,8 @@ project(MESHFEM3D_MESHFEM3D LANGUAGES Fortran C) set(CMAKE_Fortran_STANDARD 95) set(CMAKE_Fortran_STANDARD_REQUIRED ON) - -set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/fortran/meshfem3d/modules) -include_directories("${CMAKE_BINARY_DIR}/fortran/meshfem3d/modules") +# set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../modules) +# include_directories("${CMAKE_Fortran_MODULE_DIRECTORY}") set(MESHFEM3D_MESH_MODULE calc_gll_points.f90 diff --git a/fortran/meshfem3d/setup/CMakeLists.txt b/fortran/meshfem3d/setup/CMakeLists.txt index 1c226e51e..c253d51a4 100644 --- a/fortran/meshfem3d/setup/CMakeLists.txt +++ b/fortran/meshfem3d/setup/CMakeLists.txt @@ -1,226 +1,291 @@ -# Minimum CMake version required -cmake_minimum_required(VERSION 3.10) - # Project name and language project(MESHFEM3D_SETUP LANGUAGES Fortran C) +cmake_minimum_required(VERSION 3.10) + +message("-- Configuring meshfem3D headers...") + +enable_language(Fortran) +enable_language(C) # Set the Fortran standard to 95 set(CMAKE_Fortran_STANDARD 95) set(CMAKE_Fortran_STANDARD_REQUIRED ON) -set(SETUP_DIR ${CMAKE_BINARY_DIR}/fortran/meshfem3d/setup) - # Set include directories -include_directories(${SETUP_DIR}) - - -# # =============== CONFIGURATION =============== - - -# # ===================== config.h.in START ===================== - -# include(CheckIncludeFile) -# include(CheckFunctionExists) -# include(CheckSymbolExists) -# include(CheckCSourceCompiles) -# include(CheckCCompilerFlag) -# # include(CheckFortranCompiler) -# include(CheckFortranCompilerFlag) - -# # Check for headers -# foreach(header inttypes.h pthread.h scotch.h stdint.h stdio.h stdlib.h strings.h string.h sys/stat.h sys/types.h unistd.h xmmintrin.h emmintrin.h err.h) -# string(TOUPPER "${header}" UPPER_HEADER) -# string(REPLACE "." "_" UPPER_HEADER "${UPPER_HEADER}") -# check_include_file(${header} HAVE_${UPPER_HEADER}) -# endforeach() - -# # ----------------------------------------------------------------------------- -# # Write test Fortran subroutines -# file(WRITE "${CMAKE_BINARY_DIR}/test.f90" " -# subroutine foobar() -# return -# end -# subroutine foo_bar() -# return -# end -# ") - -# # Test combinations of case, underscore, and extra underscore -# foreach(TEST_CASE -# "lower;no;no" # lower case, no underscore, no extra underscore -# "lower;no;yes" # lower case, no underscore, extra underscore -# "lower;yes;no" # lower case, underscore, no extra underscore -# "lower;yes;yes" # lower case, underscore, extra underscore -# "upper;no;no" # upper case, no underscore, no extra underscore -# "upper;no;yes" # upper case, no underscore, extra underscore -# "upper;yes;no" # upper case, underscore, no extra underscore -# "upper;yes;yes" # upper case, underscore, extra underscore -# ) -# # Parse the test case -# list(GET TEST_CASE 0 CASE) -# list(GET TEST_CASE 1 HAS_UNDERSCORE) -# list(GET TEST_CASE 2 HAS_EXTRA_UNDERSCORE) - -# # Construct names to test based on case -# if(CASE STREQUAL "lower") -# set(NAME1 "foobar") -# set(NAME2 "foo_bar") -# else() -# set(NAME1 "FOOBAR") -# set(NAME2 "FOO_BAR") -# endif() - -# # Add underscore if needed -# if(HAS_UNDERSCORE STREQUAL "yes") -# set(NAME1 "${NAME1}_") -# set(NAME2 "${NAME2}_") -# endif() - -# # Add extra underscore to NAME2 if needed -# if(HAS_EXTRA_UNDERSCORE STREQUAL "yes") -# set(NAME2 "${NAME2}_") -# endif() - -# # Write C test file -# file(WRITE "${CMAKE_BINARY_DIR}/test.c" " -# extern void ${NAME1}(void); -# extern void ${NAME2}(void); -# int main() { -# ${NAME1}(); -# ${NAME2}(); -# return 0; -# } -# ") - -# try_compile(COMPILE_SUCCESS -# ${CMAKE_BINARY_DIR} -# SOURCES -# "${CMAKE_BINARY_DIR}/test.f90" -# "${CMAKE_BINARY_DIR}/test.c" -# OUTPUT_VARIABLE COMPILE_OUTPUT -# ) - -# if(COMPILE_SUCCESS) -# set(FC_CASE ${CASE} CACHE STRING "Fortran name case") -# set(FC_UNDERSCORE ${HAS_UNDERSCORE} CACHE STRING "Fortran name underscore") -# set(FC_EXTRA_UNDERSCORE ${HAS_EXTRA_UNDERSCORE} CACHE STRING "Fortran name extra underscore") - -# # Set the mangling description string like in the autoconf file -# set(FC_MANGLING "${CASE} case, ${HAS_UNDERSCORE} underscore, ${HAS_EXTRA_UNDERSCORE} extra underscore" -# CACHE STRING "Fortran name mangling scheme") - -# message(STATUS "Detected Fortran name mangling: ${FC_MANGLING}") -# break() -# endif() -# endforeach() - -# if(NOT DEFINED FC_MANGLING) -# message(FATAL_ERROR "Could not determine Fortran name mangling") -# endif() - -# # Now define the FC_FUNC and FC_FUNC_ macros based on the detected scheme -# if(FC_CASE STREQUAL "lower") -# if(FC_UNDERSCORE STREQUAL "no") -# if(FC_EXTRA_UNDERSCORE STREQUAL "no") -# set(FC_FUNC "name") -# set(FC_FUNC_ "name") -# else() -# set(FC_FUNC "name") -# set(FC_FUNC_ "name ## _") -# endif() -# else() -# if(FC_EXTRA_UNDERSCORE STREQUAL "no") -# set(FC_FUNC "name ## _") -# set(FC_FUNC_ "name ## _") -# else() -# set(FC_FUNC "name ## _") -# set(FC_FUNC_ "name ## __") -# endif() -# endif() -# else() -# if(FC_UNDERSCORE STREQUAL "no") -# if(FC_EXTRA_UNDERSCORE STREQUAL "no") -# set(FC_FUNC "NAME") -# set(FC_FUNC_ "NAME") -# else() -# set(FC_FUNC "NAME") -# set(FC_FUNC_ "NAME ## _") -# endif() -# else() -# if(FC_EXTRA_UNDERSCORE STREQUAL "no") -# set(FC_FUNC "NAME ## _") -# set(FC_FUNC_ "NAME ## _") -# else() -# set(FC_FUNC "NAME ## _") -# set(FC_FUNC_ "NAME ## __") -# endif() -# endif() -# endif() - -# # ----------------------------------------------------------------------------- - -# # Generate config.h file -# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in -# ${CMAKE_CURRENT_SOURCE_DIR}/../config.h @ONLY) - -# # ===================== config.h.in END ===================== - -# # ===================== config.fh.in START ================== -# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.fh.in -# ${CMAKE_CURRENT_SOURCE_DIR}/../config.fh @ONLY) -# # ===================== config.fh.in END ==================== - - -# # ===================== constants.h.in START ================ -# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/constants.h.in -# ${CMAKE_CURRENT_SOURCE_DIR}/../constants.h @ONLY) -# # ===================== constants.h.in END ================== - -# # ===================== precision.h.in START ================ -# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/precision.h.in -# ${CMAKE_CURRENT_SOURCE_DIR}/../precision.h @ONLY) -# # ===================== precision.h.in END ================== - - -# # ===================== version.fh.in START ================ - -# # Define package information -# set(PACKAGE_NAME "SPECFEM2D") -# set(PACKAGE_VERSION "8.0.0") -# set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") -# set(PACKAGE_TARNAME "specfem2d") -# set(PACKAGE_URL "https://github.com/geodynamics/specfem2d") -# set(PACKAGE_BUGREPORT "support@specfem2d.org") - -# # Git-related details (can be dynamically retrieved) -# set(SPECFEM2D_GIT_BRANCH "main") # You can use 'git rev-parse --abbrev-ref HEAD' dynamically -# set(SPECFEM2D_GIT_DATE "2024-02-11") -# set(SPECFEM2D_GIT_HASH "abcd1234") -# set(SPECFEM2D_GIT_REVISION "abcd1234") -# set(SPECFEM2D_RELEASE_VERSION 0) # Set to 1 if it's a stable release - -# set(GIT_PACKAGE_VERSION "v8.0.0-11-gf8c66778") -# set(GIT_COMMIT_VERSION "f8c66778e3bcff99be726113a1aca338255ed87e") -# set(GIT_DATE_VERSION "2023-03-21 19:54:51 +0100") - -# # Configure the config.h file -# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.fh.in ${CMAKE_CURRENT_SOURCE_DIR}/../version.fh @ONLY) - - -# # ===================== version.h.in START ================ - - -set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/fortran/meshfem3d/modules) -include_directories("${CMAKE_BINARY_DIR}/fortran/meshfem3d/modules") - -add_library(meshfem3D_version INTERFACE version.fh) -add_library(meshfem3D::version ALIAS meshfem3D_version) -target_include_directories(meshfem3D_version INTERFACE ./) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +if (BEOWULF_CLUSTER) + message("-- Building for Beowulf cluster") + set(LOCAL_PATH_IS_ALSO_GLOBAL "false") +else() + message("-- Building for shared memory machine") + set(LOCAL_PATH_IS_ALSO_GLOBAL "true") +endif() + +# ================== Figuring out available headers START ================ +include(CheckIncludeFile) +include(CheckFunctionExists) +include(CheckSymbolExists) +include(CheckCSourceCompiles) +include(CheckCCompilerFlag) +include(CheckFortranCompilerFlag) +include(CheckLibraryExists) + +# Check for required headers +check_include_file(err.h HAVE_ERR) +check_include_file(inttypes.h HAVE_INTTYPES_H) +check_include_file(stdint.h HAVE_STDINT_H) +check_include_file(stdio.h HAVE_STDIO_H) +check_include_file(stdlib.h HAVE_STDLIB_H) +check_include_file(strings.h HAVE_STRINGS_H) +check_include_file(string.h HAVE_STRING_H) +check_include_file(sys/stat.h HAVE_SYS_STAT_H) +check_include_file(sys/types.h HAVE_SYS_TYPES_H) +check_include_file(unistd.h HAVE_UNISTD_H) + +# Check for compiler-specific headers +include(CheckIncludeFile) +check_include_file(emmintrin.h HAVE_EMMINTRIN) +check_include_file(xmmintrin.h HAVE_XMMINTRIN) + +# Check for libraries +include(CheckLibraryExists) +check_symbol_exists(vtkCommon "vtkCommon.h" HAVE_LIBVTKCOMMON) +check_symbol_exists(vtkDICOMParser "vtkDICOMParser.h" HAVE_LIBVTKDICOMPARSER) +check_symbol_exists(vtkexpat "vtkexpat.h" HAVE_LIBVTKEXPAT) +check_symbol_exists(vtkFiltering "vtkFiltering.h" HAVE_LIBVTKFILTERING) +check_symbol_exists(vtkGenericFiltering "vtkGenericFiltering.h" HAVE_LIBVTKGENERICFILTERING) +check_symbol_exists(vtkGraphics "vtkGraphics.h" HAVE_LIBVTKGRAPHICS) +check_symbol_exists(vtkRendering "vtkRendering.h" HAVE_LIBVTKRENDERING) +check_symbol_exists(vtksys "vtksys.h" HAVE_LIBVTKSYS) +check_symbol_exists(vtkzlib "vtkzlib.h" HAVE_LIBVTKZLIB) + +# Check for threading support +find_package(Threads REQUIRED) +if(Threads_FOUND) + set(HAVE_PTHREAD 1) +endif() + + +# Set up definition for use in CMake +option(USE_MAP_FUNCTION "Enable optimized file I/O for regional simulations" OFF) +if(USE_MAP_FUNCTION) + set(USE_MAP_FUNCTION 1) +endif() + +# ================== Figuring out available headers END ================ + +# Package variables +set(PACKAGE_NAME "SPECFEM2D") +set(PACKAGE_VERSION "8.0.0") +set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") +set(PACKAGE_TARNAME "specfem2d") +set(PACKAGE_URL "https://github.com/geodynamics/specfem2d") +set(PACKAGE_BUGREPORT "support@specfem2d.org") + +# Git-related details (can be dynamically retrieved) +set(SPECFEM2D_GIT_BRANCH "main") # You can use 'git rev-parse --abbrev-ref HEAD' dynamically +set(SPECFEM2D_GIT_DATE "2024-02-11") +set(SPECFEM2D_GIT_HASH "abcd1234") +set(SPECFEM2D_GIT_REVISION "abcd1234") +set(SPECFEM2D_RELEASE_VERSION 0) # Set to 1 if it's a stable release + +set(GIT_PACKAGE_VERSION "v4.1.1-100-g725321e6") +set(GIT_COMMIT_VERSION "725321e6599f90e486c907435840df559ebc0a9c") +set(GIT_DATE_VERSION "2024-11-21 11:50:38 +0100") + + +# =============== CHECK if the compiler supports yytext START ========= +check_c_source_compiles(" +#include +#include +#include +extern char *yytext; +int main() { return 0; } +" YYTEXT_POINTER) + +if(YYTEXT_POINTER) + set(YYTEXT_POINTER 1) +else() + set(YYTEXT_POINTER 0) +endif() +# =============== CHECK if the compiler supports yytext END ============ + + +# =============== FIGURING OUT FORTRAN NAME MANGLING START ============= +# Write test Fortran subroutines +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test.f90" " +subroutine foobar() +return +end +subroutine foo_bar() +return +end +") + +# Test combinations of case, underscore, and extra underscore +foreach(TEST_CASE + "lower;no;no" # lower case, no underscore, no extra underscore + "lower;no;yes" # lower case, no underscore, extra underscore + "lower;yes;no" # lower case, underscore, no extra underscore + "lower;yes;yes" # lower case, underscore, extra underscore + "upper;no;no" # upper case, no underscore, no extra underscore + "upper;no;yes" # upper case, no underscore, extra underscore + "upper;yes;no" # upper case, underscore, no extra underscore + "upper;yes;yes" # upper case, underscore, extra underscore +) + # Parse the test case + list(GET TEST_CASE 0 CASE) + list(GET TEST_CASE 1 HAS_UNDERSCORE) + list(GET TEST_CASE 2 HAS_EXTRA_UNDERSCORE) + + # Construct names to test based on case + if(CASE STREQUAL "lower") + set(NAME1 "foobar") + set(NAME2 "foo_bar") + else() + set(NAME1 "FOOBAR") + set(NAME2 "FOO_BAR") + endif() + + # Add underscore if needed + if(HAS_UNDERSCORE STREQUAL "yes") + set(NAME1 "${NAME1}_") + set(NAME2 "${NAME2}_") + endif() + + # Add extra underscore to NAME2 if needed + if(HAS_EXTRA_UNDERSCORE STREQUAL "yes") + set(NAME2 "${NAME2}_") + endif() + + # Write C test file + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test.c" " + extern void ${NAME1}(void); + extern void ${NAME2}(void); + int main() { + ${NAME1}(); + ${NAME2}(); + return 0; + } + ") + + try_compile(COMPILE_SUCCESS + ${CMAKE_CURRENT_BINARY_DIR} + SOURCES + "${CMAKE_CURRENT_BINARY_DIR}/test.f90" + "${CMAKE_CURRENT_BINARY_DIR}/test.c" + OUTPUT_VARIABLE COMPILE_OUTPUT + ) + + if(COMPILE_SUCCESS) + set(FC_CASE ${CASE} CACHE STRING "Fortran name case") + set(FC_UNDERSCORE ${HAS_UNDERSCORE} CACHE STRING "Fortran name underscore") + set(FC_EXTRA_UNDERSCORE ${HAS_EXTRA_UNDERSCORE} CACHE STRING "Fortran name extra underscore") + + # Set the mangling description string like in the autoconf file + set(FC_MANGLING "${CASE} case, ${HAS_UNDERSCORE} underscore, ${HAS_EXTRA_UNDERSCORE} extra underscore" + CACHE STRING "Fortran name mangling scheme") + + message(STATUS "Detected Fortran name mangling: ${FC_MANGLING}") + break() + endif() +endforeach() + +if(NOT DEFINED FC_MANGLING) + message(FATAL_ERROR "Could not determine Fortran name mangling") +endif() + +# Now define the FC_FUNC and FC_FUNC_ macros based on the detected scheme +if(FC_CASE STREQUAL "lower") + if(FC_UNDERSCORE STREQUAL "no") + if(FC_EXTRA_UNDERSCORE STREQUAL "no") + set(FC_FUNC "name") + set(FC_FUNC_ "name") + else() + set(FC_FUNC "name") + set(FC_FUNC_ "name ## _") + endif() + else() + if(FC_EXTRA_UNDERSCORE STREQUAL "no") + set(FC_FUNC "name ## _") + set(FC_FUNC_ "name ## _") + else() + set(FC_FUNC "name ## _") + set(FC_FUNC_ "name ## __") + endif() + endif() +else() + if(FC_UNDERSCORE STREQUAL "no") + if(FC_EXTRA_UNDERSCORE STREQUAL "no") + set(FC_FUNC "NAME") + set(FC_FUNC_ "NAME") + else() + set(FC_FUNC "NAME") + set(FC_FUNC_ "NAME ## _") + endif() + else() + if(FC_EXTRA_UNDERSCORE STREQUAL "no") + set(FC_FUNC "NAME ## _") + set(FC_FUNC_ "NAME ## _") + else() + set(FC_FUNC "NAME ## _") + set(FC_FUNC_ "NAME ## __") + endif() + endif() +endif() + +# =============== FIGURING OUT FORTRAN NAME MANGLING END =============== + + +# ===================== config.h.in START ================== +# Generate config.h file +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in + ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY) + +# ===================== config.h.in END ===================== + +# ===================== config.fh.in START ================== + +set(CONFIGURE_FLAGS "FC=${CMAKE_Fortran_COMPILER_ID} FCFLAGS=${CMAKE_Fortran_FLAGS}") + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.fh.in + ${CMAKE_CURRENT_BINARY_DIR}/config.fh @ONLY) +# ===================== config.fh.in END ==================== + + +# ===================== constants.h.in START ================ +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/constants.h.in + ${CMAKE_CURRENT_BINARY_DIR}/constants.h @ONLY) +# ===================== constants.h.in END ================== + +# ===================== precision.h.in START ================ +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/precision.h.in + ${CMAKE_CURRENT_BINARY_DIR}/precision.h @ONLY) +# ===================== precision.h.in END ================== + + +# ===================== version.fh.in START ================ +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.fh.in + ${CMAKE_CURRENT_BINARY_DIR}/version.fh @ONLY) +# ===================== version.h.in START ================ + +add_library(meshfem3D_config INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/config.h) +add_library(meshfem3D::config ALIAS meshfem3D_config) +target_include_directories(meshfem3D_config INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) + +add_library(meshfem3D_config_fortran INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/config.fh) +add_library(meshfem3D::config_fortran ALIAS meshfem3D_config_fortran) +target_include_directories(meshfem3D_config_fortran INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) -add_library(meshfem3D_constants INTERFACE constants.h) +add_library(meshfem3D_constants INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/constants.h) add_library(meshfem3D::constants ALIAS meshfem3D_constants) -target_include_directories(meshfem3D_constants INTERFACE ./) +target_include_directories(meshfem3D_constants INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) -add_library(meshfem3D_config INTERFACE config.h) -add_library(meshfem3D::config ALIAS meshfem3D_config) -target_include_directories(meshfem3D_config INTERFACE ./) +add_library(meshfem3D_precision INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/precision.h) +add_library(meshfem3D::precision ALIAS meshfem3D_precision) +target_include_directories(meshfem3D_precision INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) + +add_library(meshfem3D_version INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/version.fh) +add_library(meshfem3D::version ALIAS meshfem3D_version) +target_include_directories(meshfem3D_version INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/fortran/meshfem3d/setup/config.fh b/fortran/meshfem3d/setup/config.fh deleted file mode 100644 index 1be3cb095..000000000 --- a/fortran/meshfem3d/setup/config.fh +++ /dev/null @@ -1,111 +0,0 @@ -!===================================================================== -! -! S p e c f e m 3 D -! ----------------- -! -! Main historical authors: Dimitri Komatitsch and Jeroen Tromp -! CNRS, France -! and Princeton University, USA -! (there are currently many more authors!) -! (c) October 2017 -! -! This program is free software; you can redistribute it and/or modify -! it under the terms of the GNU General Public License as published by -! the Free Software Foundation; either version 3 of the License, or -! (at your option) any later version. -! -! This program is distributed in the hope that it will be useful, -! but WITHOUT ANY WARRANTY; without even the implied warranty of -! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -! GNU General Public License for more details. -! -! You should have received a copy of the GNU General Public License along -! with this program; if not, write to the Free Software Foundation, Inc., -! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -! -!===================================================================== - -!----------------------------------------------------------------------- -! -! ADIOS -! -!----------------------------------------------------------------------- - -! for ADIOS header informations - -! configuration flags to be saved in the adios output file. -#define CONFIGURE_FLAGS "FC=gfortran FCFLAGS=-g -O2" - -! Define to the full name and version of this package. -#define PACKAGE_STRING "Specfem3D 4.1.1" - -!> \def STRINGIFY_VAR(a) -!! Macro taking a variable and returning the stringified variable and -!! the variable itself. -!! STRINGIFY_VAR(x) expand as: -!! "x", x -!! x being the variable name inside the code. -#ifdef __INTEL_COMPILER -#define STRINGIFY_VAR(a) #a, a -#elif __PGI -#define STRINGIFY_VAR(a) #a, a -#else -#define STRINGIFY_VAR(a) "a", a -#endif -!> \def STRINGIFY_VAR_TYPE(t,a) -!! STRINGIFY_VAR_TYPE(type,x) expand as: -!! "x", type%x -!! x being the variable name inside the code. type being the type variable. -#ifdef __INTEL_COMPILER -#define STRINGIFY_VAR_TYPE(t,a) #a, t%a -#else -#define STRINGIFY_VAR_TYPE(t,a) "a", t%a -#endif - -! for debugging -#define DEBUG_ADIOS 0 -#if DEBUG_ADIOS == 1 /* low-level tracing */ -#define TRACE_ADIOS(x) print *,'***debug ADIOS: ',x,' ***' -#define TRACE_ADIOS_ARG(x,y) print *,'***debug ADIOS: ',x,y,' ***' -#define TRACE_ADIOS_L2(x) -#define TRACE_ADIOS_L2_ARG(x,y) -#elif DEBUG_ADIOS == 2 /* high-level tracing */ -#define TRACE_ADIOS(x) print *,'***debug ADIOS: ',x,' ***' -#define TRACE_ADIOS_ARG(x,y) print *,'***debug ADIOS: ',x,y,' ***' -#define TRACE_ADIOS_L2(x) print *,'***debug ADIOS: ',x,' ***' -#define TRACE_ADIOS_L2_ARG(x,y) print *,'***debug ADIOS: ',x,y,' ***' -#else -#define TRACE_ADIOS(x) -#define TRACE_ADIOS_ARG(x,y) -#define TRACE_ADIOS_L2(x) -#define TRACE_ADIOS_L2_ARG(x,y) -#endif - -!----------------------------------------------------------------------- -! -! Force vectorization -! -!----------------------------------------------------------------------- - -! macros for vectorization - -! switches indexing between: array( i,j,k .. ) <-> array( ijk,1,1 .. ) -#ifdef FORCE_VECTORIZATION -# define INDEX_IJK ijk,1,1 -#else -# define INDEX_IJK i,j,k -#endif - -! switches do-loops between: do k=1,NGLLZ; do j=1,NGLLY; do i=1,NGLLX <-> do ijk=1,NGLLCUBE -#ifdef FORCE_VECTORIZATION -# define DO_LOOP_IJK do ijk = 1,NGLLCUBE -#else -# define DO_LOOP_IJK do k = 1,NGLLZ; do j = 1,NGLLY; do i = 1,NGLLX -#endif - -! switches enddo-loops between: enddo; enddo; enddo ! NGLLZ,NGLLY,NGLLX <-> enddo ! NGLLCUBE -#ifdef FORCE_VECTORIZATION -# define ENDDO_LOOP_IJK enddo ! NGLLCUBE -#else -# define ENDDO_LOOP_IJK enddo; enddo; enddo ! NGLLZ,NGLLY,NGLLX -#endif diff --git a/fortran/meshfem3d/setup/config.h b/fortran/meshfem3d/setup/config.h deleted file mode 100644 index 003fcd6cb..000000000 --- a/fortran/meshfem3d/setup/config.h +++ /dev/null @@ -1,143 +0,0 @@ -/* setup/config.h. Generated from config.h.in by configure. */ -/* setup/config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to dummy 'main' function (if any) required to link to the Fortran - libraries. */ -/* #undef FC_DUMMY_MAIN */ - -/* Define if F77 and FC dummy 'main' functions are identical. */ -/* #undef FC_DUMMY_MAIN_EQ_F77 */ - -/* Define to a macro mangling the given C identifier (in lower and upper - case), which must not contain underscores, for linking with Fortran. */ -#define FC_FUNC(name, NAME) name##_ - -/* As FC_FUNC, but for C identifiers containing underscores. */ -#define FC_FUNC_(name, NAME) name##_ - -/* Define if emmintrin.h */ -/* #undef HAVE_EMMINTRIN */ - -/* Define if err.h */ -#define HAVE_ERR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the 'vtkCommon' library (-lvtkCommon). */ -/* #undef HAVE_LIBVTKCOMMON */ - -/* Define to 1 if you have the 'vtkDICOMParser' library (-lvtkDICOMParser). */ -/* #undef HAVE_LIBVTKDICOMPARSER */ - -/* Define to 1 if you have the 'vtkexpat' library (-lvtkexpat). */ -/* #undef HAVE_LIBVTKEXPAT */ - -/* Define to 1 if you have the 'vtkFiltering' library (-lvtkFiltering). */ -/* #undef HAVE_LIBVTKFILTERING */ - -/* Define to 1 if you have the 'vtkGenericFiltering' library - (-lvtkGenericFiltering). */ -/* #undef HAVE_LIBVTKGENERICFILTERING */ - -/* Define to 1 if you have the 'vtkGraphics' library (-lvtkGraphics). */ -/* #undef HAVE_LIBVTKGRAPHICS */ - -/* Define to 1 if you have the 'vtkRendering' library (-lvtkRendering). */ -/* #undef HAVE_LIBVTKRENDERING */ - -/* Define to 1 if you have the 'vtksys' library (-lvtksys). */ -/* #undef HAVE_LIBVTKSYS */ - -/* Define to 1 if you have the 'vtkzlib' library (-lvtkzlib). */ -/* #undef HAVE_LIBVTKZLIB */ - -/* Define if you have POSIX threads libraries and header files. */ -/* #undef HAVE_PTHREAD */ - -/* defined if Scotch is installed */ -#define HAVE_SCOTCH 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDIO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* define if the VTK library is available */ -/* #undef HAVE_VTK */ - -/* Define if xmmintrin.h */ -/* #undef HAVE_XMMINTRIN */ - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "see the wiki" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "Specfem3D" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "Specfem3D 4.1.1" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "Specfem3D" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "4.1.1" - -/* Define to necessary symbol if this constant uses a non-standard name on - your system. */ -/* #undef PTHREAD_CREATE_JOINABLE */ - -/* Define GIT branch for package source. */ -#define SPECFEM3D_GIT_BRANCH "devel" - -/* Define date of GIT commit for package source. */ -#define SPECFEM3D_GIT_DATE "2024-11-21 11:50:38 +0100" - -/* Define GIT hash for package source. */ -#define SPECFEM3D_GIT_HASH "725321e6599f90e486c907435840df559ebc0a9c" - -/* Define git revision commit for package source. */ -#define SPECFEM3D_GIT_REVISION "v4.1.1-100-g725321e6" - -/* Set to 0 if source is from GIT, 1 otherwise. */ -#define SPECFEM3D_RELEASE_VERSION 0 - -/* Define SPECFEM3D version */ -#define SPECFEM3D_VERSION "4.1.1" - -/* Define to 1 if all of the C89 standard headers exist (not just the ones - required in a freestanding environment). This macro is provided for - backward compatibility; new code need not use it. */ -#define STDC_HEADERS 1 - -/* Define to 1 if 'lex' declares 'yytext' as a 'char *' by default, not a - 'char[]'. */ -/* #undef YYTEXT_POINTER */ - -/* Define to select optimized file i/o for regional simulations */ -/* map fails when output files are > 4GB, which is often the case for GPU - * simulations */ -/* #undef USE_MAP_FUNCTION */ diff --git a/fortran/meshfem3d/setup/config.h.in b/fortran/meshfem3d/setup/config.h.in index 7a16e66a3..02a4b8eeb 100644 --- a/fortran/meshfem3d/setup/config.h.in +++ b/fortran/meshfem3d/setup/config.h.in @@ -1,142 +1,106 @@ -/* setup/config.h.in. Generated from configure.ac by autoheader. */ +/* config.h.in - Template for config.h, configured by CMake */ + /* Define to dummy 'main' function (if any) required to link to the Fortran - libraries. */ -#undef FC_DUMMY_MAIN + libraries. */ +#cmakedefine FC_DUMMY_MAIN /* Define if F77 and FC dummy 'main' functions are identical. */ -#undef FC_DUMMY_MAIN_EQ_F77 +#cmakedefine FC_DUMMY_MAIN_EQ_F77 /* Define to a macro mangling the given C identifier (in lower and upper - case), which must not contain underscores, for linking with Fortran. */ -#undef FC_FUNC + case), which must not contain underscores, for linking with Fortran. */ +#cmakedefine FC_FUNC(name,Name) @FC_FUNC@ /* As FC_FUNC, but for C identifiers containing underscores. */ -#undef FC_FUNC_ - -/* Define if emmintrin.h */ -#undef HAVE_EMMINTRIN - -/* Define if err.h */ -#undef HAVE_ERR - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the 'vtkCommon' library (-lvtkCommon). */ -#undef HAVE_LIBVTKCOMMON - -/* Define to 1 if you have the 'vtkDICOMParser' library (-lvtkDICOMParser). */ -#undef HAVE_LIBVTKDICOMPARSER - -/* Define to 1 if you have the 'vtkexpat' library (-lvtkexpat). */ -#undef HAVE_LIBVTKEXPAT - -/* Define to 1 if you have the 'vtkFiltering' library (-lvtkFiltering). */ -#undef HAVE_LIBVTKFILTERING - -/* Define to 1 if you have the 'vtkGenericFiltering' library - (-lvtkGenericFiltering). */ -#undef HAVE_LIBVTKGENERICFILTERING +#cmakedefine FC_FUNC_(name,Name) @FC_FUNC_@ -/* Define to 1 if you have the 'vtkGraphics' library (-lvtkGraphics). */ -#undef HAVE_LIBVTKGRAPHICS +/* Define to 1 if emmintrin.h is available. */ +#cmakedefine01 HAVE_EMMINTRIN -/* Define to 1 if you have the 'vtkRendering' library (-lvtkRendering). */ -#undef HAVE_LIBVTKRENDERING +/* Define to 1 if the header file is available. */ +#cmakedefine01 HAVE_ERR -/* Define to 1 if you have the 'vtksys' library (-lvtksys). */ -#undef HAVE_LIBVTKSYS +/* Define to 1 if the header file is available. */ +#cmakedefine01 HAVE_INTTYPES_H -/* Define to 1 if you have the 'vtkzlib' library (-lvtkzlib). */ -#undef HAVE_LIBVTKZLIB +/* Define to 1 if the following VTK libraries are available. */ +#cmakedefine01 HAVE_LIBVTKCOMMON +#cmakedefine01 HAVE_LIBVTKDICOMPARSER +#cmakedefine01 HAVE_LIBVTKEXPAT +#cmakedefine01 HAVE_LIBVTKFILTERING +#cmakedefine01 HAVE_LIBVTKGENERICFILTERING +#cmakedefine01 HAVE_LIBVTKGRAPHICS +#cmakedefine01 HAVE_LIBVTKRENDERING +#cmakedefine01 HAVE_LIBVTKSYS +#cmakedefine01 HAVE_LIBVTKZLIB -/* Define if you have POSIX threads libraries and header files. */ -#undef HAVE_PTHREAD +/* Define if POSIX threads are available. */ +#cmakedefine01 HAVE_PTHREAD /* defined if Scotch is installed */ -#undef HAVE_SCOTCH +#cmakedefine HAVE_SCOTCH -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H +/* Define to 1 if the header file is available. */ +#cmakedefine01 HAVE_STDINT_H -/* Define to 1 if you have the header file. */ -#undef HAVE_STDIO_H +/* Define to 1 if the header file is available. */ +#cmakedefine01 HAVE_STDIO_H -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H +/* Define to 1 if the header file is available. */ +#cmakedefine01 HAVE_STDLIB_H -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H +/* Define to 1 if the header file is available. */ +#cmakedefine01 HAVE_STRINGS_H -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H +/* Define to 1 if the header file is available. */ +#cmakedefine01 HAVE_STRING_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H +/* Define to 1 if the header file is available. */ +#cmakedefine01 HAVE_SYS_STAT_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H +/* Define to 1 if the header file is available. */ +#cmakedefine01 HAVE_SYS_TYPES_H -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H +/* Define to 1 if the header file is available. */ +#cmakedefine01 HAVE_UNISTD_H -/* define if the VTK library is available */ -#undef HAVE_VTK +/* Define if VTK is available */ +#cmakedefine HAVE_VTK -/* Define if xmmintrin.h */ -#undef HAVE_XMMINTRIN +/* Define to 1 if xmmintrin.h is available. */ +#cmakedefine01 HAVE_XMMINTRIN -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION +/* Define package information */ +#cmakedefine PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" +#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@" +#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@" +#cmakedefine PACKAGE_TARNAME "@PACKAGE_TARNAME@" +#cmakedefine PACKAGE_URL "@PACKAGE_URL@" +#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@" /* Define to necessary symbol if this constant uses a non-standard name on - your system. */ -#undef PTHREAD_CREATE_JOINABLE - -/* Define GIT branch for package source. */ -#undef SPECFEM3D_GIT_BRANCH - -/* Define date of GIT commit for package source. */ -#undef SPECFEM3D_GIT_DATE - -/* Define GIT hash for package source. */ -#undef SPECFEM3D_GIT_HASH - -/* Define git revision commit for package source. */ -#undef SPECFEM3D_GIT_REVISION + your system. I did not know how to check for that. */ +#cmakedefine PTHREAD_CREATE_JOINABLE @PTHREAD_CREATE_JOINABLE@ -/* Set to 0 if source is from GIT, 1 otherwise. */ -#undef SPECFEM3D_RELEASE_VERSION +/* Define Git information */ +#cmakedefine SPECFEM3D_GIT_BRANCH "@SPECFEM3D_GIT_BRANCH@" +#cmakedefine SPECFEM3D_GIT_DATE "@SPECFEM3D_GIT_DATE@" +#cmakedefine SPECFEM3D_GIT_HASH "@SPECFEM3D_GIT_HASH@" +#cmakedefine SPECFEM3D_GIT_REVISION "@SPECFEM3D_GIT_REVISION@" +#cmakedefine SPECFEM3D_RELEASE_VERSION @SPECFEM3D_RELEASE_VERSION@ +#cmakedefine SPECFEM3D_VERSION "@SPECFEM3D_VERSION@" -/* Define SPECFEM3D version */ -#undef SPECFEM3D_VERSION /* Define to 1 if all of the C89 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ -#undef STDC_HEADERS +#define STDC_HEADERS 1 /* Define to 1 if 'lex' declares 'yytext' as a 'char *' by default, not a - 'char[]'. */ -#undef YYTEXT_POINTER + 'char[]'. */ +/* #undef YYTEXT_POINTER */ -/* Define to select optimized file i/o for regional simulations */ -/* map fails when output files are > 4GB, which is often the case for GPU simulations */ -#undef USE_MAP_FUNCTION +/* Define if using optimized file I/O for regional simulations. */ +#cmakedefine01 USE_MAP_FUNCTION diff --git a/fortran/meshfem3d/setup/constants.h b/fortran/meshfem3d/setup/constants.h deleted file mode 100644 index 5f3a18605..000000000 --- a/fortran/meshfem3d/setup/constants.h +++ /dev/null @@ -1,894 +0,0 @@ -!===================================================================== -! -! S p e c f e m 3 D -! ----------------- -! -! Main historical authors: Dimitri Komatitsch and Jeroen Tromp -! CNRS, France -! and Princeton University, USA -! (there are currently many more authors!) -! (c) October 2017 -! -! This program is free software; you can redistribute it and/or modify -! it under the terms of the GNU General Public License as published by -! the Free Software Foundation; either version 3 of the License, or -! (at your option) any later version. -! -! This program is distributed in the hope that it will be useful, -! but WITHOUT ANY WARRANTY; without even the implied warranty of -! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -! GNU General Public License for more details. -! -! You should have received a copy of the GNU General Public License along -! with this program; if not, write to the Free Software Foundation, Inc., -! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -! -!===================================================================== - -! setup/constants.h. Generated from constants.h.in by configure. - -! -! solver in single or double precision depending on the machine (4 or 8 bytes) -! -! ALSO CHANGE FILE precision.h ACCORDINGLY -! - integer, parameter :: SIZE_REAL = 4 - integer, parameter :: SIZE_DOUBLE = 8 - -! usually the size of integer and logical variables is the same as regular single-precision real variable - integer, parameter :: SIZE_INTEGER = SIZE_REAL - integer, parameter :: SIZE_LOGICAL = SIZE_REAL - -! set to SIZE_REAL to run in single precision -! set to SIZE_DOUBLE to run in double precision (increases memory size by 2) - integer, parameter :: CUSTOM_REAL = SIZE_REAL - -! set to .false. if running on a Beowulf-type machine with local disks -! set to .true. if running on a shared-memory machine with common file system -! if running on a Beowulf, also modify name of nodes in filter_machine_file.f90 - logical, parameter :: LOCAL_PATH_IS_ALSO_GLOBAL = .true. - - -!----------- parameters that can be changed by the user ----------- - - -!!----------------------------------------------------------- -!! -!! Gauss-Lobatto-Legendre resolution -!! -!!----------------------------------------------------------- - -! number of GLL points in each direction of an element (degree plus one) - integer, parameter :: NGLLX = 5 - integer, parameter :: NGLLY = NGLLX - integer, parameter :: NGLLZ = NGLLX - -!!----------------------------------------------------------- -!! -!! I/O output -!! -!!----------------------------------------------------------- - -! input, output and main MPI I/O files -! note: careful with these unit numbers, we mostly use units in the 40-50 range. -! Cray Fortran e.g. reserves 0,5,6 (standard error,input,output units) and 100,101,102 (input,output,error unit) - integer, parameter :: ISTANDARD_OUTPUT = 6 - integer, parameter :: IIN = 40,IOUT = 41 - -! uncomment this to write messages to a text file - integer, parameter :: IMAIN = 42 -! uncomment this to write messages to the screen -! integer, parameter :: IMAIN = ISTANDARD_OUTPUT - -! I/O unit for noise simulations - integer, parameter :: IIN_NOISE = 44, IOUT_NOISE = 45 -! I/O unit for SU formatted seismograms - integer, parameter :: IOUT_SU = 46 -! I/O unit for SU formatted adjoint sources - integer, parameter :: IIN_SU1 = 47, IIN_SU2 = 48, IIN_SU3 = 49 -! I/O unit for source and receiver vtk file - integer, parameter :: IOUT_VTK = 50 -! I/O unit for plotting source time function (I/O read & write) - integer, Parameter :: IO_STF = 51 -! I/O for total energy calculation - integer, parameter :: IOUT_ENERGY = 52 -! I/O for faults - integer, parameter :: IIN_PAR = 53, IIN_BIN = 54, IIN_FLT = 55 -! I/O for decompose - integer, parameter :: IIN_DB = 56, IIN_DB2 = 57 -! I/O for gravity - integer, parameter :: IIN_G = 58 - -! I/O number for absorbing boundary snapshots (opened in C for speed) -! Not a Fortran I/O unit! See write_c_binary.c for more information. - integer, parameter :: IOABS = 0 - integer, parameter :: IOABS_AC = 1 - -! ignore variable name field (junk) at the beginning of each input line - logical, parameter :: IGNORE_JUNK = .true.,DONT_IGNORE_JUNK = .false. - -! maximum length of strings used for paths, reading from files, etc. - integer, parameter :: MAX_STRING_LEN = 512 - -!!----------------------------------------------------------- -!! -!! directory structure -!! -!!----------------------------------------------------------- - -! paths for inputs and outputs files - character(len=*), parameter :: OUTPUT_FILES_BASE = './OUTPUT_FILES/' - -!!----------------------------------------------------------- -!! -!! smoothing of the sensitivity kernels -!! -!!----------------------------------------------------------- - -! using this is more precise but more costly (but will be replaced with a cheap Bessel smoothing in the near future) - logical, parameter :: USE_QUADRATURE_RULE_FOR_SMOOTHING = .true. - -! kernel debugging -! flag to save GLL weights for kernel benchmark examples - logical,parameter :: SAVE_WEIGHTS = .false. - -!!----------------------------------------------------------- -!! -!! gravity integral calculations -!! -!!----------------------------------------------------------- - -!! DK DK for gravity integrals - logical, parameter :: GRAVITY_INTEGRALS = .false. !!! .true. - -! check for negative Jacobians in the calculation of integrals or not -! (can safely be done once to check that the mesh is OK at a given resolution, and then permanently -! turned off in future runs because the mesh does not change) - logical, parameter :: CHECK_FOR_NEGATIVE_JACOBIANS = .true. - -! file that contains the observation grid (which is a simple ASCII file, with x y z of each point on separate lines) - character(len=*), parameter :: OBSERVATION_GRID_FILE = './DATA/observation_grid_to_use_for_gravity.txt' - -! number of points in the observation grid - integer, parameter :: NTOTAL_OBSERVATION = 4 - -! a receiver at which we check and output the gravity field (for display purposes only; you can thus safely leave it unchanged) - integer, parameter :: iobs_receiver = 1 - -! how often (every how many spectral elements computed) we print a timestamp to monitor the behavior of the code - integer, parameter :: NSPEC_DISPLAY_INTERVAL = 1000 - -! definition of an Eotvos compared to S.I. units. -! The unit of gravity gradient is the Eotvos, which is equivalent to 1e-9 s-2 (or 1e-4 mGal/m). -! A person walking at a distance of 2 meters provides a gravity gradient signal of approximately one Eotvos. -! Mountains can create signals of several hundred Eotvos. - double precision, parameter :: SI_UNITS_TO_EOTVOS = 1.d+9 - -!!----------------------------------------------------------- -!! -!! source/receiver setup -!! -!!----------------------------------------------------------- - -! sources - -! flag to print the details of source location - logical, parameter :: SHOW_DETAILS_LOCATE_SOURCE = .false. - -! maximum length of station and network name for receivers - integer, parameter :: MAX_LENGTH_STATION_NAME = 32 - integer, parameter :: MAX_LENGTH_NETWORK_NAME = 8 - -! number of sources to be gathered by MPI_Gather - integer, parameter :: NGATHER_SOURCES = 100 - -! we mimic a triangle of half duration equal to half_duration_triangle -! using a Gaussian having a very close shape, as explained in Figure 4.2 -! of the manual. This source decay rate to mimic an equivalent triangle -! was found by trial and error - double precision, parameter :: SOURCE_DECAY_MIMIC_TRIANGLE = 1.628d0 - -! monochromatic source time function -! flag to use monochromatic source time function for CMT sources - logical, parameter :: USE_MONOCHROMATIC_CMT_SOURCE = .false. -! This parameter determines the taper length of monochromatic source time function in seconds - double precision, parameter :: TAPER_MONOCHROMATIC_SOURCE = 200.0d0 - -! receivers - -! use this t0 as earliest starting time rather than the automatically calculated one -! (must be positive and bigger than the automatically one to be effective; -! simulation will start at t = - t0) - double precision, parameter :: USER_T0 = 0.0d0 - -! the receivers can be located inside the model - logical, parameter :: RECEIVERS_CAN_BE_BURIED = .true. - logical, parameter :: SOURCES_CAN_BE_BURIED = .true. - -! the seismograms are normal to the surface. -! the Z record corresponds to the normal, while E and N are two tangent vectors -! that completes an orthonormal. - logical, parameter :: EXTERNAL_MESH_RECEIVERS_NORMAL = .false. - -! maximum number of sources and receivers to locate simultaneously - integer, parameter :: NSOURCES_SUBSET_MAX = 100 - integer, parameter :: NREC_SUBSET_MAX = 200 - -! use brute-force search (loop over all elements) or search in kd-tree for locating target point in mesh -! (brute-force search will be slower but even more accurate) - logical, parameter :: DO_BRUTE_FORCE_POINT_SEARCH = .false. - -! minimum number of stations for using hash table in duplets search - integer, parameter :: DUPLETS_NREC_MINIMUM_FOR_HASH = 10000 - -!!----------------------------------------------------------- -!! -!! CPML perfectly matched absorbing layers -!! -!!----------------------------------------------------------- - -! power (exponent) used for the PML damping profile - double precision, parameter :: NPOWER = 1.d0 - -! C-PML theoretical reflection coefficient -! (INRIA research report section 6.1: http://hal.inria.fr/docs/00/07/32/19/PDF/RR-3471.pdf) - double precision, parameter :: CPML_Rcoef = 0.001d0 - -! flags for the seven CPML regions - integer, parameter :: CPML_X_ONLY = 1 - integer, parameter :: CPML_Y_ONLY = 2 - integer, parameter :: CPML_Z_ONLY = 3 - integer, parameter :: CPML_XY_ONLY = 4 - integer, parameter :: CPML_XZ_ONLY = 5 - integer, parameter :: CPML_YZ_ONLY = 6 - integer, parameter :: CPML_XYZ = 7 - -! tolerance to automatically detect where the PMLs are in the case of the internal mesher - double precision, parameter :: SMALL_PERCENTAGE_TOLERANCE = 1.005d0 - -! The outer boundary condition to use for PML elements in fluid layers is Neumann for the potential -! because we need Dirichlet conditions for the displacement vector, which means Neumann for the potential. -! Thus, there is nothing to enforce explicitly here. -! There is something to enforce explicitly only in the case of elastic elements, for which a Dirichlet -! condition is needed for the displacement vector, which is the vectorial unknown for these elements. - -!! DK DK this paragraph seems to be from Zhinan or from ChangHua: -! However, enforcing explicitly potential_dot_dot_acoustic, potential_dot_acoustic, potential_acoustic -! to be zero on outer boundary of PML help to improve the accuracy of absorbing low-frequency wave components -! in case of long-time simulation. - -! impose Dirichlet conditions for the potential (i.e. Neumann for displacement) on the outer edges of the C-PML layers - logical, parameter :: SET_NEUMANN_RATHER_THAN_DIRICHLET_FOR_FLUID_PMLs = .true. - -!!----------------------------------------------------------- -!! -!! For coupling with EXTERNAL CODE -!! -!!----------------------------------------------------------- - -! add support for AXISEM and FK as external codes, not only DSM - integer, parameter :: INJECTION_TECHNIQUE_IS_DSM = 1 - integer, parameter :: INJECTION_TECHNIQUE_IS_AXISEM = 2 - integer, parameter :: INJECTION_TECHNIQUE_IS_FK = 3 - -! Big storage version of coupling with DSM (will always set to .false. after the light storage version will be validated) - logical, parameter :: old_DSM_coupling_from_Vadim = .true. - -! First run to store on boundaries for using reciprocity calculate Kirchoff-Helmholtz integral - logical, parameter :: SAVE_RUN_BOUN_FOR_KH_INTEGRAL = .false. - -! for subroutine compute_vol_or_surf_integral_on_whole_domain - integer, parameter :: Surf_or_vol_integral = 1 !!! 1 = Surface integral, 2 = Volume, 3 = Both - -! some old tests (currently unstable; do not remove them though, we might fix this one day) - integer, parameter :: Ntime_step_dsm = 100 - integer, parameter :: IIN_veloc_dsm = 51, IIN_tract_dsm = 52 - integer, parameter :: IIN_displ_axisem = 54 - -!!----------------------------------------------------------- -!! -!! Prescribed wavefield discontinuity on an interface -!! -!!----------------------------------------------------------- - - -! I/O for wavefield discontinuity - integer, parameter :: IFILE_WAVEFIELD_DISCONTINUITY = 527 - -! file name for ASCII wavefield discontinuity interface file - character(len=*), parameter :: FNAME_WAVEFIELD_DISCONTINUITY_INTERFACE = 'wavefield_discontinuity_interface' - -! file name for ASCII wavefield discontinuity box file - character(len=*), parameter :: FNAME_WAVEFIELD_DISCONTINUITY_BOX = 'wavefield_discontinuity_box' - -! file name for binary wavefield discontinuity mesh file - character(len=*), parameter :: FNAME_WAVEFIELD_DISCONTINUITY_MESH = 'wavefield_discontinuity_mesh.bin' - -! file name for binary wavefield discontinuity solver database file - character(len=*), parameter :: FNAME_WAVEFIELD_DISCONTINUITY_DATABASE = 'wavefield_discontinuity_database.bin' - -!!----------------------------------------------------------- -!! -!! mesh optimization -!! -!!----------------------------------------------------------- - -! empirical choice for distorted elements to estimate time step and period resolved: -! Courant number for time step estimate - real(kind=CUSTOM_REAL),parameter :: COURANT_SUGGESTED = 0.5 - -! number of points per minimum wavelength for minimum period estimate - real(kind=CUSTOM_REAL),parameter :: NPTS_PER_WAVELENGTH = 5 - -! separates regular/irregular shaped elements - logical, parameter :: DO_IRREGULAR_ELEMENT_SEPARATION = .true. - -! mesh partitioning algorithms, choices for PARTITIONING_TYPE -! SCOTCH is original to program - integer, parameter :: SCOTCH = 1 -! METIS is another popular alternative currently in development - integer, parameter :: METIS = 2 -! PATOH is mostly used for LTS. It balances the p-levels across partitions as well as balancing total elements. - integer, parameter :: PATOH = 3 -! simple row partitioning - integer, parameter :: ROWS_PART = 4 - -! face detection distance tolerance (relative to coordinate range) - double precision, parameter :: TOLERANCE_FACE_DETECTION = 1.d-4 - -!!----------------------------------------------------------- -!! -!! GPU optimization -!! -!!----------------------------------------------------------- -! added these parameters for the GPU version of the solver - -! mesh coloring -! add mesh coloring for the GPU + MPI implementation -! this is needed on NVIDIA hardware up to FERMI boards, included. -! Starting on KEPLER boards you can leave it off because on KEPLER hardware -! or higher atomic reduction operations have become as fast as resorting to mesh coloring. - logical, parameter :: USE_MESH_COLORING_GPU = .false. - integer, parameter :: MAX_NUMBER_OF_COLORS = 1000 -! enhanced coloring: -! using Droux algorithm -! try several times with one more color before giving up - logical, parameter :: USE_DROUX_OPTIMIZATION = .false. - integer, parameter :: MAX_NB_TRIES_OF_DROUX_1993 = 15 -! using balancing algorithm -! postprocess the colors to balance them if Droux (1993) algorithm is not used - logical, parameter :: BALANCE_COLORS_SIMPLE_ALGO = .false. - -!!----------------------------------------------------------- -!! -!! ADIOS Related values -!! -!!----------------------------------------------------------- - -! for undo_att snapshots -! use only one file for all steps or a single file per iteration step - logical, parameter :: ADIOS_SAVE_ALL_SNAPSHOTS_IN_ONE_FILE = .true. - -! type selection to use compression operation before saving undo_att forward snapshot arrays -! compression algorithm: 0 == none / 1 == ZFP compression / 2 == SZ compression (needs to be supported by ADIOS2 library) - integer, parameter :: ADIOS_COMPRESSION_ALGORITHM = 0 ! (default none) - -!! ZFP compression -! mode options: see https://zfp.readthedocs.io/en/release0.5.5/modes.html -! parameters: 'rate' w/ value '8' - fixed-rate mode: choose values between ~8-20, higher for better accuracy -! 'accuracy' w/ value '0.01' - fixed-accuracy mode: choose smaller value for better accuracy -! 'precision' w/ value '10' - fixed-precision mode: choose between ~10-50, higher for better accuracy -! (https://www.osti.gov/pages/servlets/purl/1572236) -! -! test setup: global simulation (s362ani model), NEX=160, ADIOS 2.5.0 -! duration 30 min, 9 snapshot files (w/ estimated total size 117.6 GB) -! - {'rate','8'} leads to a rather constant compression by using (8+1)-bit representation for 4 32-bit floats -! compression rate factor: ~3.98x (123474736 Bytes / 30998320 Bytes ~ 118 GB / 30GB) -! betav_kl_crust_mantle total norm of difference : 2.6486799E-22 -! - {'rate','12'} has better accuracy (leading to small wavefield perturbations) -! compression rate factor: ~2.65x (123474736 Bytes / 46423124 Bytes ~ 118 GB / 45GB) -! betav_kl_crust_mantle total norm of difference : 4.3890730E-24 -! - {'precision','10'} leads to a more variable compression for wavefields depending on their dynamic range -! compression rate factor: ~4.05x (123474736 Bytes / 30460388 Bytes ~ 118 GB / 30 GB) -! betav_kl_crust_mantle total norm of difference : 5.3706092E-24 -! - {'precision','12'} has better accuracy (leading to small wavefield perturbations) -! compression rate factor: ~3.43x (123474736 Bytes / 35972672 Bytes ~ 118 GB / 35GB) -! betav_kl_crust_mantle total norm of difference : 1.9846376E-25 -! - {'precision','20'} has good accuracy (almost identical reconstructed waveforms) -! compression rate factor: ~2.12x (123474736 Bytes / 58020080 Bytes ~ 118 GB / 56 GB) -! betav_kl_crust_mantle total norm of difference : 2.5939579E-30 -! -! performance overhead for compressing/decompressing is negligible in all cases -! (a few seconds, compared to minutes for the total simulaton) -! -! a default setting of {'precision','12'} seems a good compromise between accuracy and compression rate - character(len=*), parameter :: ADIOS_COMPRESSION_MODE = 'precision' ! 'precision','rate' - character(len=*), parameter :: ADIOS_COMPRESSION_MODE_VALUE = '12' ! '8','12,'20' - -!! SZ compression -! parameters: 'accuracy', value '0.0000000001' = 1.e-10 -! leaving empty '','' chooses automatic setting? to check... - !character(len=*), parameter :: ADIOS_COMPRESSION_MODE = '' - !character(len=*), parameter :: ADIOS_COMPRESSION_MODE_VALUE = '' - -!! LZ4 compression (lossless) -! parameters: level 'lvl=9' and 'threshold=4096' 4K-bytes - !character(len=*), parameter :: ADIOS_COMPRESSION_MODE = 'lvl' - !character(len=*), parameter :: ADIOS_COMPRESSION_MODE_VALUE = '9,threshold=4096' - -! size of the ADIOS buffer to use - integer, parameter :: ADIOS_BUFFER_SIZE_IN_MB = 400 - -! ADIOS transport methods (see ADIOS manual for details) -!! MPI (default) - character(len=*), parameter :: ADIOS_TRANSPORT_METHOD = "MPI" - character(len=*), parameter :: ADIOS_METHOD_PARAMS = '' - -! ADIOS transport methods for undo save_frame** data files -!! MPI (default) - character(len=*), parameter :: ADIOS_TRANSPORT_METHOD_UNDO_ATT = "MPI" - character(len=*), parameter :: ADIOS_METHOD_PARAMS_UNDO_ATT = '' -! or -!! POSIX -! character(len=*), parameter :: ADIOS_TRANSPORT_METHOD_UNDO_ATT = "POSIX" -! character(len=*), parameter :: ADIOS_METHOD_PARAMS_UNDO_ATT = '' -! or -!! MPI_AGGREGATE -! character(len=*), parameter :: ADIOS_TRANSPORT_METHOD_UNDO_ATT = "MPI_AGGREGATE" -! character(len=*), parameter :: ADIOS_METHOD_PARAMS_UNDO_ATT = "num_aggregators=64,num_ost=672" -! or -!! MPI_LUSTRE -! character(len=*), parameter :: ADIOS_TRANSPORT_METHOD_UNDO_ATT = "MPI_LUSTRE" -! character(len=*), parameter :: ADIOS_METHOD_PARAMS_UNDO_ATT = "stripe_count=16,stripe_size=4194304,block_size=4194304" - -!!----------------------------------------------------------- -!! -!! ADIOS2 Related values -!! -!!----------------------------------------------------------- - -! ADIOS2 engines -!! note on native engine types: -!! - "MPI" is not supported yet by adios2 version (current 2.6.0), check out in future. -!! - "HDF5" doesn't support file appending yet, which is needed at the moment. -!! - "BPfile" doesn't support file appending yet, which is needed at the moment. -!! - "BP3" would allow for backward compatibility to ADIOS 1.x, but doesn't support file appending yet. -!! - "BP4" is the new adios2 format with enhanced capabilities. -!! we will use "BP4" by default. -!! -!! BP4 -!! format details: https://adios2.readthedocs.io/en/latest/engines/engines.html#bp4 -!! -!! note: parameter SubStreams=64 for larger runs with NPROCS > 64 creates problems when reading scalar values (in appended mode), -!! try to avoid it for now as default parameter. -!! for undo_att, it seems to work however and can be used in ADIOS2_ENGINE_PARAMS_UNDO_ATT setting. -!! -!! in future adios2 versions, re-evalute if parameters could be "SubStreams=64,MaxBufferSize=800Mb" for larger runs - character(len=*), parameter :: ADIOS2_ENGINE_DEFAULT = "BP4" - character(len=*), parameter :: ADIOS2_ENGINE_PARAMS_DEFAULT = "" ! add "MaxBufferSize=800Mb" for larger runs - - character(len=*), parameter :: ADIOS2_ENGINE_UNDO_ATT = "BP4" - character(len=*), parameter :: ADIOS2_ENGINE_PARAMS_UNDO_ATT = "" ! add "SubStreams=64,MaxBufferSize=800Mb" for larger runs - - -!!----------------------------------------------------------- -!! -!! ASDF parameters -!! -!!----------------------------------------------------------- - -! keeps track of everything -! stores specfem provenance string in ASDF file - logical, parameter :: ASDF_OUTPUT_PROVENANCE = .false. - -! ASDF string lengths - integer, parameter :: ASDF_MAX_STRING_LENGTH = 1024 - integer, parameter :: ASDF_MAX_QUAKEML_LENGTH = 8096 - integer, parameter :: ASDF_MAX_STATIONXML_LENGTH = 16182 - integer, parameter :: ASDF_MAX_PARFILE_LENGTH = 25000 - integer, parameter :: ASDF_MAX_CONSTANTS_LENGTH = 65000 - integer, parameter :: ASDF_MAX_TIME_STRING_LENGTH = 22 - -!!----------------------------------------------------------- -!! -!! image output -!! -!!----------------------------------------------------------- - -! plots VTK cross-section planes instead of model surface -! (EXPERIMENTAL feature) -! (requires MOVIE_SURFACE set to .true. in Par_file) - logical, parameter :: PLOT_CROSS_SECTIONS = .false. - real(kind=CUSTOM_REAL),parameter :: CROSS_SECTION_X = 67000.0_CUSTOM_REAL - real(kind=CUSTOM_REAL),parameter :: CROSS_SECTION_Y = 65500.0_CUSTOM_REAL - real(kind=CUSTOM_REAL),parameter :: CROSS_SECTION_Z = -30000.0_CUSTOM_REAL - -! plots PNM cross-section image -! (EXPERIMENTAL feature) -! (additional cross-section parameters can be specified in create_color_image.f90) -! todo: here for performance and to reduce the size of the files, one day -! we should switch to using the JPEG library directly, as already implemented in SPECFEM2D - logical, parameter :: PNM_IMAGE = .false. - -! geometry tolerance parameter to calculate number of independent grid points -! sensitive to actual size of model, assumes reference sphere of radius 1 -! this is an absolute value for normalized coordinates in the Earth - double precision, parameter :: SMALLVAL_TOL = 1.d-10 - -!!----------------------------------------------------------- -!! -!! in-situ visualization (using VTK) -!! -!!----------------------------------------------------------- - -! use low-res/hi-res mesh point locations (corners only or all GLL points) - logical, parameter :: VTK_USE_HIRES = .false. - -! show free surface points - logical, parameter :: VTK_SHOW_FREESURFACE = .true. - -! show volumetric field - logical, parameter :: VTK_SHOW_VOLUME = .true. - -!!----------------------------------------------------------- -!! Option to run several events within the same MPI slice when using GPU acoustic simulations -!!----------------------------------------------------------- - - integer, parameter :: NB_RUNS_ACOUSTIC_GPU = 1 - -!!----------------------------------------------------------- -!! -!! local time stepping (LTS) -!! -!!----------------------------------------------------------- - -! decreases coarsest time step by this percentage factor - double precision,parameter :: LTS_SAFETY_MARGIN = 0.05d0 - -! adds overlap elements - logical,parameter :: LTS_OVERLAP_REGION = .false. - -! uses only 1 single p-level - logical,parameter :: LTS_SINGLE_P_LEVEL = .false. -! uses only 2 p-levels - logical,parameter :: LTS_TWO_P_LEVEL = .false. - -! decreases final coarsest time step for stability -! note: LTS must decrease time step for stability depending on p depth; -! to avoid this decrease, one can try to overlap the fine region by one/two elements. -! by default, we add an LTS_SAFETY_MARGIN to the suggested LTS time steps and LTS element binning; -! where the coarsest time step is calculated as a multiple of the user DT input in Par_file. -! here, we can further decrease this coarsest step for LTS simulations to add additional stability. - logical,parameter :: LTS_DECREASE_DT = .false. -! time step margin to use for decrease - double precision,parameter :: LTS_STABILITY_MARGIN_DT = 0.6d0 - -! scotch: balancing of p-levels - logical,parameter :: BALANCE_P_LEVELS = .true. -! scotch balancing of p-levels using partial subsets of processes to distribute p-elements - logical,parameter :: BALANCE_P_LEVELS_PARTIAL = .false. -! p-level partitions shouldn't be smaller than this - integer,parameter :: P_LEVEL_PARTIAL_SUBSET_MINIMUM = 200 - -! partitioning for Local time stepping -! tries to partition mesh such that p-levels are confined to an island (for METIS/PATOH) - logical,parameter :: PLEVEL_ISLAND = .false. - -! reorganize the partitions to try to optimize communication costs (for SCOTCH only) - logical,parameter :: SCOTCH_P_REMAP = .true. - -!!----------------------------------------------------------- -!! -!! Fault solver -!! -!!----------------------------------------------------------- - -! allows for parallelizing fault surfaces across different MPI slices - logical, parameter :: PARALLEL_FAULT = .true. - -! to stabilize simulation: -! synchronizes displ and veloc arrays across different MPI processes -! (such that all process have the same values on the MPI halo points) - logical ,parameter :: FAULT_SYNCHRONIZE_DISPL_VELOC = .false. - -! synchronizes accel array across different MPI processes - logical ,parameter :: FAULT_SYNCHRONIZE_ACCEL = .false. - -!!----------------------------------------------------------- -!! -!! MPI debugging -!! -!!----------------------------------------------------------- - -! debugging: without MPI assembly - logical,parameter :: ASSEMBLE_MPI_OFF = .false. - -!!----------------------------------------------------------- -!! -!! undo attenuation validation -!! -!!----------------------------------------------------------- - -! for validation of undoing of attenuation versus an exact solution saved to disk -! should never be needed any more, it was developed and used for Figure 3 of -! D. Komatitsch, Z. Xie, E. Bozdag, E. Sales de Andrade, D. Peter, Q. Liu and J. Tromp, -! Anelastic sensitivity kernels with parsimonious storage for adjoint tomography and full waveform inversion, -! Geophysical Journal International, vol. 206(3), p. 1467-1478, doi: 10.1093/gji/ggw224 (2016). - logical, parameter :: EXACT_UNDOING_TO_DISK = .false. -! ID of the huge file in which we dump all the time steps of the simulation - integer, parameter :: IFILE_FOR_EXACT_UNDOING = 244 - -!------------------------------------------------------ -!----------- do not modify anything below ------------- -!------------------------------------------------------ - -! on some processors (e.g. some Intel chips) it is necessary to suppress underflows -! by using a small initial field instead of zero -!! DK DK August 2018: on modern processors this does not happen any more, -!! DK DK August 2018: and thus no need to purposely lose accuracy to avoid underflows; thus turning it off by default - logical, parameter :: FIX_UNDERFLOW_PROBLEM = .false. ! .true. - -! some useful constants - double precision, parameter :: PI = 3.141592653589793d0 - double precision, parameter :: TWO_PI = 2.d0 * PI - -! 3-D simulation - integer, parameter :: NDIM = 3 - -! dimension of the boundaries of the slices - integer, parameter :: NDIM2D = 2 - -! this to only take the corners (i.e. extract a QUAD4 or HEX8 in some routines even if we use higher-order elements) - integer, parameter :: NGNOD_EIGHT_CORNERS = 8 - integer, parameter :: NGNOD2D_FOUR_CORNERS = 4 - -! number of points in each AVS or OpenDX quadrangular cell for movies - integer, parameter :: NGNOD2D_FOUR_CORNERS_AVS_DX = NGNOD2D_FOUR_CORNERS - -! number of points per surface element - integer, parameter :: NGLLSQUARE = NGLLX * NGLLY - -! for optimized routines by Deville et al. (2002) - integer, parameter :: m1 = NGLLX, m2 = NGLLX * NGLLY - integer, parameter :: NGLLCUBE = NGLLX * NGLLY * NGLLZ - -! mid-points inside a GLL element - integer, parameter :: MIDX = (NGLLX+1)/2 - integer, parameter :: MIDY = (NGLLY+1)/2 - integer, parameter :: MIDZ = (NGLLZ+1)/2 - -! a few useful constants - double precision, parameter :: ZERO = 0.d0, ONE = 1.d0, TWO = 2.d0, HALF = 0.5d0 - - real(kind=CUSTOM_REAL), parameter :: & - ONE_THIRD = 1._CUSTOM_REAL/3._CUSTOM_REAL, & - FOUR_THIRDS = 4._CUSTOM_REAL/3._CUSTOM_REAL - -! very large and very small values - double precision, parameter :: HUGEVAL = 1.d+30,TINYVAL = 1.d-9 - -! tiny real value declared independently of the machine - real(kind=CUSTOM_REAL), parameter :: TINYVAL_SNGL = 1.e-25_CUSTOM_REAL - -! number of standard linear solids in parallel for attenuation - integer, parameter :: N_SLS = 3 - -! computation of standard linear solids -! ATTENUATION_COMP_RESOLUTION: Number of Digits after decimal -! ATTENUATION_COMP_MAXIMUM: Maximum Q Value - integer, parameter :: ATTENUATION_COMP_RESOLUTION = 1 - integer, parameter :: ATTENUATION_COMP_MAXIMUM = 9000 - -! define flag for regions for anisotropy - integer, parameter :: IANISOTROPY_MODEL1 = 1 - integer, parameter :: IANISOTROPY_MODEL2 = 2 - -! smallest real number on the Pentium and the SGI = 1.1754944E-38 -! largest real number on the Pentium and the SGI = 3.4028235E+38 -! small negligible initial value to avoid very slow underflow trapping -! but not too small to avoid trapping on velocity and acceleration in Newmark - real(kind=CUSTOM_REAL), parameter :: VERYSMALLVAL = 1.E-24_CUSTOM_REAL - -! displacement threshold above which we consider the code became unstable - real(kind=CUSTOM_REAL), parameter :: STABILITY_THRESHOLD = 1.E+25_CUSTOM_REAL - -! geometrical tolerance for boundary detection - double precision, parameter :: SMALLVAL = 0.00001d0 - -! do not use tags for MPI messages, use dummy tag instead - integer, parameter :: itag = 0,itag2 = 0 - -! for the Gauss-Lobatto-Legendre points and weights - double precision, parameter :: GAUSSALPHA = 0.d0,GAUSSBETA = 0.d0 - -! number of lines per source in CMTSOLUTION file - integer, parameter :: NLINES_PER_CMTSOLUTION_SOURCE = 13 - integer, parameter :: NLINES_PER_FORCESOLUTION_SOURCE = 11 - -! number of iterations to solve the system for xi and eta -! setting it to 5 instead of 4 ensures that the result obtained is not compiler dependent -! (when using 4 only some small discrepancies were observed) - integer, parameter :: NUM_ITER = 5 - -! flag to exclude elements that are too far from target in topography detection - logical, parameter :: USE_DISTANCE_CRITERION_TOPO = .true. - -! flag for projection from latitude/longitude to UTM, and back - integer, parameter :: ILONGLAT2UTM = 0, IUTM2LONGLAT = 1 - -!!----------------------------------------------------------- -!! -!! Topography file -!! -!!----------------------------------------------------------- -! specifies topography file to determine the (exact) elevation of each GLL point at the free surface -! in case TOPOGRAPHY = .true. (used for ocean load approximation) - -!! Socal1D example -!! size of topography and bathymetry file for EXAMPLE/meshfem3D_examples/socal1D/DATA/meshfem3D_files/interface4.dat - integer, parameter :: NX_TOPO_FILE = 2,NY_TOPO_FILE = 2 - double precision, parameter :: ORIG_LAT_TOPO = 32.d0 - double precision, parameter :: ORIG_LONG_TOPO = -121.d0 - double precision, parameter :: DEGREES_PER_CELL_TOPO = 6.d0 - character(len=*), parameter :: TOPO_FILE = 'DATA/meshfem3D_files/interface4.dat' - -!! Many interfaces example -!! size of topography and bathymetry file for EXAMPLE/meshfem3D_examples/socal1D/DATA/meshfem3D_files/interface4.dat -! integer, parameter :: NX_TOPO_FILE = 221,NY_TOPO_FILE = 200 -! double precision, parameter :: ORIG_LAT_TOPO = 0.d0 -! double precision, parameter :: ORIG_LONG_TOPO = 0.d0 -! double precision, parameter :: DEGREES_PER_CELL_TOPO = 150.d0 -! character(len=*), parameter :: TOPO_FILE = 'DATA/meshfem3D_files/example_topo.dat' - -!! LA Southern California -!! size of topography and bathymetry file for Southern California -! integer, parameter :: NX_TOPO_FILE = 1401,NY_TOPO_FILE = 1001 -! double precision, parameter :: ORIG_LAT_TOPO = 32.d0 -! double precision, parameter :: ORIG_LONG_TOPO = -121.d0 -! double precision, parameter :: DEGREES_PER_CELL_TOPO = 5.d0 / 1000.d0 -! character(len=*), parameter :: TOPO_FILE = 'DATA/la_topography/topo_bathy_final.dat' - -!! Piero's model -!! size of topography and bathymetry file for Piero Basini's model -! integer, parameter :: NX_TOPO_FILE = 787, NY_TOPO_FILE = 793 -! double precision, parameter :: ORIG_LAT_TOPO = -102352.d0 -! double precision, parameter :: ORIG_LONG_TOPO = 729806.d0 -!! for Piero Basini's model this is the resolution in meters of the topo file -! double precision, parameter :: DEGREES_PER_CELL_TOPO = 250.d0 -! character(len=*), parameter :: TOPO_FILE = 'DATA/piero_model/dem_EV_UTM_regular_250_reordered.dat' - -!!----------------------------------------------------------- -!! -!! APPROXIMATE_OCEAN_LOAD load approximation -!! -!!----------------------------------------------------------- -! minimum thickness in meters to include the effect of the oceans -! to avoid taking into account spurious oscillations in topography model - double precision, parameter :: MINIMUM_THICKNESS_3D_OCEANS = 10.d0 -! density of sea water - real(kind=CUSTOM_REAL), parameter :: RHO_APPROXIMATE_OCEAN_LOAD = 1020.0_CUSTOM_REAL - -!!----------------------------------------------------------- -!! -!! GRAVITY -!! -!!----------------------------------------------------------- -! gravitational constant - double precision, parameter :: GRAV = 6.6723d-11 -! number of layers in PREM - integer, parameter :: NR = 640 -! R_EARTH is the radius of the bottom of the oceans (radius of Earth in m) - double precision, parameter :: R_EARTH = 6371000.d0 -! same radius in km - double precision, parameter :: R_EARTH_KM = R_EARTH / 1000.d0 -! radius of the Earth for gravity calculation - double precision, parameter :: R_EARTH_GRAVITY = 6371000.d0 -! radius of the ocean floor for gravity calculation - double precision, parameter :: ROCEAN_GRAVITY = 6368000.d0 -! average density in the full Earth to normalize equation - double precision, parameter :: RHOAV = 5514.3d0 - -!!----------------------------------------------------------- -!! -!! DOMAINS -!! -!!----------------------------------------------------------- -! material domain ids - integer, parameter :: IDOMAIN_ACOUSTIC = 1 - integer, parameter :: IDOMAIN_ELASTIC = 2 - integer, parameter :: IDOMAIN_POROELASTIC = 3 - -! model ids - integer, parameter :: IMODEL_DEFAULT = 1 - integer, parameter :: IMODEL_1D_PREM = 2 - integer, parameter :: IMODEL_1D_SOCAL = 3 - integer, parameter :: IMODEL_1D_CASCADIA = 4 - integer, parameter :: IMODEL_TOMO = 5 - integer, parameter :: IMODEL_USER_EXTERNAL = 6 - integer, parameter :: IMODEL_GLL = 7 - integer, parameter :: IMODEL_SALTON_TROUGH = 8 - integer, parameter :: IMODEL_1D_PREM_PB = 9 - integer, parameter :: IMODEL_IPATI = 10 - integer, parameter :: IMODEL_IPATI_WATER = 11 - integer, parameter :: IMODEL_SEP = 12 - integer, parameter :: IMODEL_COUPLED = 13 - -!!----------------------------------------------------------- -!! -!! time stamp information -!! -!!----------------------------------------------------------- -! print date and time estimate of end of run in another country, -! in addition to local time. -! For instance: the code runs at Caltech in California but the person -! running the code is connected remotely from France, which has 9 hours more. -! The time difference with that remote location can be positive or negative - logical, parameter :: ADD_TIME_ESTIMATE_ELSEWHERE = .false. - integer, parameter :: HOURS_TIME_DIFFERENCE = +9 - integer, parameter :: MINUTES_TIME_DIFFERENCE = +0 - -!!----------------------------------------------------------- -!! -!! for LDDRK high-order time scheme -!! -!!----------------------------------------------------------- - -! Low-dissipation and low-dispersion fourth-order Runge-Kutta algorithm -! -! reference: -! J. Berland, C. Bogey, and C. Bailly. -! Low-dissipation and low-dispersion fourth-order Runge-Kutta algorithm. -! Computers and Fluids, 35:1459-1463, 2006 -! -! see: http://www.sciencedirect.com/science/article/pii/S0045793005000575?np=y - -! number of stages - integer, parameter :: NSTAGE_LDDRK = 6 - -! coefficients from Table 1, Berland et al. (2006) - real(kind=CUSTOM_REAL), dimension(NSTAGE_LDDRK), parameter :: ALPHA_LDDRK = & - (/0.0_CUSTOM_REAL,-0.737101392796_CUSTOM_REAL, -1.634740794341_CUSTOM_REAL, & - -0.744739003780_CUSTOM_REAL,-1.469897351522_CUSTOM_REAL,-2.813971388035_CUSTOM_REAL/) - - real(kind=CUSTOM_REAL), dimension(NSTAGE_LDDRK), parameter :: BETA_LDDRK = & - (/0.032918605146_CUSTOM_REAL,0.823256998200_CUSTOM_REAL,0.381530948900_CUSTOM_REAL, & - 0.200092213184_CUSTOM_REAL,1.718581042715_CUSTOM_REAL,0.27_CUSTOM_REAL/) - - real(kind=CUSTOM_REAL), dimension(NSTAGE_LDDRK), parameter :: C_LDDRK = & - (/0.0_CUSTOM_REAL,0.032918605146_CUSTOM_REAL,0.249351723343_CUSTOM_REAL, & - 0.466911705055_CUSTOM_REAL,0.582030414044_CUSTOM_REAL,0.847252983783_CUSTOM_REAL/) - - -!!----------------------------------------------------------- -!! -!! symplectic time scheme - Position-Extended Forest-Ruth-Like (PEFRL) scheme (4th order) -!! -!!----------------------------------------------------------- -! see reference: -! Omelyan, I.M. Mryglod and R. Folk, 2002. -! Optimized Forest-Ruth- and Suzuki-like algorithms for integration of motion in many-body systems, -! Computer Physics communications 146, 188 -! http://arxiv.org/abs/cond-mat/0110585 - - integer, parameter :: NSTAGE_SYMPLECTIC = 4 - - ! PEFRL scheme coefficients (see Omelyan et al, 2002, eq. (20)) - double precision, parameter :: PEFRL_xi = 0.1786178958448091d0 - double precision, parameter :: PEFRL_lambda = -0.2123418310626054d0 - double precision, parameter :: PEFRL_chi = -0.06626458266981849d0 - - real(kind=CUSTOM_REAL), dimension(NSTAGE_SYMPLECTIC), parameter :: ALPHA_SYMPL_PEFRL = & - (/ PEFRL_xi, PEFRL_chi, 1.0_CUSTOM_REAL - 2.0_CUSTOM_REAL*(PEFRL_chi + PEFRL_xi), PEFRL_chi /) - real(kind=CUSTOM_REAL), dimension(NSTAGE_SYMPLECTIC), parameter :: BETA_SYMPL_PEFRL = & - (/ 0.5_CUSTOM_REAL - PEFRL_lambda, PEFRL_lambda, PEFRL_lambda, 0.5_CUSTOM_REAL - PEFRL_lambda /) - - -!!---------------------- -!! -!! VM VM test dipole source in fluid regionn -!! -!! if .true. this will change the way the force solution is set in fluid region, trying to put a dipole in fluids -!! if .false. the behaviour of code remains unchanged -!! -!!----------- - logical, parameter :: DIPOLE_SOURCE_IN_FLUID = .false. diff --git a/fortran/meshfem3d/setup/constants_tomography.h b/fortran/meshfem3d/setup/constants_tomography_nu.h similarity index 100% rename from fortran/meshfem3d/setup/constants_tomography.h rename to fortran/meshfem3d/setup/constants_tomography_nu.h diff --git a/fortran/meshfem3d/setup/precision.h b/fortran/meshfem3d/setup/precision.h deleted file mode 100644 index af6b2c159..000000000 --- a/fortran/meshfem3d/setup/precision.h +++ /dev/null @@ -1,39 +0,0 @@ -!===================================================================== -! -! S p e c f e m 3 D -! ----------------- -! -! Main historical authors: Dimitri Komatitsch and Jeroen Tromp -! CNRS, France -! and Princeton University, USA -! (there are currently many more authors!) -! (c) October 2017 -! -! This program is free software; you can redistribute it and/or modify -! it under the terms of the GNU General Public License as published by -! the Free Software Foundation; either version 3 of the License, or -! (at your option) any later version. -! -! This program is distributed in the hope that it will be useful, -! but WITHOUT ANY WARRANTY; without even the implied warranty of -! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -! GNU General Public License for more details. -! -! You should have received a copy of the GNU General Public License along -! with this program; if not, write to the Free Software Foundation, Inc., -! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -! -!===================================================================== - - -! setup/precision.h. Generated from precision.h.in by configure. - -! -! solver in single or double precision depending on the machine -! -! set to MPI_REAL to run in single precision -! set to MPI_DOUBLE_PRECISION to run in double precision -! -! ALSO CHANGE FILE constants.h ACCORDINGLY -! - integer, parameter :: CUSTOM_MPI_TYPE = MPI_REAL diff --git a/fortran/meshfem3d/setup/version.fh b/fortran/meshfem3d/setup/version.fh deleted file mode 100644 index cf39241a2..000000000 --- a/fortran/meshfem3d/setup/version.fh +++ /dev/null @@ -1,4 +0,0 @@ -! version information -character(len=*), parameter :: git_package_version = "v4.1.1-100-g725321e6" -character(len=*), parameter :: git_commit_version = "725321e6599f90e486c907435840df559ebc0a9c" -character(len=*), parameter :: git_date_version = "2024-11-21 11:50:38 +0100" diff --git a/fortran/meshfem3d/shared/CMakeLists.txt b/fortran/meshfem3d/shared/CMakeLists.txt index 7979ae1ed..d284030f1 100644 --- a/fortran/meshfem3d/shared/CMakeLists.txt +++ b/fortran/meshfem3d/shared/CMakeLists.txt @@ -8,8 +8,11 @@ project(MESHFEM3D_SHARED LANGUAGES Fortran C) set(CMAKE_Fortran_STANDARD 95) set(CMAKE_Fortran_STANDARD_REQUIRED ON) -set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/fortran/meshfem3d/modules) -include_directories("${CMAKE_BINARY_DIR}/fortran/meshfem3d/modules") +# set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/../modules) +# include_directories("${CMAKE_Fortran_MODULE_DIRECTORY}") + +include_directories(${CMAKE_CURRENT_BINARY_DIR}/../setup) + set(MESHFEM3D_SHARED_MODULE serial.f90 @@ -48,11 +51,9 @@ set(MESHFEM3D_SHARED_MODULE write_VTK_data.f90 ) -add_library(meshfem3D_shared_module - shared_par.F90 -) +add_library(meshfem3D_shared_module shared_par.F90) add_library(meshfem3D::shared_module ALIAS meshfem3D_shared_module) -target_link_libraries(meshfem3D_shared_module PRIVATE +target_link_libraries(meshfem3D_shared_module meshfem3D::constants ) @@ -74,6 +75,7 @@ if (ADIOS) add_library(meshfem3D::adios_helpers_addons ALIAS meshfem3D_adios_helpers_addons) target_link_libraries(meshfem3D_adios_helpers_addons PRIVATE meshfem3D::config + meshfem3D::constants ) list(APPEND SHARED_ADIOS_MODULES