diff --git a/.gitignore b/.gitignore index b0a5ca6..ef97826 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ build/* -external/* *~ *.ply *gmv* *TAGS +*txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 690e155..4cb09e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,11 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.5) set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/cmake/Modules" "${CMAKE_SOURCE_DIR}/cmake/Utils") +include(NoInSourceBuild) + project(Pececillo Fortran C) # Override the default installation prefix (/usr/local). @@ -22,8 +24,6 @@ endif() # ---------------------------------------------------------------------------- # option(ENABLE_TESTS "Build test programs" ON) - -# Build the tests if (ENABLE_TESTS) enable_testing() endif() @@ -38,19 +38,12 @@ endif() message(STATUS "CMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID}") if (CMAKE_Fortran_COMPILER_ID STREQUAL "NAG") - set (CMAKE_Fortran_FLAGS_RELEASE "$-u -O3 -w=uda -DNDEBUG") # note: need to disable openmp below for traceback support + set (CMAKE_Fortran_FLAGS_RELEASE "-u -O3 -w=uda -DNDEBUG") set (CMAKE_Fortran_FLAGS_DEBUG "-g90 -g -gline -O0 -w=uda -C=all") - #set (CMAKE_Fortran_FLAGS_DEBUG "-O3 -Oassumed=contig -w=uda -DNDEBUG") elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") set (CMAKE_Fortran_FLAGS_RELEASE "-O3 -g -DNDEBUG -assume realloc_lhs") set (CMAKE_Fortran_FLAGS_DEBUG "-g -assume realloc_lhs -traceback -fp-stack-check -ftrapuv -check bounds,uninit,noarg-temp-created,pointer") - #set (CMAKE_Fortran_FLAGS_DEBUG "-g -traceback -assume realloc_lhs -fp-stack-check -ftrapuv -check bounds,uninit,noarg-temp-created,pointer -warn all") - # set (CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -traceback -assume realloc_lhs -ftrapuv -fp-stack-check -check all -warn all -WB") - set (CMAKE_Fortran_FLAGS_RELEASE "-O3 -g -assume realloc_lhs -traceback") - #set (CMAKE_Fortran_FLAGS_RELEASE "-O3 -g -assume realloc_lhs -traceback -fp-stack-check -ftrapuv -check bounds,uninit,noarg-temp-created,pointer") - #set (CMAKE_Fortran_FLAGS_RELEASE "-O3 -g -assume realloc_lhs -traceback -fp-stack-check -ftrapuv -check all") - #message(STATUS "${CMAKE_Fortran_COMPILER_VERSION}") endif() find_package(OpenMP) @@ -63,39 +56,77 @@ if (OPENMP_FOUND) endif (OPENMP_FOUND) #------------------------------------------------------------------------------- -# TPLs +# External dependencies #------------------------------------------------------------------------------- -# Find and/or build the required TPLs. -add_subdirectory(external) - -# We need to incorporate netcdf and exodus into the TPL build process, but for -# now we require them to be prebuilt and installed someplace. EXODUS_LIB_DIR -# must be set on the command line to the directory containing the libraries. -# Source tarballs for the packages are in external/tarballs. -find_library(EXODUS_LIBRARY exoIIv2c) -find_library(NETCDF_LIBRARY netcdf) -if(EXODUS_LIBRARY STREQUAL "EXODUS_LIBRARY-NOTFOUND" OR - NETCDF_LIBRARY STREQUAL "NETCDF_LIBRARY-NOTFOUND") - message(FATAL_ERROR "ERROR! Could not find the netcdf and/or exoIIv2c " - "libraries in EXODUS_LIB_DIR=${EXODUS_LIB_DIR}") +set(CMAKE_PREFIX_PATH ${PECECILLO_TPL_DIR}) + +# HYPRE library +find_package(HYPRE 2.9.0) +if(HYPRE_FOUND) + if(HYPRE_IS_PARALLEL) + set(HYPRE_FOUND False) + message(STATUS "Require serial HYPRE library but found unsuitable parallel library") + endif() +endif() +if(NOT HYPRE_FOUND) + message(FATAL_ERROR "Could NOT find a suitable Hypre installation") +endif() + +# HDF5 library +find_package(HDF5 "1.8.8" COMPONENTS C HL) +if(HDF5_FOUND) + if(HDF5_IS_PARALLEL) + set(HDF5_FOUND False) + message(STATUS "Require serial HDF5 library but found unsuitable parallel library") + endif() +endif() +if(HDF5_FOUND) + add_library(hdf5 INTERFACE) + target_link_libraries(hdf5 INTERFACE ${HDF5_LIBRARIES}) + target_include_directories(hdf5 INTERFACE ${HDF5_INCLUDE_DIRS}) + target_compile_definitions(hdf5 INTERFACE ${HDF5_DEFINITIONS}) +else() + message(FATAL_ERROR "Could NOT find a suitable HDF5 installation") endif() -add_library(exodus STATIC IMPORTED) -set_target_properties(exodus PROPERTIES - IMPORTED_LOCATION ${EXODUS_LIBRARY} - IMPORTED_LINK_INTERFACE_LIBRARIES ${NETCDF_LIBRARY}) -message(STATUS "NETCDF_LIBRARY=${NETCDF_LIBRARY}") -find_package(LAPACK) +# NetCDF library +find_package(NetCDF "4.1.3") +if(NETCDF_FOUND) + if(NOT NETCDF_HAS_NC4) + message(STATUS "Found unsuitable NetCDF without the required netcdf-4 feature") + set(NETCDF_FOUND False) + endif() +endif() +if(NOT NETCDF_FOUND) + message(FATAL_ERROR "Could NOT find a suitable NetCDF installation") +endif() + +# ExodusII library +find_package(Exodus "602" EXACT) +if(NOT EXODUS_FOUND) + message(FATAL_ERROR "Could NOT find a suitable Exodus installation") +endif() +# YAJL library +find_package(YAJL) +if(NOT YAJL_FOUND) + message(FATAL_ERROR "Could NOT find a suitable YAJL library") +endif() + +# LAPACK library +find_package(LAPACK) +if(NOT LAPACK_FOUND) + message(FATAL_ERROR "Could NOT find a suitable LAPACK library") +endif() #------------------------------------------------------------------------------- # Installation Definitions #------------------------------------------------------------------------------- -add_subdirectory(petaca) -set(Petaca_MODULE_DIR ${Petaca_BINARY_DIR}/mod_files/) +# RPATH handling for installed shared libraries and dynamically-linked +# executables. See http://www.cmake.org/Wiki/CMake_RPATH_handling +set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -set(Pececillo_MODULE_DIR ${Pececillo_BINARY_DIR}/mod_files/) -set(CMAKE_Fortran_MODULE_DIRECTORY ${Pececillo_MODULE_DIR}) add_subdirectory(src) diff --git a/README.md b/README.md new file mode 100644 index 0000000..4fad3ce --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# Paraboloid Curvature + +## Building + + + + $ mkdir build + $ cd build + $ cmake -DCMAKE_PREFIX_PATH=/your/pececillo-tpl/install/path .. + $ make diff --git a/cmake/Modules/FindExodus.cmake b/cmake/Modules/FindExodus.cmake new file mode 100644 index 0000000..37331df --- /dev/null +++ b/cmake/Modules/FindExodus.cmake @@ -0,0 +1,54 @@ +# This module finds the Exodus library and header file directory. +# EXODUS_FOUND is set to True if both are found and the following +# variables are returned. +# +# EXODUS_INCLUDE_DIRS - required include directories +# EXODUS_LIBRARIES - required link libraries +# EXODUS_VERSION - version of exodus found +# +# This module also defines the imported library target "exodus". It is +# generally enough to include "exodus" as a target link library; cmake +# will automatically handle adding the appropriate compile include flags +# and collection of link libraries. +# +# Set the variable CMAKE_PREFIX_PATH to provide a hint to the module for +# where to find the library and header file. This is searched before the +# standard system locations. +# +# Find_package(NetCDF) should be run before using this module. + +#if(Exodus_FIND_QUIETLY) +# set(_find_netcdf_arg QUIET) +#endif() +#find_package(NetCDF ${_find_netcdf_arg}) +#unset(_find_netcdf_arg) + +find_path(EXODUS_INCLUDE_DIR exodusII.h) +find_library(EXODUS_LIBRARY exoIIv2c) + +# Identify the ExodusII API version (not exactly the library version) +if(EXODUS_INCLUDE_DIR) + set(exodusii_h ${EXODUS_INCLUDE_DIR}/exodusII.h) + include(SearchHeaderFile) + search_header_file(${exodusii_h} "EX_API_VERS_NODOT" EXODUS_VERSION) +endif() + +# Set EXODUS_FOUND to TRUE of the REQUIRED variables have been set. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Exodus + REQUIRED_VARS EXODUS_LIBRARY EXODUS_INCLUDE_DIR + VERSION_VAR EXODUS_VERSION) + +if(EXODUS_FOUND) + set(EXODUS_INCLUDE_DIRS ${EXODUS_INCLUDE_DIR} ${NETCDF_C_INCLUDE_DIRS}) + set(EXODUS_LIBRARIES ${EXODUS_LIBRARY} ${NETCDF_C_LIBRARIES}) + list(REMOVE_DUPLICATES EXODUS_INCLUDE_DIRS) + mark_as_advanced(EXODUS_INCLUDE_DIR EXODUS_LIBRARY) + if(NOT TARGET exodus) + add_library(exodus UNKNOWN IMPORTED) + set_target_properties(exodus PROPERTIES + IMPORTED_LOCATION "${EXODUS_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${EXODUS_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${NETCDF_C_LIBRARIES}") + endif() +endif() diff --git a/cmake/Modules/FindHYPRE.cmake b/cmake/Modules/FindHYPRE.cmake index 9d7ea52..65ea440 100644 --- a/cmake/Modules/FindHYPRE.cmake +++ b/cmake/Modules/FindHYPRE.cmake @@ -6,107 +6,68 @@ # === Variables === # # HYPRE_FOUND Flag indicating if HYPRE is found -# HYPRE_VERSION HYPRE version -# HYPRE_INCLUDE_DIRS List of paths required to compile +# HYPRE_VERSION HYPRE version +# HYPRE_INCLUDE_DIRS List of paths required to compile # with HYPRE # HYPRE_LIBRARIES List libraries (targets?) required # to link against HYPRE. -# HYPRE_IS_PARALLEL HYPRE was found +# HYPRE_IS_PARALLEL HYPRE was found # # HYPRE_INSTALL_PREFIX Hypre installation prefix. Used in the # library and include file search. # === Usage === -# +# # Call this module with FIND_PACKAGE(HYPRE) in any CMakeLists.txt # that requires HYPRE include directories or libraries. The search # can be bypassed by explicitly setting HYPRE_INCLUDE_DIRS and -# HYPRE_LIBRARIES variables. +# HYPRE_LIBRARIES variables. # # The variables HYPRE_INSTALL_PREFIX or ENV HYPRE_ROOT control # search locations for include and libraries. # -include(FindPackageHandleStandardArgs) -include(PrintVariable) - -# --- MACROS/FUNCTIONS -FUNCTION(_search_hypre_config_file config_h defmacro outvar) - if ( EXISTS "${config_h}" ) - set(_regexp ".define[ \\t]+${defmacro}") - set(_quote "\"") - FILE(STRINGS "${config_h}" _tmp_string REGEX "${_regexp}") - STRING(REGEX REPLACE ".define ${defmacro}[ \\t]+(.*)$" "\\1" _result "${_tmp_string}") - STRING(REPLACE "${_quote}" " " _result "${_result}") - STRING(REGEX REPLACE "[ \t\n]+" "" _result "${_result}") - else() - set(_result ${outvar}-NOTFOUND) - endif() - set(${outvar} ${_result} PARENT_SCOPE) - -ENDFUNCTION() -# --- Begin main +set(hypre_search_paths ${HYPRE_DIR} ENV HYPRE_ROOT) +find_library(HYPRE_LIBRARY HYPRE HINTS ${hypre_search_paths} PATH_SUFFIXES lib) +find_path(HYPRE_INCLUDE_DIR HYPRE.h HINTS ${hypre_search_paths} PATH_SUFFIXES include) -# Search for HYPRE.h -find_path(HYPRE_INCLUDE_DIR - NAMES HYPRE.h - HINTS ENV HYPRE_ROOT ${HYPRE_INSTALL_PREFIX} - PATH_SUFFIXES include) - -# Search for HYPRE library -find_library(HYPRE_LIBRARY - NAMES HYPRE - HINTS ENV HYPRE_ROOT ${HYPRE_INSTALL_PREFIX} - PATH_SUFFIXES lib) - -# Define the cofig header file, will mine this to determine version -# and build type (MPI, non-MPI) -if ( HYPRE_INCLUDE_DIR ) +if(HYPRE_INCLUDE_DIR) set(HYPRE_CONFIG_FILE ${HYPRE_INCLUDE_DIR}/HYPRE_config.h) -endif() - -# Define the version -if ( NOT HYPRE_VERSION AND HYPRE_CONFIG_FILE ) - _search_hypre_config_file(${HYPRE_CONFIG_FILE} HYPRE_RELEASE_VERSION HYPRE_VERSION) -endif() - -# Define the build (MPI or non-MPI) -if (HYPRE_CONFIG_FILE) - _search_hypre_config_file(${HYPRE_CONFIG_FILE} HYPRE_HAVE_MPI HYPRE_IS_PARALLEL) + include(SearchHeaderFile) + search_header_file(${HYPRE_CONFIG_FILE} "HYPRE_HAVE_MPI" HYPRE_IS_PARALLEL) if(HYPRE_IS_PARALLEL) set(HYPRE_IS_PARALLEL True) else() set(HYPRE_IS_PARALLEL False) endif() - if (HYPRE_IS_PARALLEL) - find_package(MPI) - endif() + if(NOT HYPRE_VERSION) + search_header_file(${HYPRE_CONFIG_FILE} HYPRE_RELEASE_VERSION HYPRE_VERSION STRIP_QUOTES) + endif() + unset(HYPRE_CONFIG_FILE) endif() -# Define the include directories, append MPI if needed -if ( NOT HYPRE_INCLUDE_DIRS) - set(HYPRE_INCLUDE_DIRS ${HYPRE_INCLUDE_DIR}) - if (HYPRE_IS_PARALLEL) - if (MPI_C_FOUND) - list(APPEND HYPRE_INCLUDE_DIRS ${MPI_C_INCLUDE_PATH}) - endif() - endif() +if(HYPRE_IS_PARALLEL) + find_package(MPI) endif() -# Define the libraries -if ( NOT HYPRE_LIBRARIES ) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(HYPRE + REQUIRED_VARS HYPRE_LIBRARY HYPRE_INCLUDE_DIR + VERSION_VAR HYPRE_VERSION) + +if(HYPRE_FOUND) + set(HYPRE_INCLUDE_DIRS ${HYPRE_INCLUDE_DIR}) set(HYPRE_LIBRARIES ${HYPRE_LIBRARY}) - if (HYPRE_IS_PARALLEL) + if(HYPRE_IS_PARALLEL AND MPI_C_FOUND) list(APPEND HYPRE_LIBRARIES ${MPI_C_LIBRARIES}) + list(APPEND HYPRE_INCLUDE_DIRS ${MPI_C_INCLUDE_PATH}) endif() -endif() - -# Send a useful message if everything is found -find_package_handle_standard_args(HYPRE - VERSION_VAR HYPRE_VERSION - REQUIRED_VARS HYPRE_LIBRARY HYPRE_INCLUDE_DIRS HYPRE_LIBRARIES) - -mark_as_advanced( - HYPRE_INCLUDE_DIR - HYPRE_CONFIG_FILE - HYPRE_LIBRARY) - + if(NOT TARGET hypre) + add_library(hypre UNKNOWN IMPORTED) + set_target_properties(hypre PROPERTIES + IMPORTED_LOCATION "${HYPRE_LIBRARY}" + #IMPORTED_LINK_INTERFACE_LANGUAGES "C" + INTERFACE_INCLUDE_DIRECTORIES "${HYPRE_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${HYPRE_LIBRARIES}") + #INTERFACE_COMPILE_DEFINITIONS "${MPI_C_COMPILE_FLAGS}") + endif() +endif() diff --git a/cmake/Modules/FindNetCDF.cmake b/cmake/Modules/FindNetCDF.cmake index c1df5a3..7ae634d 100644 --- a/cmake/Modules/FindNetCDF.cmake +++ b/cmake/Modules/FindNetCDF.cmake @@ -1,240 +1,149 @@ -# -*- mode: cmake -*- -# Usage: -# Control the search through NETCDF_INSTALL_PREFIX or setting environment variable -# NETCDF_ROOT to the NETCDF installation prefix. -# By default only searches for C library. To search for the C++ library -# set 'CXX' in the COMPONENTS option in find_package(NETCDF) +# - Find NetCDF +# Find the NetCDF includes and libraries # -# This module does not search default paths! +# This module finds the netCDF library and header file directory for the +# C interface, and if the "Fortran" component is requested, those for the +# Fortran interface. # -# Following variables are set: -# NETCDF_FOUND (BOOL) Flag indicating if NETCDF was found -# NETCDF_INCLUDE_DIR (PATH) Path to the NETCDF include file -# NETCDF_INCLUDE_DIRS (LIST) List of all required include files -# NETCDF_C_LIBRARIES (LIST) List of all required libraries to link to -# the NETCDF C library -# NETCDF_CXX_LIBRARIES (LIST) List of all required libraries to link to -# the NETCDF C++ library (If CXX is in COMPONENTS) +# If everything is found, NETCDF_FOUND is set to True and the following +# variables are defined. # -# Additional variables set -# NETCDF_C_LIBRARY (FILE) NETCDF C library -# NETCDF_CXX_LIBRARY (FILE) NETCDF C++ library (If CXX is in the COMPONENTS) -# NETCDF_LARGE_DIMS (BOOL) Checks the header files for size of -# NC_MAX_DIMS, NC_MAX_VARS and NC_MAX_VARS_DIMS -# Returns TRUE if -# NC_MAX_DIMS >= 655363 -# NC_MAX_VARS >= 524288 -# NC_MAX_VAR_DIMS >= 8 +# NETCDF_VERSION - Version of NetCDF found +# NETCDF_HAS_NC4 - True if NetCDF includes NetCDF-4 support +# NETCDF_LARGE_MODEL - True if header file has large model tweaks +# NETCDF_LIBRARIES - Link libraries for all interfaces +# NETCDF_INCLUDE_DIRS - All include directories +# NETCDF_C_LIBRARIES - Link libraries for C interface +# NETCDF_C_INCLUDE_DIRS - Include directories for C interface # -# ############################################################################# - -# Standard CMake modules see CMAKE_ROOT/Modules -include(FindPackageHandleStandardArgs) - -# ###################################### -# Begin local macros/functions +# If the Fortran interface was requested, these are also defined. # -# Macro to handle print out -macro(_netcdf_status mess) - if(NOT NETCDF_FIND_QUIETLY) - message(STATUS "${mess}") - endif() -endmacro() +# NETCDF_Fortran_LIBRARIES - Link libraries for Fortran interface +# NETCDF_Fortran_INCLUDE_DIRS - Include directories for Fortran interface # -# End local macros/functions -# ###################################### - - -# Search paths -set(_netcdf_search_paths - ${NETCDF_INSTALL_PREFIX} - ENV NETCDF_ROOT) - -# Locate the config binary -# Search for the nc-config binary -find_program(NETCDF_CONFIG_BINARY nc-config - HINTS ${NETCDF_INSTALL_PREFIX} ${NETCDF_BIN_DIR} - PATH_SUFFIXES bin Bin - DOC "NETCDF configuration script") - -# Determine if HDF5 is present -set(NETCDF_HAS_HDF5 False) -if(NETCDF_CONFIG_BINARY) +# The NETCDF_LIBARIES and NETCDF_INCLUDE_DIRS variables are just unions of the +# correspondig language-specific variables. + +# Validate the optional component list +set(NETCDF_VALID_COMPONENTS Fortran) +set(NETCDF_LANGUAGE_BINDINGS "C") +if(NetCDF_FIND_COMPONENTS) + foreach(_comp ${NetCDF_FIND_COMPONENTS}) + list(FIND NETCDF_VALID_COMPONENTS ${_comp} _loc) + if(${_loc} EQUAL -1) + message(FATAL_ERROR "\"${_comp}\" is not a valid NetCDF component.") + else() + list(APPEND NETCDF_LANGUAGE_BINDINGS ${_comp}) + endif() + endforeach() + unset(_comp) + unset(_loc) +endif() +unset(NETCDF_VALID_COMPONENTS) - execute_process(COMMAND ${NETCDF_CONFIG_BINARY} --has-hdf5 - RESULT_VARIABLE result - OUTPUT_VARIABLE out +# Check whether netCDF-4 support is available (uses HDF5) +find_program(NC_CONFIG nc-config) +if(NC_CONFIG) + execute_process(COMMAND ${NC_CONFIG} --has-nc4 + OUTPUT_VARIABLE NETCDF_HAS_NC4 OUTPUT_STRIP_TRAILING_WHITESPACE) - - if (NOT ${result}) - if ( "${out}" MATCHES "yes" ) - set(NETCDF_HAS_HDF5 True) - else("${out}" MATCHES "yes") - set(NETCDF_HAS_HDF5 False) - endif("${out}" MATCHES "yes") - endif(NOT ${result}) - -endif(NETCDF_CONFIG_BINARY) - -# Locate a HDF5 installation -if(NETCDF_HAS_HDF5) - find_package(HDF5) +else() + set(NETCDF_HAS_NC4 NETCDF_HAS_NC4-NOTFOUND) endif() -# Include file search -if ( NOT NETCDF_INCLUDE_DIRS ) - - if(NETCDF_CONFIG_BINARY) - - execute_process(COMMAND ${NETCDF_CONFIG_BINARY} --includedir - RESULT_VARIABLE result - OUTPUT_VARIABLE dir - OUTPUT_STRIP_TRAILING_WHITESPACE) - - if(NOT ${result}) - set(NETCDF_INCLUDE_DIR ${dir}) - endif(NOT ${result}) - - endif(NETCDF_CONFIG_BINARY) - - find_path(NETCDF_INCLUDE_DIR - NAMES netcdf.h - HINTS ${_netcdf_search_paths} - PATH_SUFFIXES include) - - list(APPEND NETCDF_INCLUDE_DIRS ${NETCDF_INCLUDE_DIR}) - - # Add HDF5 if present - if( NETCDF_HAS_HDF5) - if(HDF5_FOUND) - list(APPEND NETCDF_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS}) - endif(HDF5_FOUND) - endif(NETCDF_HAS_HDF5) - -endif(NOT NETCDF_INCLUDE_DIRS) - -# NETCDF_LIBRARY (NETCDF_C_LIBRARY) -find_library(NETCDF_C_LIBRARY - NAMES netcdf - HINTS ${_netcdf_search_paths} ${NETCDF_LIB_DIR} - PATH_SUFFIXES lib Lib) -set(NETCDF_LIBRARY ${NETCDF_C_LIBRARY}) - -# NETCDF_CXX_LIBRARY -find_library(NETCDF_CXX_LIBRARY - NAMES netcdf_c++ - HINTS ${_netcdf_search_paths} ${NETCDF_LIB_DIR} - PATH_SUFFIXES lib Lib) - -# NETCDF_Fortran_LIBRARY - -find_library(NETCDF_Fortran_LIBRARY - NAMES netcdff - HINTS ${_netcdf_search_paths} ${NETCDF_LIB_DIR} - PATH_SUFFIXES lib Lib) - -# NETCDF_C_LIBRARIES -if(NETCDF_C_LIBRARY) - set(NETCDF_C_LIBRARIES ${NETCDF_C_LIBRARY}) - if ( NETCDF_HAS_HDF5 AND HDF5_FOUND ) - list(APPEND NETCDF_C_LIBRARIES ${HDF5_C_LIBRARY} ${HDF5_LINK_LIBRARIES}) +# Should call find_package(HDF5) before calling this module +#if(NETCDF_HAS_NC4) +# find_package(HDF5) +#endif() + +# Always find the C interface +find_path(NETCDF_C_INCLUDE_DIR netcdf.h HINTS ENV NETCDF_DIR PATH_SUFFIXES include) +find_library(NETCDF_C_LIBRARY netcdf HINTS ENV NETCDF_DIR PATH_SUFFIXES lib) +mark_as_advanced(NETCDF_C_INCLUDE_DIR NETCDF_C_LIBRARY) +set(NETCDF_C_INCLUDE_DIRS ${NETCDF_C_INCLUDE_DIR}) +set(NETCDF_C_LIBRARIES ${NETCDF_C_LIBRARY}) +set(NETCDF_INCLUDE_DIRS ${NETCDF_C_INCLUDE_DIRS}) +set(NETCDF_LIBRARIES ${NETCDF_C_LIBRARIES}) + +# Fortran interface (optional) +list(FIND NETCDF_LANGUAGE_BINDINGS Fortran index) +if(index GREATER -1) + find_path(NETCDF_Fortran_INCLUDE_DIR NAMES netcdf.mod NETCDF.mod + HINTS ENV NETCDF_DIR PATH_SUFFIXES include) + find_library(NETCDF_Fortran_LIBRARY netcdff HINTS ENV NETCDF_DIR PATH_SUFFIXES lib) + mark_as_advanced(NETCDF_Fortran_INCLUDE_DIR NETCDF_Fortran_LIBRARY) + if(NETCDF_Fortran_INCLUDE_DIR AND NETCDF_Fortran_LIBRARY) + set(NetCDF_Fortran_FOUND True) + else() + set(NetCDF_Fortran_FOUND False) endif() -else() - set(NETCDF_C_LIBRARIES NETCDF_C_LIBRARIES-NOTFOUND) -endif() - -# NETCDF_CXX_LIBRARIES -if(NETCDF_CXX_LIBRARY) - set(NETCDF_CXX_LIBRARIES ${NETCDF_CXX_LIBRARY} ${NETCDF_C_LIBRARIES}) -else() - set(NETCDF_CXX_LIBRARIES NETCDF_CXX_LIBRARIES-NOTFOUND) -endif() - -# NETCDF_Fortran_LIBRARIES -if(NETCDF_Fortran_LIBRARY) + set(NETCDF_Fortran_INCLUDE_DIRS ${NETCDF_Fortran_INCLUDE_DIR}) set(NETCDF_Fortran_LIBRARIES ${NETCDF_Fortran_LIBRARY} ${NETCDF_C_LIBRARIES}) -else() - set(NETCDF_Fortran_LIBRARIES NETCDF_Fortran_LIBRARIES-NOTFOUND) -endif() + list(APPEND NETCDF_INCLUDE_DIRS ${NETCDF_Fortran_INCLUDE_DIR}) + list(REMOVE_DUPLICATES NETCDF_INCLUDE_DIRS) + list(INSERT NETCDF_LIBRARIES 0 ${NETCDF_Fortran_LIBRARY}) +endif() # NETCDF Version -if(NETCDF_CONFIG_BINARY) - execute_process(COMMAND "${NETCDF_CONFIG_BINARY}" "--version" - RESULT_VARIABLE _ret_code - OUTPUT_VARIABLE _stdout - ERROR_VARIABLE _stderr) - - string(REGEX REPLACE "[\n\r ]" "" _version_answer "${_stdout}") - string(REGEX REPLACE "netCDF" "" NETCDF_VERSION "${_version_answer}") -else() - set(NETCDF_VERSION NETCDF-NOTFOUND) -endif() - -# Large dimension check -if ( NETCDF_INCLUDE_DIR ) - - set(netcdf_h "${NETCDF_INCLUDE_DIR}/netcdf.h" ) - if ( EXISTS ${netcdf_h} ) - #_netcdf_status( "NetCDF include file ${netcdf_h} will be searched for define values") - - file(STRINGS "${netcdf_h}" netcdf_max_dims_string REGEX "^#define NC_MAX_DIMS") - string(REGEX REPLACE "[^0-9]" "" netcdf_max_dims "${netcdf_max_dims_string}") - - file(STRINGS "${netcdf_h}" netcdf_max_vars_string REGEX "^#define NC_MAX_VARS") - string(REGEX REPLACE "[^0-9]" "" netcdf_max_vars "${netcdf_max_vars_string}") - - file(STRINGS "${netcdf_h}" netcdf_max_var_dims_string REGEX "^#define NC_MAX_VAR_DIMS") - string(REGEX REPLACE "[^0-9]" "" netcdf_max_var_dims "${netcdf_max_var_dims_string}") - - - if ( - ( (netcdf_max_dims EQUAL 65536) OR (netcdf_max_dims GREATER 65536) ) AND - ( (netcdf_max_vars EQUAL 524288) OR (netcdf_max_vars GREATER 524288) ) AND - ( (netcdf_max_var_dims EQUAL 8) OR (netcdf_max_var_dims GREATER 8) ) - - ) - set(NETCDF_LARGE_DIMS TRUE) - else() - message(WARNING "The NetCDF found in ${NetCDF_INSTALL_PREFIX} does not have the correct NC_MAX_DIMS, NC_MAX_VARS and NC_MAX_VAR_DIMS\n" - "It may not be compatible with other TPL libraries such MOAB and ExodusII\n" ) - set(NETCDF_LARGE_DIMS FALSE) - endif() - - else() - - set(NETCDF_LARGE_DIMS NETCDF_LARGE_DIMS-NOTFOUND) - - endif() +if(NC_CONFIG) + execute_process(COMMAND ${NC_CONFIG} --version + OUTPUT_VARIABLE NETCDF_VERSION) + string(REGEX REPLACE "[\n\r ]" "" NETCDF_VERSION "${NETCDF_VERSION}") + string(REGEX REPLACE "netCDF" "" NETCDF_VERSION "${NETCDF_VERSION}") else() - set(NETCDF_LARGE_DIMS NETCDF_LARGE_DIMS-NOTFOUND) -endif() + set(NETCDF_VERSION NETCDF_VERSION-NOTFOUND) +endif() -# Now set the component flags need NetCDF__FOUND -# to trigger the HANDLE_COMPONENTS correctly -foreach(lang C CXX Fortran) - set(lib_var NETCDF_${lang}_LIBRARY) - if(${lib_var}) - set(NetCDF_${lang}_FOUND True) - set(NETCDF_${lang}_FOUND True) - else() - set(NetCDF_${lang}_FOUND False) - set(NETCDF_${lang}_FOUND False) +# Check for the "large model modifications" desired by the ExodusII library +if(NETCDF_C_INCLUDE_DIR) + set(netcdf_h "${NETCDF_C_INCLUDE_DIR}/netcdf.h") + include(SearchHeaderFile) + search_header_file(${netcdf_h} "NC_MAX_DIMS" max_dims) + search_header_file(${netcdf_h} "NC_MAX_VARS" max_vars) + search_header_file(${netcdf_h} "NC_MAX_VAR_DIMS" max_var_dims) + if((max_dims EQUAL 65536) AND (max_vars EQUAL 524288) AND (max_var_dims EQUAL 8)) + set(NETCDF_LARGE_MODEL True) + else() + set(NETCDF_LARGE_MODEL False) endif() -endforeach() + unset(max_dims) + unset(max_vars) + unset(max_var_dims) + unset(netcdf_h) +else() + set(NETCDF_LARGE_MODEL NETCDF_LARGE_MODEL-NOTFOUND) +endif() +include(FindPackageHandleStandardArgs) find_package_handle_standard_args(NetCDF - REQUIRED_VARS - NETCDF_INCLUDE_DIR - NETCDF_LIBRARY - NETCDF_INCLUDE_DIRS - NETCDF_C_LIBRARIES - VERSION_VAR NETCDF_VERSION - HANDLE_COMPONENTS) - - - - - - - + REQUIRED_VARS NETCDF_LIBRARIES NETCDF_INCLUDE_DIRS + VERSION_VAR NETCDF_VERSION + HANDLE_COMPONENTS) + +if(NETCDF_FOUND) + if(NETCDF_C_LIBRARY AND NETCDF_C_INCLUDE_DIR) + if(NOT TARGET netcdf) + add_library(netcdf UNKNOWN IMPORTED) + set_target_properties(netcdf PROPERTIES + IMPORTED_LOCATION "${NETCDF_C_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${NETCDF_C_INCLUDE_DIR}") + if(NETCDF_HAS_NC4) + set_target_properties(netcdf PROPERTIES + INTERFACE_LINK_LIBRARIES "${HDF5_C_LIBRARIES}") + endif() + endif() + endif() + if(NETCDF_Fortran_LIBRARY AND NETCDF_Fortran_INCLUDE_DIR) + if(NOT TARGET netcdff) + add_library(netcdff UNKNOWN IMPORTED) + set_target_properties(netcdff PROPERTIES + IMPORTED_LOCATION "${NETCDF_Fortran_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${NETCDF_Fortran_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES netcdf) + endif() + endif() +endif() +# clean up +unset(NETCDF_LANGUAGE_BINDINGS) +unset(NC_CONFIG) diff --git a/petaca/cmake/Modules/FindYAJL.cmake b/cmake/Modules/FindYAJL.cmake similarity index 100% rename from petaca/cmake/Modules/FindYAJL.cmake rename to cmake/Modules/FindYAJL.cmake diff --git a/cmake/Modules/NoInSourceBuild.cmake b/cmake/Modules/NoInSourceBuild.cmake new file mode 100644 index 0000000..1ba7f4f --- /dev/null +++ b/cmake/Modules/NoInSourceBuild.cmake @@ -0,0 +1,11 @@ +if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") + message(FATAL_ERROR "ERROR: In-source builds are not allowed. Please " + "create a separate directory and run cmake from there; for example,\n" + " $ mkdir MY_BUILD\n" + " $ cd MY_BUILD\n" + " $ cmake [OPTIONS] ..\n" + "NB: You must first remove the CMakeCache.txt file and CMakeFiles " + "directory that cmake just created before attempting to run cmake again; " + "for example,\n" + " $ rm -r CMakeCache.txt CMakeFiles\n") +endif() diff --git a/petaca/cmake/Modules/SearchHeaderFile.cmake b/cmake/Modules/SearchHeaderFile.cmake similarity index 100% rename from petaca/cmake/Modules/SearchHeaderFile.cmake rename to cmake/Modules/SearchHeaderFile.cmake diff --git a/examples/flow/box.json b/examples/flow/box.json deleted file mode 100644 index 302a8ff..0000000 --- a/examples/flow/box.json +++ /dev/null @@ -1,97 +0,0 @@ -// single-phase channel flow without viscosity -// exact solution is u = 1/rho * dP/dx * t - -{ - "mesh": { - "corner-min": [0.0, 0.0, 0.0], - "corner-max": [1.0, 1.0, 1.0], - //"intervals" : [ 5, 16, 5] - //"intervals" : [ 5, 5, 5] - //"intervals" : [ 8, 32, 8] - "intervals" : [ 16, 16, 16] - //"intervals" : [ 17, 64, 17] - //"intervals" : [ 32, 128, 32] - }, - - "sim-control": { - "initial-time": 0.0, - "initial-time-step": 1.0e-6, - "min-time-step": 1.0e-8, - //"output-times": [0.001] - //"output-times": [0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10] - // 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, - // 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, - // 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, - // 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, - // 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, - // 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, - // 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, - // 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, - // 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00] - "output-times": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, - 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, - 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, - 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, - 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, - 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, - 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, - 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, - 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, - 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0] - // "output-times": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, - // 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, - // 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, - // 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, - // 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, - // 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0, - // 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0, - // 71.0, 72.0, 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0, - // 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, 90.0, - // 91.0, 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, 100.0] - }, - - "ns-solver": { - "cfl-multiplier": 0.25, - "max-dt": 1e-2, - "body-force": [0.0, 0.0, -9.8], - "bc": { - "no-slip-walls": { - "condition": "dirichlet-velocity", - "face-sets": [1,2,3,4,5,6], - "data-constant": 0.0 - } - }, - "prediction-solver": { - "viscous-implicitness": 0.5, - "rel-tol": 1.0e-10, - "max-ds-iter": 1000, - "max-amg-iter": 5, - "krylov-method": "cg", - "gmres-krylov-dim": 5 - }, - "projection-solver": { - "rel-tol": 1.0e-10, - "max-ds-iter": 1000, - "max-amg-iter": 10, - "krylov-method": "cg", - "gmres-krylov-dim": 5 - } - }, - - "material-properties": { - "densities": [10.0], - "viscosities": [10.0] - //"immobile-materials": [] - //"material-sound-speeds": [] - }, - - "vof-solver": { - "advection-method": 1, - "materials": [1], - "initial-vof": { - "all": { - "material-id": 1 - } - } - } -} diff --git a/examples/flow/dc.json b/examples/flow/dc.json deleted file mode 100644 index cc0da41..0000000 --- a/examples/flow/dc.json +++ /dev/null @@ -1,54 +0,0 @@ -// Deforming column in a prescribed reversing vortex. - -{ - "mesh": { - "corner-min": [0.0, 0.0, 0.0], - "corner-max": [1.0, 1.0, 0.1], - //"intervals" : [8,8,5] - //"intervals" : [ 16, 16, 5] - //"intervals" : [ 32, 32, 5] - //"intervals" : [ 64, 64, 5] - "intervals" : [128, 128, 5] - }, - - "sim-control": { - "initial-time": 0.0, - "initial-time-step": 1.0e-6, - "min-time-step": 1.0e-8, - "output-times": [0.0,0.001] - //"output-times": [0.5, 1.0, 1.5, 2.0, 2.5, 3.0] - //"output-times": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0] //, - // 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, - // 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 2.95, 2.98, 3.0] - }, - - "ns-solver": { - "prescribed-velocity": 1, // need to write correct velocity field - "cfl-multiplier": 0.25, - "max-dt": 1e-2 - }, - - "vof-solver": { - "advection-method": 2, - "subcycles": 2, - "materials": [1, 2], - "initial-vof": { - "mat2": { - "material-id": 2, - "region": { - "type": "cylinder", - "center": [0.5, 0.5, 0.05], - "axis": [0.0, 0.0, 1.0], - "radius": 0.25, - "halfheight": 0.2 - } - }, - "mat1": { - "material-id": 1, - "region": { - "type": "fill" - } - } - } - } -} diff --git a/examples/flow/diagplane.json b/examples/flow/diagplane.json deleted file mode 100644 index 38d68c6..0000000 --- a/examples/flow/diagplane.json +++ /dev/null @@ -1,44 +0,0 @@ -// plane unit test - -{ - - "mesh": { - "corner-min": [-0.5, -0.5, -0.5], - "corner-max": [ 0.5, 0.5, 0.5], - //"intervals" : [ 4, 4, 4] - "intervals" : [ 32, 32, 32] - //"intervals" : [8,8,8] - //"intervals" : [ 64, 64, 64] - - }, - - "sim-control": { - "initial-time": 0.0, - "initial-time-step": 1.0e-6, - "min-time-step": 1.0e-8, - //"output-times": [0.1] - "output-times": [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.8660254] - }, - - "ns-solver": { - "prescribed-velocity": 4, - "cfl-multiplier": 0.25, - "max-dt": 1e-2 - }, - - "vof-solver": { - "advection-method": 1, - "subcycles": 2, - "materials": [1, 2], - "initial-vof": { - "plane": { - "material-id": 2, - "normal": [1.0, 1.0, 1.0], - "plane-const": 0.0 - }, - "all": { - "material-id": 1 - } - } - } -} diff --git a/examples/flow/dropping_sphere.json b/examples/flow/dropping_sphere.json deleted file mode 100644 index b6f2161..0000000 --- a/examples/flow/dropping_sphere.json +++ /dev/null @@ -1,63 +0,0 @@ -// sphere of fluid dropping in a box - -{ - "mesh": { - "corner-min": [0.0, 0.0, 0.0], - "corner-max": [1.0, 1.0, 1.0], - "intervals" : [ 4,4,4] - //"intervals" : [ 16, 16, 16] - //"intervals" : [ 32, 32, 32] - //"intervals" : [ 64, 64, 64] - //"intervals" : [128, 128, 128] - }, - - "sim-control": { - "initial-time": 0.0, - "initial-time-step": 1.0e-6, - "min-time-step": 1.0e-8, - "output-times": [0.1] - //"output-times": [0.5, 1.0, 1.5, 2.0, 2.5, 3.0] - // "output-times": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, - // 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, - // 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 2.95, 2.98, 3.0] - }, - - "ns-solver": { - "body-force": [0.0, 0.0, -9.8], - "bc": { - "no-slip-walls": { //is there any way to actually apply no-slip, rather than no-flux? - "condition": "dirichlet-velocity", - "face-sets": [1,2,3,4,5,6], - "data-constant": 0.0 - } - }, - "projection-solver": { - "rel-tol": 1.0e-3, - "max-ds-iter": 10, - "max-amg-iter": 10, - "krylov-method": "gmres", - "gmres-krylov-dim": 3 - } - }, - - "material-properties": { - "densities": [0.1, 0.2] //, - //"immobile-materials": [] - //"material-sound-speeds": [] - }, - - "vof-solver": { - "advection-method": 2, - "materials": [1, 2], - "initial-vof": { - "sphere": { - "material-id": 2, - "center": [0.35, 0.35, 0.35], - "radius": 0.15 - }, - "all": { - "material-id": 1 - } - } - } -} diff --git a/examples/flow/ds.json b/examples/flow/ds.json deleted file mode 100644 index bceaad5..0000000 --- a/examples/flow/ds.json +++ /dev/null @@ -1,52 +0,0 @@ -// Deforming sphere in a prescribed reversing vortex. - -{ - "mesh": { - "corner-min": [0.0, 0.0, 0.0], - "corner-max": [1.0, 1.0, 1.0], - //"intervals" : [8,8,8] - //"intervals" : [ 16, 16, 16] - //"intervals" : [ 32, 32, 32] - "intervals" : [ 64, 64, 64] - //"intervals" : [128, 128, 128] - }, - - "sim-control": { - "initial-time": 0.0, - "initial-time-step": 1.0e-6, - "min-time-step": 1.0e-8, - "output-times": [0.0,0.001] - //"output-times": [0.5, 1.0, 1.5, 2.0, 2.5, 3.0] - //"output-times": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0] //, - // 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, - // 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 2.95, 2.98, 3.0] - }, - - "ns-solver": { - "prescribed-velocity": 1, - "cfl-multiplier": 0.25, - "max-dt": 1e-2 - }, - - "vof-solver": { - "advection-method": 2, - "subcycles": 2, - "materials": [1, 2], - "initial-vof": { - "mat2": { - "material-id": 2, - "region": { - "type": "sphere", - "center": [0.35, 0.35, 0.35], - "radius": 0.15 - } - }, - "mat1": { - "material-id": 1, - "region": { - "type": "fill" - } - } - } - } -} diff --git a/examples/flow/ds_scaling.json b/examples/flow/ds_scaling.json deleted file mode 100644 index 15b33fd..0000000 --- a/examples/flow/ds_scaling.json +++ /dev/null @@ -1,37 +0,0 @@ -// Deforming sphere in a prescribed reversing vortex. - -{ - "mesh": { - "corner-min": [0.0, 0.0, 0.0], - "corner-max": [1.0, 1.0, 1.0], - "intervals" : [ 108,108,108 ] - //"intervals" : [ 32, 32, 32] - //"intervals" : [ 64, 64, 64] - //"intervals" : [128, 128, 128] - }, - - "sim-control": { - "initial-time": 0.0, - "initial-time-step": 1.0e-6, - "min-time-step": 1.0e-8, - "output-times": [100.0] - }, - - "ns-solver": { - "prescribed-velocity": 1 - }, - - "vof-solver": { - "materials": [1, 2], - "initial-vof": { - "sphere": { - "material-id": 2, - "center": [0.35, 0.35, 0.35], - "radius": 0.15 - }, - "all": { - "material-id": 1 - } - } - } -} diff --git a/examples/flow/dsmulti.json b/examples/flow/dsmulti.json deleted file mode 100644 index c30aa3f..0000000 --- a/examples/flow/dsmulti.json +++ /dev/null @@ -1,59 +0,0 @@ -// Deforming multi-material sphere in a prescribed reversing vortex. - -{ - "mesh": { - "corner-min": [0.0, 0.0, 0.0], - "corner-max": [1.0, 1.0, 1.0], - //"intervals" : [ 16, 16, 16] - //"intervals" : [ 32, 32, 32] - "intervals" : [ 64, 64, 64] - }, - - "sim-control": { - "initial-time": 0.0, - "initial-time-step": 1.0e-6, - "min-time-step": 1.0e-8, - "output-times": [0.5, 1.0, 1.5, 2.0, 2.5, 3.0] - // "output-times": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, - // 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, - // 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 2.95, 2.98, 3.0] - }, - - "ns-solver": { - "prescribed-velocity": 1, - "cfl-multiplier": 0.25, - "max-dt": 1e-2 - }, - - "vof-solver": { - "advection-method": 2, - "subcycles": 2, - "materials": [1, 2, 3], - "initial-vof": { - "mat3": { - "material-id": 3, - "region": { - "type": "half-sphere", - "normal": [0.0, 0.0, 1.0], - "center": [0.35, 0.35, 0.35], - "radius": 0.15 - } - }, - "mat2": { - "material-id": 2, - "region": { - "type": "sphere", - //"normal": [-1.0, 0.0, 0.0], - "center": [0.35, 0.35, 0.35], - "radius": 0.15 - } - }, - "mat1": { - "material-id": 1, - "region": { - "type": "fill" - } - } - } - } -} diff --git a/examples/flow/multi_box.json b/examples/flow/multi_box.json deleted file mode 100644 index a48b57d..0000000 --- a/examples/flow/multi_box.json +++ /dev/null @@ -1,100 +0,0 @@ -// multiphase channel flow without viscosity -// exact solution is u = 1/rho * dP/dx * t - -{ - "mesh": { - "corner-min": [0.0, 0.0, 0.0], - //"corner-max": [1.0, 1.0, 1.0], - "corner-max": [1.0, 1.0, 4.0], - //"intervals" : [ 4, 4, 4] - //"intervals" : [ 4, 16, 4] - "intervals" : [ 17, 17, 64] - //"intervals" : [ 32, 256, 32] - }, - - "sim-control": { - "initial-time": 0.0, - "initial-time-step": 1.0e-6, - "min-time-step": 1.0e-8, - "output-times": [0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, - 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, - 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, - 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, - 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, - 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, - 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, - 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, - 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, - 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00] - // "output-times": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, - // 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, - // 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, - // 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, - // 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, - // 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, - // 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, - // 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, - // 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, - // 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0] - // "output-times": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, - // 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, - // 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, - // 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, - // 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, - // 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0, - // 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0, - // 71.0, 72.0, 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0, - // 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, 90.0, - // 91.0, 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, 100.0] - }, - - "ns-solver": { - "cfl-multiplier": 0.25, - "max-dt": 1e-1, - "body-force": [0.0, 0.0, -9.8], - "bc": { - "no-slip-walls": { - "condition": "dirichlet-velocity", - "face-sets": [1,2,3,4,5,6], - "data-constant": 0.0 - } - }, - "projection-solver": { - "rel-tol": 1.0e-10, - "max-ds-iter": 10000, - "max-amg-iter": 2, - "krylov-method": "cg", - "gmres-krylov-dim": 15 - }, - "prediction-solver": { - "viscous-implicitness": 0.5, - "rel-tol": 1.0e-10, - "max-ds-iter": 10000, - "max-amg-iter": 2, - "krylov-method": "cg", - "gmres-krylov-dim": 15 - } - }, - - "material-properties": { - "densities": [100.0, 10.0], - "viscosities": [1.0, 1.0] - //"immobile-materials": [] - //"material-sound-speeds": [] - }, - - "vof-solver": { - "advection-method": 2, - "materials": [1, 2], - "initial-vof": { - "sphere": { - "material-id": 2, - "center": [0.5, 0.5, 2.0], - "radius": 0.25 - }, - "all": { - "material-id": 1 - } - } - } -} diff --git a/examples/flow/multi_channel.json b/examples/flow/multi_channel.json deleted file mode 100644 index c2a3b22..0000000 --- a/examples/flow/multi_channel.json +++ /dev/null @@ -1,101 +0,0 @@ -// multiphase channel flow without viscosity -// exact solution is u = 1/rho * dP/dx * t - -{ - "mesh": { - "corner-min": [0.0, 0.0, 0.0], - //"corner-max": [1.0, 1.0, 1.0], - "corner-max": [1.0, 4.0, 1.0], - //"intervals" : [ 4, 4, 4] - //"intervals" : [ 4, 16, 4] - "intervals" : [ 17, 64, 17] - //"intervals" : [ 32, 256, 32] - }, - - "sim-control": { - "initial-time": 0.0, - "initial-time-step": 1.0e-6, - "min-time-step": 1.0e-8, - "output-times": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, - 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, - 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, - 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, - 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, - 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0, - 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0, - 71.0, 72.0, 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0, - 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, 90.0, - 91.0, 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, 100.0] - //"output-times": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0] - // "output-times": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, - // 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, - // 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, - // 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, - // 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, - // 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, - // 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, - // 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, - // 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, - // 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0] - }, - - "ns-solver": { - "cfl-multiplier": 0.25, - "max-dt": 1e-1, - "body-force": [0.0, 0.0, -9.8], - "bc": { - "no-slip-walls": { - "condition": "dirichlet-velocity", - "face-sets": [1,2,5,6], - "data-constant": 0.0 - }, - "inlet-pressure": { // y=ymin - "condition": "dirichlet-pressure", - "face-sets": [3], - "data-constant": 1.0 - }, - "outlet-pressure": { // y=ymax - "condition": "dirichlet-pressure", - "face-sets": [4], - "data-constant": 0.0 - } - }, - "projection-solver": { - "rel-tol": 1.0e-10, - "max-ds-iter": 10000, - "max-amg-iter": 2, - "krylov-method": "cg", - "gmres-krylov-dim": 15 - }, - "prediction-solver": { - "viscous-implicitness": 0.5, - "rel-tol": 1.0e-10, - "max-ds-iter": 10000, - "max-amg-iter": 2, - "krylov-method": "cg", - "gmres-krylov-dim": 15 - } - }, - - "material-properties": { - "densities": [10.0, 100.0], - "viscosities": [1.0, 1.0] - //"immobile-materials": [] - //"material-sound-speeds": [] - }, - - "vof-solver": { - "advection-method": 2, - "materials": [1, 2], - "initial-vof": { - "sphere": { - "material-id": 2, - "center": [0.5, 0.5, 0.5], - "radius": 0.25 - }, - "all": { - "material-id": 1 - } - } - } -} diff --git a/examples/flow/plane.json b/examples/flow/plane.json deleted file mode 100644 index 7d82f7c..0000000 --- a/examples/flow/plane.json +++ /dev/null @@ -1,53 +0,0 @@ -// plane test for vof initialization - -{ - - "mesh": { - "corner-min": [-0.5, -0.5, -0.5], - "corner-max": [ 0.5, 0.5, 0.5], - "intervals" : [8,8,8] - //"intervals" : [ 32, 32, 32] - //"intervals" : [ 64, 64, 64] - - }, - - "sim-control": { - "initial-time": 0.0, - "initial-time-step": 1.0e-6, - "min-time-step": 1.0e-8, - //"output-times": [0.01] //,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09] - "output-times": [0.1, 0.2, 0.3, 0.4, 0.5] //, 0.6, 0.7, 0.8, 0.9, 1.0, - // 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, - // 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0] - }, - - "ns-solver": { - "prescribed-velocity": 2, - "cfl-multiplier": 0.25, - "max-dt": 1e-2 - }, - - "vof-solver": { - "advection-method": 1, - "subcycles": 1, - "materials": [1, 2], - "initial-vof": { - "mat2": { - "material-id": 2, - "region": { - "type": "plane", - //"normal": [1.0, 1.0, 1.0], - //"normal": [1.0, 1.0, 0.0], - "normal": [1.0, 0.0, 0.0], - "plane-const": 0.0 - } - }, - "mat1": { - "material-id": 1, - "region": { - "type": "fill" - } - } - } - } -} diff --git a/examples/flow/rayleigh_taylor.json b/examples/flow/rayleigh_taylor.json deleted file mode 100644 index e3ac2c7..0000000 --- a/examples/flow/rayleigh_taylor.json +++ /dev/null @@ -1,132 +0,0 @@ -// rayleigh-taylor instability - -{ - "mesh": { - "corner-min": [-0.5, -0.5, -2.0], - "corner-max": [ 0.5, 0.5, 2.0], - "intervals" : [17, 17, 64] - //"intervals" : [8, 8, 32] - //"intervals" : [2, 2, 2] - }, - - "sim-control": { - "initial-time": 0.0, - "initial-time-step": 1.0e-6, - "min-time-step": 1.0e-8, - // "output-times": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, - // 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, - // 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0] - "output-times": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, - 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, - 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, - 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, - 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, - 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, - 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, - 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, - 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, - 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0, - 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11.0, - 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9, 12.0, - 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 13.0, - 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 13.7, 13.8, 13.9, 14.0, - 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15.0, - 15.1, 15.2, 15.3, 15.4, 15.5, 15.6, 15.7, 15.8, 15.9, 16.0, - 16.1, 16.2, 16.3, 16.4, 16.5, 16.6, 16.7, 16.8, 16.9, 17.0, - 17.1, 17.2, 17.3, 17.4, 17.5, 17.6, 17.7, 17.8, 17.9, 18.0, - 18.1, 18.2, 18.3, 18.4, 18.5, 18.6, 18.7, 18.8, 18.9, 19.0, - 19.1, 19.2, 19.3, 19.4, 19.5, 19.6, 19.7, 19.8, 19.9, 20.0, - 20.1, 20.2, 20.3, 20.4, 20.5, 20.6, 20.7, 20.8, 20.9, 21.0, - 21.1, 21.2, 21.3, 21.4, 21.5, 21.6, 21.7, 21.8, 21.9, 22.0, - 22.1, 22.2, 22.3, 22.4, 22.5, 22.6, 22.7, 22.8, 22.9, 23.0, - 23.1, 23.2, 23.3, 23.4, 23.5, 23.6, 23.7, 23.8, 23.9, 24.0, - 24.1, 24.2, 24.3, 24.4, 24.5, 24.6, 24.7, 24.8, 24.9, 25.0, - 25.1, 25.2, 25.3, 25.4, 25.5, 25.6, 25.7, 25.8, 25.9, 26.0, - 26.1, 26.2, 26.3, 26.4, 26.5, 26.6, 26.7, 26.8, 26.9, 27.0, - 27.1, 27.2, 27.3, 27.4, 27.5, 27.6, 27.7, 27.8, 27.9, 28.0, - 28.1, 28.2, 28.3, 28.4, 28.5, 28.6, 28.7, 28.8, 28.9, 29.0, - 29.1, 29.2, 29.3, 29.4, 29.5, 29.6, 29.7, 29.8, 29.9, 30.0] - }, - - "ns-solver": { - "cfl-multiplier": 0.25, - "max-dt": 1e-2, - "body-force": [0.0, 0.0, -9.8], - "bc": { - "no-slip-walls": { - "condition": "dirichlet-velocity", - "face-sets": [1,2,3,4,5,6], - "data-constant": 0.0 - } - }, - "initial-condition": { - "pressure": { - "type": "piecewise", - "subfn1": { - "region": { - "type": "plane", - "normal": [0.0, 0.0, 1.0], - "plane-const": 0.0 - }, - "function": { - "type": "polynomial", - "poly-coef": [-9.8], - "poly-powers": [[0,0,1]] - } - }, - "subfn2": { - "region": { - "type": "fill" - }, - "function": { - "type": "polynomial", - "poly-coef": [-19.6], - "poly-powers": [[0,0,1]] - } - } - } - }, - "projection-solver": { - "rel-tol": 1.0e-10, - "max-ds-iter": 1000, - "max-amg-iter": 10, - "krylov-method": "cg", - "gmres-krylov-dim": 5 - }, - "prediction-solver": { - "viscous-implicitness": 0.5, - "rel-tol": 1.0e-10, - "max-ds-iter": 1000, - "max-amg-iter": 5, - "krylov-method": "cg", - "gmres-krylov-dim": 5 - } - }, - - "material-properties": { - "densities": [1.0, 2.0], - "viscosities": [0.0001, 0.0001] - }, - - "vof-solver": { - "advection-method": 1, - "subcycles": 2, - "materials": [1, 2], - "initial-vof": { - "mat1": { - "material-id": 1, - "region": { - "type": "plane", - "normal": [0.0, 0.0, 1.0], - "plane-const": 0.0 - } - }, - "mat2": { - "material-id": 2, - "region": { - "type": "all" - } - } - } - } -} diff --git a/examples/flow/single_channel.json b/examples/flow/single_channel.json deleted file mode 100644 index 7398927..0000000 --- a/examples/flow/single_channel.json +++ /dev/null @@ -1,123 +0,0 @@ -// single-phase channel flow -// exact solution, without viscosity, is u = 1/rho * dP/dx * t - -{ - "mesh": { - "corner-min": [0.0, 0.0, 0.0], - "corner-max": [1.0, 4.0, 1.0], - "intervals": [ 9, 32, 9] - //"intervals": [ 17, 64, 17] - //"intervals": [ 33, 128, 33] - //"intervals": [ 65, 256, 65] - //"intervals": [ 8, 32, 8] - //"intervals": [ 16, 64, 16] - //"intervals": [ 32, 128, 32] - //"intervals": [ 64, 256, 64] - //"intervals": [4,4,4] - //"intervals": [1,2,1] - }, - - "sim-control": { - "initial-time": 0.0, - "initial-time-step": 1.0e-6, - "min-time-step": 1.0e-8, - //"output-times": [0.01] - // "output-times": [1.0, 2.0, 3.0] - //"output-times": [0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10] - // 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, - // 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, - // 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.40, - // 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.50, - // 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, - // 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.70, - // 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.80, - // 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, - // 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.00] - "output-times": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, - 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, - 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0] // , - // 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, - // 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, - // 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, - // 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, - // 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, - // 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, - // 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0] - // "output-times": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, - // 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, - // 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, - // 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, - // 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, - // 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0, - // 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0, - // 71.0, 72.0, 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0, - // 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, 90.0, - // 91.0, 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, 100.0] - }, - - "ns-solver": { - "cfl-multiplier": 0.25, - "max-dt": 1e-2, - //"body-force": [0.0, 0.0, -9.8], - "bc": { - "no-slip-walls": { - "condition": "dirichlet-velocity", - "face-sets": [1,2,5,6], - "data-constant": 0.0 - }, - "inlet-pressure": { // y=ymin - "condition": "dirichlet-pressure", - "face-sets": [3], - "data-constant": 1.0 - }, - "outlet-pressure": { // y=ymax - "condition": "dirichlet-pressure", - "face-sets": [4], - "data-constant": 0.0 - } - }, - "initial-condition": { - "pressure": { - "type": "polynomial", - "poly-coef": [1.0, -0.25], - "poly-powers": [[0,0,0],[0,1,0]] - } - }, - "prediction-solver": { - "viscous-implicitness": 0.5, - "rel-tol": 1.0e-10, - "max-ds-iter": 1000, - "max-amg-iter": 5, - "krylov-method": "cg", - "gmres-krylov-dim": 5 - }, - "projection-solver": { - "rel-tol": 1.0e-10, - "max-ds-iter": 1000, - "max-amg-iter": 10, - "krylov-method": "cg", - "gmres-krylov-dim": 5 - } - }, - - "material-properties": { - "densities": [10.0], - "viscosities": [10.0] - //"immobile-materials": [] - //"material-sound-speeds": [] - }, - - "vof-solver": { - "advection-method": 1, - "subcycles": 2, - "materials": [1], - "initial-vof": { - "mat1": { - "material-id": 1, - "region": { - "type": "all" - } - } - } - } -} diff --git a/examples/flow/sphere.json b/examples/flow/sphere.json deleted file mode 100644 index eb9d748..0000000 --- a/examples/flow/sphere.json +++ /dev/null @@ -1,38 +0,0 @@ -// Deforming sphere in a prescribed reversing vortex. - -{ - "mesh": { - "corner-min": [0.0, 0.0, 0.25], - "corner-max": [1.0, 1.0, 0.75], - "intervals" : [4,4,2] - //"intervals" : [ 16, 16, 16] - //"intervals" : [ 32, 32, 32] - //"intervals" : [ 64, 64, 64] - //"intervals" : [128, 128, 128] - }, - - "sim-control": { - "initial-time": 0.0, - "initial-time-step": 1.0e-6, - "min-time-step": 1.0e-8, - "output-times": [0.0] - }, - - "ns-solver": { - "prescribed-velocity": 1 - }, - - "vof-solver": { - "materials": [1, 2], - "initial-vof": { - "sphere": { - "material-id": 2, - "center": [0.5, 0.5, -0.5], - "radius": 1.0 - }, - "all": { - "material-id": 1 - } - } - } -} diff --git a/examples/hc/attr b/examples/hc/attr deleted file mode 100644 index 4dd9369..0000000 --- a/examples/hc/attr +++ /dev/null @@ -1,320 +0,0 @@ -gmv_attributes2 - -filename /home/nnc/Telluride/pececillo/examples/hc/out.gmv.0016 - -matrgba 4 0.000000e+00 1.000000e+00 0.000000e+00 1.000000e+00 - - -angles -4.800000e+01 -1.850000e+01 0.000000e+00 - -magnify 1.573258e+00 - -range 2.040000e+00 1.018762e+00 1.018762e+00 - -span 2.497469e+00 - -aspect 1.285714e+00 - -pan 2.487558e-01 -3.327062e-02 - -translate -0.000000e+00 -4.993930e-01 -4.993930e-01 - -plotbox_mins -1.020000e+00 -9.987860e-03 -9.987860e-03 - -plotbox_maxs 1.020000e+00 1.008774e+00 1.008774e+00 - -explodefact 0.000000e+00 0.000000e+00 0.000000e+00 - -velscale 1.000000e+00 - -velarrowsize 1.000000e+00 - -axisflag 1 - -nodesflag 0 - -linesflag 0 - -polysflag 0 - -cellsflag 0 - -celledgesflag 0 - -cellhiddenedgesflag 0 - -cellexpflag -1 - -timeflag 1 - -cycleflag 0 - -distscaleflag 0 - -textureflag 1 - -tracerflag 0 - -nodefieldactive MATERIAL - -cellfieldactive MATERIAL - -backgroundcolor 255 255 255 - -light 0.000000e+00 0.000000e+00 - -xscale 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 - -yscale 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 - -zscale 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 - -scaleaxis 1.000000e+00 1.000000e+00 1.000000e+00 - -nodefield_limits 11 - H 1.000000e+00 1.000010e+00 - T 2.000000e+00 2.000020e+00 - ^Vect Mag^ 0.000000e+00 1.000000e-05 - FldCalc1 0.000000e+00 1.000000e-05 - FldCalc2 0.000000e+00 1.000000e-05 - FldCalc3 0.000000e+00 1.000000e-05 - FldCalc4 0.000000e+00 1.000000e-05 - FldCalc5 0.000000e+00 1.000000e-05 - X-Coords -1.000000e+00 1.000000e+00 - Y-Coords 0.000000e+00 9.987860e-01 - Z-Coords -6.665530e-33 9.987860e-01 -nodefield_nice_limits 11 - H 1.000000e+00 1.000010e+00 - T 2.000000e+00 2.000020e+00 - ^Vect Mag^ 0.000000e+00 1.000000e-05 - FldCalc1 0.000000e+00 1.000000e-05 - FldCalc2 0.000000e+00 1.000000e-05 - FldCalc3 0.000000e+00 1.000000e-05 - FldCalc4 0.000000e+00 1.000000e-05 - FldCalc5 0.000000e+00 1.000000e-05 - X-Coords -1.000000e+00 1.000000e+00 - Y-Coords 0.000000e+00 9.987860e-01 - Z-Coords -6.665530e-33 9.987860e-01 -nodefield_lim_flags 11 - H 0 0 0 - T 0 0 0 - ^Vect Mag^ 0 0 0 - FldCalc1 0 0 0 - FldCalc2 0 0 0 - FldCalc3 0 0 0 - FldCalc4 0 0 0 - FldCalc5 0 0 0 - X-Coords 0 0 0 - Y-Coords 0 0 0 - Z-Coords 0 0 0 - -cellfield_limits 8 - H 1.000000e+00 1.000010e+00 - T 1.000000e+00 3.000000e+00 - ^Vect Mag^ 0.000000e+00 1.000000e-05 - FldCalc1 0.000000e+00 0.000000e+00 - FldCalc2 0.000000e+00 0.000000e+00 - FldCalc3 0.000000e+00 0.000000e+00 - FldCalc4 0.000000e+00 0.000000e+00 - FldCalc5 0.000000e+00 0.000000e+00 - -cellfield_nice_limits 8 - H 1.000000e+00 1.000010e+00 - T 1.000000e+00 3.000000e+00 - ^Vect Mag^ 0.000000e+00 1.000000e-05 - FldCalc1 0.000000e+00 0.000000e+00 - FldCalc2 0.000000e+00 0.000000e+00 - FldCalc3 0.000000e+00 0.000000e+00 - FldCalc4 0.000000e+00 0.000000e+00 - FldCalc5 0.000000e+00 0.000000e+00 -cellfield_lim_flags 8 - H 0 0 0 - T 0 0 0 - ^Vect Mag^ 0 0 0 - FldCalc1 0 0 0 - FldCalc2 0 0 0 - FldCalc3 0 0 0 - FldCalc4 0 0 0 - FldCalc5 0 0 0 - -plotbox_mins_prev -1.020000e+00 -9.987860e-03 -9.987860e-03 - -plotbox_maxs_prev 1.020000e+00 1.008774e+00 1.008774e+00 - -cliponbox 0 - -nrefl_loops 1 - -reflect 0 0 0 - -clipvalue 0.000000e+00 1.000000e+00 - -polysubset_mins -1.020000e+00 -9.987860e-03 -9.987860e-03 - -polysubset_maxs 1.020000e+00 1.008774e+00 1.008774e+00 - -subset_mins -1.020000e+00 -9.987860e-03 -9.987860e-03 - -subset_maxs 1.020000e+00 1.008774e+00 1.008774e+00 - -mat_order 0 - -nodeselflag Material ALL - -nodeandorflag 1 0 - -cellselflag Material ALL - -cellandorflag 1 0 - -colorbarflag 1 - -colorbarpref 0 - -boundingboxflag 0 - -boundingbox_mins -1.000000e+00 0.000000e+00 -6.665530e-33 - -boundingbox_maxs 1.000000e+00 9.987860e-01 9.987860e-01 - -boundingbox_mins_prev -1.000000e+00 0.000000e+00 -6.665530e-33 - -boundingbox_maxs_prev 1.000000e+00 9.987860e-01 9.987860e-01 - -viewflag 0 - -flypos 0.000000e+00 0.000000e+00 0.000000e+00 - -cellcontflag 0 - -cliponcellsel 0 - -vectfld_ NONE NONE NONE - -maxspeed 0.000000e+00 - -vectorflag 0 - -vectorarrow 1 - -vectorlog 0 - -cvectfld_ NONE NONE NONE - -cmaxspeed 0.000000e+00 - -cvectorflag 0 - -titleflag 0 - -nodeselmat_on 0 - -cellselmat_on 0 - -bboxcoordflag 1 - -nodenumflag 0 - -cellnumflag 0 - -pnt_size 2 0 - -line_size 2 0 - -node0matflag 0 - -cell0matflag 0 - -tracehistflag 0 - -tracehiststop 0 - -tracehiststride 1 - -tracehistpoints 1 - -cellshadeflag 0 - -fieldcolortype 0 - -nset_contours 10 - -facerefineflag 0 - -cellnormflag 0 - -cellmedianedgeflag 0 - -cellnodenumflag 0 - -cellfacenumflag 0 - -polystiplflag 0 - -surfflag 1 - -surfedgesflag 0 - -surfexpflag -1 - -surffieldactive Surf T - -surfnumflag 0 - -surfnodenumflag 0 - -surfrefineflag 0 - -surfcontflag 0 - -surfshadeflag 1 - -surf0matflag 0 - -svectfld_ NONE NONE NONE - -smaxspeed 0.000000e+00 - -svectorflag 0 - -surffield_limits 6 - T 1.473790e+00 2.398370e+00 - FldCalc1 0.000000e+00 0.000000e+00 - FldCalc2 0.000000e+00 0.000000e+00 - FldCalc3 0.000000e+00 0.000000e+00 - FldCalc4 0.000000e+00 0.000000e+00 - FldCalc5 0.000000e+00 0.000000e+00 - -surffield_nice_limits 6 - T 1.000000e+00 3.000000e+00 - FldCalc1 0.000000e+00 0.000000e+00 - FldCalc2 0.000000e+00 0.000000e+00 - FldCalc3 0.000000e+00 0.000000e+00 - FldCalc4 0.000000e+00 0.000000e+00 - FldCalc5 0.000000e+00 0.000000e+00 -surffield_lim_flags 6 - T 0 0 0 - FldCalc1 0 0 0 - FldCalc2 0 0 0 - FldCalc3 0 0 0 - FldCalc4 0 0 0 - FldCalc5 0 0 0 - -surfselflag Material ALL - - -surfandorflag 1 0 - -surfselmat_on 0 - -drawunselnodes 0 - -drawunselcells 0 - -distscale_x 120 -distscale_y 60 -orient_axisflag 0 -orient_axis_x 840 -orient_axis_y 60 -end_attributes - diff --git a/examples/hc/ex1.json b/examples/hc/ex1.json deleted file mode 100644 index 351b721..0000000 --- a/examples/hc/ex1.json +++ /dev/null @@ -1,78 +0,0 @@ -// Linear heat equation on a unit ball with small off-center ball excluded. -// Exploit symmetry and solve on quarter domain y,z >= 0. Sinusoidal time- -// dependent Dirichlet BC on outside surface. Constant Dirichlet condition -// on inside surface. Solve through two periods of the sinusoidal BC. -// Uniform initial temperature is not consistent with the inside Dirichlet -// BC, and so there is short initial transient. - -{ - -"mesh": { "mesh-file": "mesh1-medium.exo" }, - -"sim-control": { - "initial-time": 0.0, - "initial-time-step": 1.0e-6, - "min-time-step": 1.0e-8, - "output-times": [0.05, 0.1, 0.15, 0.2] - }, - -"partition-layout": { - "partition-size": 128 - }, - -"hc-model": { - "density": 2.0, - "specific-heat": 0.25, - "conductivity": 0.5, - "source": 0.0, - "bc": { - "inside": { - "condition": "dirichlet", - "face-sets": [2], - //"data-constant": 2.0 - "data-function": { - "type": "polynomial", - "poly-coef": [2.0, 15.0], - "poly-powers": [[0,0,0,0],[0,0,0,2]] - } - }, - "outside": { - "condition": "dirichlet", - "face-sets": [3], - "data-function": { - "type": "sinusoidal", - "mean-value": 2.0, - "amplitude": 1.0, - "frequency": 1.0 - } - }, - "symmetry-planes": { - "condition": "flux", - "face-sets": [1], - "data-constant": 0.0 - } - } - }, - -"hc-solver": { - "preconditioner": { - "method": "BoomerAMG", - "parameters": { "num-cycles": 2 } - }, - "error-norm": { - "temp-rel-tol": 1.0e-3, - "enth-rel-tol": 1.0e-3 - }, - "integrator": { - "nlk-max-iter": 5, - "nlk-tol": 0.01 - } - }, - -"initial-temperature": { - "all": { - "cell-blocks": [1], - "constant": 2.0 - } - } -} diff --git a/examples/hc/gmvrc b/examples/hc/gmvrc deleted file mode 100644 index c9a5391..0000000 --- a/examples/hc/gmvrc +++ /dev/null @@ -1,24 +0,0 @@ -gmvrc -azim -50.500000 elev 3.000000 twist 0.000000 -mag 1.000000 -nodes off nodenumbers off -cellfaces on celledges off cellnumbers off -polygons off polygonlines off -axis on time on cycle off -linesize 2 linetype regular -pointsize 2 pointshape square -ncontours 10 vector_arrow on -xreflect off yreflect off zreflect off -xscaleaxis 1.000000 yscaleaxis 1.000000 zscaleaxis 1.000000 -boundingbox off boundingboxcoords on -background_red 1.000000 background_green 1.000000 background_blue 1.000000 -display_list off -trackball off -beep on -distscale off -windowwidth 900 windowheight 700 -texture on -interactivity 10 -imagetype jpg -orient_axis off orient_axis_x 840 orient_axis_y 60 -end_gmvrc diff --git a/examples/hc/host_launch.sh b/examples/hc/host_launch.sh deleted file mode 100755 index 265d0cb..0000000 --- a/examples/hc/host_launch.sh +++ /dev/null @@ -1,8 +0,0 @@ - -HOST=`hostname` -DIR=`pwd` -CARD=mic0 - -echo "launching on $HOST-$CARD" -ssh $HOST-$CARD "$DIR/mic_launch.sh $DIR" - diff --git a/examples/hc/mesh1-coarse.exo b/examples/hc/mesh1-coarse.exo deleted file mode 100644 index 03f322e..0000000 Binary files a/examples/hc/mesh1-coarse.exo and /dev/null differ diff --git a/examples/hc/mesh1-fine.exo b/examples/hc/mesh1-fine.exo deleted file mode 100644 index 05c35fe..0000000 Binary files a/examples/hc/mesh1-fine.exo and /dev/null differ diff --git a/examples/hc/mesh1-medium.exo b/examples/hc/mesh1-medium.exo deleted file mode 100644 index ba9859c..0000000 Binary files a/examples/hc/mesh1-medium.exo and /dev/null differ diff --git a/examples/hc/mesh1.exo b/examples/hc/mesh1.exo deleted file mode 100644 index 1280748..0000000 Binary files a/examples/hc/mesh1.exo and /dev/null differ diff --git a/examples/hc/mesh1.jou b/examples/hc/mesh1.jou deleted file mode 100644 index be3e788..0000000 --- a/examples/hc/mesh1.jou +++ /dev/null @@ -1,81 +0,0 @@ -## /opt/cubit/13.2-48137/bin/clarox -## Cubit Version 13.2 -## Cubit Build 48137 -## Revised 2012-05-31 10:27:28 -0600 (Thu, 31 May 2012) -## Running 09/24/2014 10:21:18 PM -## Command Options: -## -warning = On -## -information = On -create sphere radius 1 ypositive zpositive -create sphere radius 0.2 -move volume 2 x 0.4 include_merged -chop volume 1 with volume 2 -delete volume 3 -create frustum height 2 radius 1 top 0.1 -delete volume 5 -create frustum height 2 radius 0.1 top 0 -delete volume 6 -create frustum height 2 radius 0.2 top 0 -delete volume 7 -create frustum height 2 radius 0.4 top 0 -move volume 8 x 0 y 0 z -1 include_merged -rotate volume 8 angle 90 about y include_merged -move volume 8 x 0.4 y 0 z 0 include_merged -delete volume 8 -create frustum height 2 radius 0.8 top 0 -move volume 9 x 0 y 0 z -1 include_merged -rotate volume 9 angle 90 about y include_merged -move volume 9 x 0.4 y 0 z 0 include_merged -webcut volume 4 tool volume 9 -volume 9 reflect x -move volume 9 x 0.8 y 0 z 0 include_merged -webcut volume 4 tool volume 9 -delete volume 9 -imprint volume all -merge volume all - -surface 30 size 0.015 -mesh surface 30 -surface 39 size 0.015 -mesh surface 39 -curve 10 24 22 scheme bias fine size 0.015 coarse size 0.05 -curve 24 tangent opposite -curve 10 24 22 interval 25 -curve 10 24 22 scheme bias factor 1.1 -mesh curve 10 24 22 -volume 10 size auto factor 5 -mesh volume 10 -curve 9 tangent opposite -curve 38 tangent opposite -curve 40 9 38 interval 15 -curve 40 9 38 scheme bias factor 1.1 -mesh curve 40 9 38 -volume 11 size auto factor 5 -mesh volume 11 -curve 44 size 0.015 -curve 44 scheme equal -mesh curve 44 -surface 36 size auto factor 5 -mesh surface 36 -volume 4 size auto factor 5 -mesh volume 4 - -block 1 volume 10 4 11 -sideset 1 surface 28 36 38 31 34 40 -sideset 2 surface 35 30 39 -sideset 3 surface 41 33 29 -set large exodus file off -export genesis "mesh1-coarse.exo" overwrite - -refine volume 10 4 11 numsplit 1 bias 1 depth 1 smooth -set large exodus file off -export genesis "mesh1-medium.exo" overwrite - -refine volume 10 4 11 numsplit 1 bias 1 depth 1 smooth -volume 10 4 11 smooth scheme smart laplacian -smooth volume 10 4 11 -surface all smooth scheme centroid area pull -smooth surface all -smooth surface all -set large exodus file off -export genesis "mesh1-fine.exo" overwrite diff --git a/examples/hc/mesh2.exo b/examples/hc/mesh2.exo deleted file mode 100644 index 0567acc..0000000 Binary files a/examples/hc/mesh2.exo and /dev/null differ diff --git a/examples/hc/mic_launch.sh b/examples/hc/mic_launch.sh deleted file mode 100755 index f460aa0..0000000 --- a/examples/hc/mic_launch.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -DIR=$1 - -# Change to the example directory -cd $DIR - -# Set the vtune config script. -source /projects/partisn/vtune_amplifier_xe/amplxe-vars.sh - -# Set the thread policy -export KMP_AFFINITY=SCATTER - -# Set the number of threads -export OMP_NUM_THREADS=240 - -# Set the location of the intel shared libraries -export LD_LIBRARY_PATH=/projects/partisn/composerxe/lib/mic - -# Unlimit the stack size -ulimit -s unlimited - -# Launch the executable -../../build-mic-15/src/hc/pececillo-HC ex1.json - diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt deleted file mode 100644 index ef527c8..0000000 --- a/external/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -project(PececilloTPL) - -message(STATUS "Configuring the external packages") - -# Add -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake) - -# Add ExternalProject_Add to scope -include(ExternalProject) - -# If not specified, the prefix for the external package installation path -# defaults to the "external" subdirectory of CMAKE_INSTALL_PREFIX. This -# is also one location cmake will look for pre-installed packages. -if(NOT TPL_INSTALL_PREFIX) - set(TPL_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/external) -endif() - -# --- Useful directory variables (GET RID OF THESE) -set(TPL_TEMPLATES_DIR ${CMAKE_CURRENT_LIST_DIR}/templates) -set(TPL_ARCHIVE_DIR ${CMAKE_CURRENT_LIST_DIR}/tarfiles) -set(TPL_PATCHES_DIR ${CMAKE_CURRENT_LIST_DIR}/patches) - -# GNU AUTOCONF configure static/shared -set(TPL_SHARED_SWITCH --disable-shared) -if(BUILD_SHARED_LIBS) - set(TPL_SHARED_SWITCH --enable-shared) -endif() - -# Log all activity -- log files for each step in the timestamp directory -set(TPL_LOG_OPTS - LOG_DOWNLOAD 1 - LOG_UPDATE 1 - LOG_CONFIGURE 1 - LOG_BUILD 1 - LOG_TEST 1 - LOG_INSTALL 1 -) - -#include(Verify_NetCDF) -#if(NOT NetCDF_VERIFIED) -# include(ExternalProject_NetCDF) -#endif() - -include(Verify_HYPRE) -if(NOT HYPRE_VERIFIED) - include(ExternalProject_HYPRE) -endif() - -# Should be some way of doing an imported library thing, no? - -#set(HYPRE_FOUND ${HYPRE_FOUND} PARENT_SCOPE) -#set(HYPRE_BUILD_TARGET ${HYPRE_BUILD_TARGET} PARENT_SCOPE) -set(HYPRE_VERSION ${HYPRE_VERSION} PARENT_SCOPE) -set(HYPRE_IS_PARALLEL ${HYPRE_IS_PARALLEL} PARENT_SCOPE) -#set(HYPRE_LIBRARY ${HYPRE_LIBRARY} PARENT_SCOPE) -set(HYPRE_LIBRARIES ${HYPRE_LIBRARIES} PARENT_SCOPE) -#set(HYPRE_INCLUDE_DIR ${HYPRE_INCLUDE_DIR} PARENT_SCOPE) -set(HYPRE_INCLUDE_DIRS ${HYPRE_INCLUDE_DIRS} PARENT_SCOPE) diff --git a/external/cmake/ExternalProject_HYPRE.cmake b/external/cmake/ExternalProject_HYPRE.cmake deleted file mode 100644 index 12f3a06..0000000 --- a/external/cmake/ExternalProject_HYPRE.cmake +++ /dev/null @@ -1,213 +0,0 @@ -# # -*- mode: cmake -*- - -# -# ExternalProject_HYPRE -# Build the HYPRE project -# -# - -# --- Setup - -# Projects/targets dependent on HYPRE need this target -set(HYPRE_BUILD_TARGET hypre) - -# Define the version and archive file -set(EP_HYPRE_VERSION_MAJOR 2) -set(EP_HYPRE_VERSION_MINOR 11) -set(EP_HYPRE_VERSION_PATCH 1) -set(EP_HYPRE_VERSION ${EP_HYPRE_VERSION_MAJOR}.${EP_HYPRE_VERSION_MINOR}.${EP_HYPRE_VERSION_PATCH}) -set(EP_HYPRE_ARCHIVE_FILE hypre-${EP_HYPRE_VERSION}.tar.gz) -set(EP_HYPRE_MD5_SUM 3f02ef8fd679239a6723f60b7f796519) - -# Useful utility to build *FLAGS strings -include(BuildWhitespaceString) - -# Make CMake files to run scripts and exit correctly -include(MakeCMakeCommandFile) - -# Construct library names -include(BuildLibraryName) - -# ExternalProject directories, file and log settings -set(hypre_url_file ${PececilloTPL_SOURCE_DIR}/tarfiles/${EP_HYPRE_ARCHIVE_FILE}) -set(hypre_prefix_dir ${PececilloTPL_BINARY_DIR}/hypre) -set(hypre_source_dir ${hypre_prefix_dir}/hypre-${EP_HYPRE_VERSION}-source) -set(hypre_stamp_dir ${hypre_prefix_dir}/hypre-timestamps) -set(hypre_tmp_dir ${hypre_prefix_dir}/hypre-tmp) -set(hypre_install_dir ${TPL_INSTALL_PREFIX}) - -# --- Compile/Build Environment Variables -set(cflags_list) -set(ldflags_list) - -# MPI flags and opts -if ( ENABLE_MPI ) - - # Configure option - set(hypre_mpi_opt --with-MPI) - - # MPI flags for CFLAGS - foreach(dir ${MPI_C_INCLUDE_PATH}) - list(APPEND cflags_list -I${dir}) - endforeach() - list(APPEND cflags_list ${MPI_C_COMPILE_FLAGS}) - - # MPI flags for LDFLAGS - include(SplitLibraryName) - foreach(lib ${MPI_C_LIBRARIES}) - split_library_name(${lib} PATH lib_path LIBNAME lib_name EXT lib_ext) - list(APPEND ldflags_list -L${lib_path} -l${lib_name}) - endforeach() - list(APPEND ldflags_list ${MPI_C_LINK_FLAGS}) - -else() - set(hypre_mpi_opt --without-MPI) -endif() - -# BLAS options -set(hypre_blas_opt) -find_package(BLAS) -if (BLAS_FOUND) - list(APPEND ldflags_list ${BLAS_LIBRARIES}) - list(APPEND ldflags_list ${BLAS_LINKER_FLAGS}) - set(hypre_blas_opt --with-blas) -endif() - -# LAPACK options -set(hypre_lapack_opt) -find_package(LAPACK) -if (LAPACK_FOUND) - list(APPEND ldflags_list ${LAPACK_LIBRARIES}) - list(APPEND ldflags_list ${LAPACK_LINKER_FLAGS}) - set(hypre_lapack_opt --with-lapack) -endif() - -# debug options -#set(hypre_debug_opt --enable-debug) - -# OpenMP -#BROKENset(hypre_openmp_opt) -#BROKENfind_package(OpenMP) -#BROKENif (OPENMP_FOUND) -#BROKEN set(hypre_openmp_opt --with-openmp) -#BROKEN set(cflags_list ${OpenMP_C_FLAGS}) -#BROKENendif() - -# Whitespace strings for the shell scripts -build_whitespace_string(hypre_cflags ${cflags_list}) -build_whitespace_string(hypre_ldflags ${ldflags_list}) - -# --- Create the configure scripts and command - -# Build the configure script -set(hypre_sh_configure ${hypre_prefix_dir}/hypre-configure-step.sh) -configure_file(${PececilloTPL_SOURCE_DIR}/templates/hypre-configure-step.sh.in - ${hypre_sh_configure} - @ONLY) - -# Configure the CMake command file -set(hypre_cmake_configure ${hypre_prefix_dir}/hypre-configure-step.cmake) -make_cmake_command_file(${hypre_cmake_configure} - SCRIPT ${hypre_sh_configure} - ACTION configure - EP_NAME HYPRE - WORK_DIRECTORY ${hypre_source_dir}/src) - -# Configure command -set(HYPRE_CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${hypre_cmake_configure}) - -# --- Define the build scripts and command - -# Build script -set(hypre_sh_build ${hypre_prefix_dir}/hypre-build-step.sh) -configure_file(${PececilloTPL_SOURCE_DIR}/templates/hypre-build-step.sh.in - ${hypre_sh_build} - @ONLY) - -# CMake build command file -set(hypre_cmake_build ${hypre_prefix_dir}/hypre-build-step.cmake) -make_cmake_command_file(${hypre_cmake_build} - SCRIPT ${hypre_sh_build} - ACTION build - EP_NAME HYPRE - WORK_DIRECTORY ${hypre_source_dir}/src) - -# Build command -set(HYPRE_BUILD_COMMAND ${CMAKE_COMMAND} -P ${hypre_cmake_build}) - -# --- Define the install scripts and command - -# Build the install script -set(hypre_sh_install ${hypre_prefix_dir}/hypre-install-step.sh) -configure_file(${PececilloTPL_SOURCE_DIR}/templates/hypre-install-step.sh.in - ${hypre_sh_install} - @ONLY) - -# CMake install command file -set(hypre_cmake_install ${hypre_prefix_dir}/hypre-install-step.cmake) -make_cmake_command_file(${hypre_cmake_install} - SCRIPT ${hypre_sh_install} - ACTION install - EP_NAME HYPRE - WORK_DIRECTORY ${hypre_source_dir}/src) - -# Install command -set(HYPRE_INSTALL_COMMAND ${CMAKE_COMMAND} -P ${hypre_cmake_install}) - -# --- Add the external project -ExternalProject_Add(${HYPRE_BUILD_TARGET} - # -- Project directories - PREFIX ${hypre_prefix_dir} - TMP_DIR ${hypre_tmp_dir} - STAMP_DIR ${hypre_stamp_dir} - # -- Archive file definitions - URL ${hypre_url_file} - URL_MD5 ${EP_HYPRE_MD5_SUM} - # -- Configure - SOURCE_DIR ${hypre_source_dir} - CONFIGURE_COMMAND ${HYPRE_CONFIGURE_COMMAND} - # -- Build - BINARY_DIR ${hypre_build_dir} - BUILD_COMMAND ${HYPRE_BUILD_COMMAND} - BUILD_IN_SOURCE TRUE - # -- Install - #INSTALL_DIR ${hypre_install_dir} - INSTALL_COMMAND ${HYPRE_INSTALL_COMMAND} - # -- Output control - ${TPL_LOG_OPTS}) - -# --- Set the variables for other targets that need HYPRE - -# Version -set(HYPRE_VERSION ${EP_HYPRE_VERSION}) - -# Include directory -set(HYPRE_INCLUDE_DIR ${hypre_install_dir}/include) -set(inc_dirs ${HYPRE_INCLUDE_DIR}) -if (ENABLE_MPI) - list(APPEND inc_dir ${MPI_C_INCLUDE_PATH}) -endif() -set(HYPRE_INCLUDE_DIRS ${inc_dirs}) - -# Library -build_library_name(HYPRE HYPRE_LIBRARY APPEND_PATH ${hypre_install_dir}/lib) -set(HYPRE_LIBRARY ${HYPRE_LIBRARY}) -set(libs ${HYPRE_LIBRARY}) -if(ENABLE_MPI) - list(APPEND libs ${MPI_C_LIBRARIES}) -endif() -if(LAPACK_FOUND) - list(APPEND libs ${LAPACK_LIBRARIES}) -endif() -if(BLAS_FOUND) - list(APPEND libs ${BLAS_LIBRARIES}) -endif() -set(HYPRE_LIBRARIES ${libs}) - -# Flags -if (ENABLE_MPI) - set(HYPRE_IS_PARALLEL True) -else() - set(HYPRE_IS_PARALLEL False) -endif() - diff --git a/external/cmake/ExternalProject_NetCDF.cmake b/external/cmake/ExternalProject_NetCDF.cmake deleted file mode 100644 index 6e6f813..0000000 --- a/external/cmake/ExternalProject_NetCDF.cmake +++ /dev/null @@ -1,166 +0,0 @@ -# # -*- mode: cmake -*- - -# -# ExternalProject_NetCDF -# Build the NetCDF project -# -# - -# --- Setup - -# Projects/targets dependent on NetCDF need this target -set(NETCDF_BUILD_TARGET netcdf) - - -# Define the version and archive file -set(NETCDF_VERSION 4.1.3) -set(NETCDF_TARFILE netcdf-${NETCDF_VERSION}.tar.gz) -set(NETCDF_MD5_SUM ead16cb3b671f767396387dcb3c1a814) - -# Useful utility to build *FLAGS strings -include(BuildWhitespaceString) - -# Make CMake files to run scripts and exit correctly -include(MakeCMakeCommandFile) - -# Construct library names -include(BuildLibraryName) - -# ExternalProject directories, file and log settings -set(netcdf_url_file ${TPL_ARCHIVE_DIR}/netcdf-${NETCDF_VERSION}.tar.gz) -set(netcdf_prefix_dir ${CMAKE_CURRENT_BINARY_DIR}/netcdf) -set(netcdf_source_dir ${netcdf_prefix_dir}/netcdf-source) -set(netcdf_stamp_dir ${netcdf_prefix_dir}/netcdf-timestamps) -set(netcdf_tmp_dir ${netcdf_prefix_dir}/netcdf-tmp) -set(netcdf_install_dir ${EXTERNAL_INSTALL_PREFIX}) -set(patch_file_dir ${EXTERNAL_PATCHES_DIR}) - -# Need the Compiler names without the full path -get_filename_component(CMAKE_C_COMPILER_NAME ${CMAKE_C_COMPILER} NAME) -get_filename_component(CMAKE_Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME) - -# --- Project dependencies - -# NetCDF build requires ZLIB -find_package(ZLIB REQUIRED) - -# --- Patch defines - -# Need Perl -find_package(Perl) -if (NOT PERL_FOUND) - message(FATAL_ERROR "Can not locate Perl. Can not patch NetCDF.") -endif() - -# Configure the bash patch script -set(netcdf_sh_patch ${netcdf_prefix_dir}/netcdf-patch-step.sh) -configure_file(${EXTERNAL_TEMPLATES_DIR}/netcdf-patch-step.sh.in - ${netcdf_sh_patch} - @ONLY) - -# Configure the CMake command file -set(netcdf_cmake_patch ${netcdf_prefix_dir}/netcdf-patch-step.cmake) -make_cmake_command_file(${netcdf_cmake_patch} - SCRIPT ${netcdf_sh_patch} - ACTION patch - EP_NAME NetCDF - WORK_DIRECTORY ${netcdf_prefix_dir}) - -set(NetCDF_PATCH_COMMAND ${CMAKE_COMMAND} -P ${netcdf_cmake_patch}) - -# --- Compile flags -string(TOUPPER CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} CMAKE_C_BUILD_FLAGS) -string(TOUPPER CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE} CMAKE_CXX_BUILD_FLAGS) -string(TOUPPER CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE} CMAKE_Fortran_BUILD_FLAGS) - -# C flags -if ( "${CMAKE_Fortran_COMPILER_NAME}" MATCHES "Nag|nag|NAG" ) - set(fortran_define -DNAGf90Fortran) -elseif ( "${CMAKE_Fortran_COMPILER_NAME}" MATCHES "g95" ) - set(fortran_define -DNAGf90Fortran) -endif() -build_whitespace_string(netcdf_cflags - ${CMAKE_C_FLAGS} - ${${CMAKE_C_BUILD_FLAGS}} - ${fortran_define}) - -# CPP flags -build_whitespace_string(netcdf_cppflags - -O -DNDEBUG) - -# Fortran flags -#build_whitespace_string(netcdf_fcflags -# ${CMAKE_Fortran_FLAGS} -# ${${CMAKE_Fortran_BUILD_FLAGS}} -# ) -build_whitespace_string(netcdf_fcflags - -O -DNDEBUG) - - -# --- Link flags -build_whitespace_string(netcdf_ldflags -L${zlib_install_dir}/lib) - - -# --- Add the external project - -ExternalProject_Add(${NETCDF_BUILD_TARGET} - # -- Project directories - PREFIX ${netcdf_prefix_dir} - TMP_DIR ${netcdf_tmp_dir} - STAMP_DIR ${netcdf_stamp_dir} - SOURCE_DIR ${netcdf_source_dir} - #INSTALL_DIR ${netcdf_install_dir} - # -- Archive file definitions - URL ${EXTERNAL_ARCHIVE_DIR}/${NETCDF_TARFILE} - URL_MD5 ${NETCDF_MD5_SUM} - # -- Patch - PATCH_COMMAND ${NetCDF_PATCH_COMMAND} - # -- Configure - CONFIGURE_COMMAND /configure - --prefix=${netcdf_install_dir} - --disable-dap - --disable-netcdf-4 - --disable-cxx - --with-pic - ${EXTERNAL_SHARED_SWITCH} - CC=${CMAKE_C_COMPILER_NAME} - CXX="" - FC=${CMAKE_Fortran_COMPILER_NAME} - CFLAGS=${netcdf_cflags} - CPPFLAGS=${netcdf_cppflags} - FCFLAGS=${netcdf_fcflags} - LDFLAGS=${netcdf_ldflags} - # -- Build - BUILD_COMMAND $(MAKE) - BUILD_IN_SOURCE True - # -- Output control - ${EXTERNAL_LOG_OPTS}) - -# --- Set the variables for other targets that need NetCDF - -# Large dimensions -set(NETCDF_LARGE_DIMS TRUE) - -# Include directory -set(NETCDF_INCLUDE_DIR ${netcdf_install_dir}/include) -set(NETCDF_INCLUDE_DIRS ${NETCDF_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}) - -# Library - -build_library_name(netcdf - NETCDF_C_LIBRARY - APPEND_PATH ${netcdf_install_dir}/lib) -set(NETCDFC_LIBRARY ${NETCDF_C_LIBRARY}) - -build_library_name(netcdff - NETCDF_Fortran_LIBRARY - APPEND_PATH ${netcdf_install_dir}/lib) -set(NETCDF_Fortran_LIBRARY ${NETCDF_Fortran_LIBRARY}) - -set(NETCDF_C_LIBRARIES - ${NETCDF_C_LIBRARY} ${ZLIB_LIBRARIES}) - -set(NETCDF_Fortran_LIBRARIES - ${NETCDF_Fortran_LIBRARY} ${NETCDF_C_LIBRARIES}) - - diff --git a/external/cmake/MakeCMakeCommandFile.cmake b/external/cmake/MakeCMakeCommandFile.cmake deleted file mode 100644 index 9a2b428..0000000 --- a/external/cmake/MakeCMakeCommandFile.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# # -*- mode: cmake -*- - -# -# MAKE_CMAKE_COMMAND_FILE(cmake_file -# SCRIPT script_file -# ACTION string -# EP_NAME project_name -# WORK_DIRECTORY dir) -# -include(CMakeParseArguments) -FUNCTION(MAKE_CMAKE_COMMAND_FILE cmake_file) - - # Parse arguments - set(_flags "") - set(_oneValue SCRIPT EP_NAME WORK_DIRECTORY ACTION) - set(_multiValue "") - cmake_parse_arguments(PARSE "${_flags}" "${_oneValue}" "${_multiValue}" ${ARGN}) - - set(_script ${PARSE_SCRIPT}) - set(_ep_name ${PARSE_EP_NAME}) - set(_work_dir ${PARSE_WORK_DIRECTORY}) - set(_action ${PARSE_ACTION}) - - file(TO_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/../templates template_dir) - set(template_file ${template_dir}/general-command-step.cmake.in) - - configure_file(${template_file} ${cmake_file} @ONLY@) - - -ENDFUNCTION() diff --git a/external/cmake/Verify_HYPRE.cmake b/external/cmake/Verify_HYPRE.cmake deleted file mode 100644 index f154f8f..0000000 --- a/external/cmake/Verify_HYPRE.cmake +++ /dev/null @@ -1,51 +0,0 @@ -# -# Verify HYPRE installations -# -# File is intended to be included in external/CMakeLists.txt file -# This file will set HYPRE_VERIFIED to TRUE if HYPRE is located -# and it meets the requirements. - -# -# HYPRE Requirements -# -# o Version != 2.6.0b -# o HYPRE_IS_PARALLEL == ENABLE_MPI flag - -# Boolean evaluator -include(BoolEval) - -# Default is HYPRE_VERIFIED False -set(HYPRE_VERIFIED False) - -# Install prefix -if ( NOT HYPRE_INSTALL_PREFIX ) - set(HYPRE_INSTALL_PREFIX ${TPL_INSTALL_PREFIX}) -endif() - -# Locate HYPRE -set(HYPRE_REQUIRED_VERSION 2.9.0b) -find_package(HYPRE) - -# Verify the package -if (HYPRE_FOUND) - - message(STATUS "Verify HYPRE package") - - # Version check - bool_eval(HYPRE_VERSION_OK - ${HYPRE_VERSION} VERSION_EQUAL ${HYPRE_REQUIRED_VERSION}) - - # Parallel (MPI) check - bool_eval(HYPRE_PARALLEL_OK NOT ENABLE_MPI EQUAL HYPRE_IS_PARALLEL) - - # Both checks must pass - bool_eval(HYPRE_VERIFIED HYPRE_VERSION_OK AND HYPRE_PARALLEL_OK) - -endif(HYPRE_FOUND) - -if(HYPRE_VERIFIED) - message(STATUS "Verify HYPRE package -- ok") -else(HYPRE_VERIFIED) - message(STATUS "Verify HYPRE package -- failed ") -endif(HYPRE_VERIFIED) - diff --git a/external/cmake/Verify_NetCDF.cmake b/external/cmake/Verify_NetCDF.cmake deleted file mode 100644 index a228e7c..0000000 --- a/external/cmake/Verify_NetCDF.cmake +++ /dev/null @@ -1,50 +0,0 @@ -# -# Verify NETCDF installations -# -# File is intended to be included in external/CMakeLists.txt file -# This file will set NETCDF_VERIFIED to TRUE if NETCDF is located -# and it meets the requirements. - -# -# NETCDF Requirements -# -# o Version > 1.8 -# o Need the hdf5_hl (high-level library) -# - -# FindNETCDF relies on NETCDF_INSTALL_PREFIX to locate -# NETCDF -if (NOT NETCDF_INSTALL_PREFIX) - set(NETCDF_INSTALL_PREFIX ${EXTERNAL_INSTALL_PREFIX}) -endif() - -# Boolan Evaluator -include(BoolEval) - -# Default is NETCDF_VERIFIED False -set(NETCDF_VERIFIED False) - -# Locate NETCDF -find_package(NetCDF COMPONENTS C Fortran) - -# Verify the package -if(NETCDF_FOUND) - - message(STATUS "Verify NetCDF package") - - # Version verification - bool_eval(NETCDF_VERSION_OK NOT ${NETCDF_VERSION} VERSION_LESS 4.1.3) - - bool_eval(NETCDF_VERIFIED ${NETCDF_VERSION_OK} AND ${NETCDF_LARGE_DIMS}) - -endif(NETCDF_FOUND) - -# -set(NetCDF_VERIFIED ${NETCDF_VERIFIED}) - -if(NETCDF_VERIFIED) - message(STATUS "Verify NetCDF package -- ok") -else(NETCDF_VERIFIED) - message(STATUS "Verify NetCDF package -- failed") -endif(NETCDF_VERIFIED) - diff --git a/external/patches/exodus-cmake.patch b/external/patches/exodus-cmake.patch deleted file mode 100644 index 3c4c512..0000000 --- a/external/patches/exodus-cmake.patch +++ /dev/null @@ -1,65 +0,0 @@ -diff -ru exodus-6.02.orig/exodus/CMakeLists.txt exodus-6.02/exodus/CMakeLists.txt ---- exodus-6.02.orig/exodus/CMakeLists.txt 2013-12-06 14:47:05.000000000 -0700 -+++ exodus-6.02/exodus/CMakeLists.txt 2014-10-22 09:29:37.548573838 -0600 -@@ -15,7 +15,10 @@ - SET(EXODUS_LIBRARY_TYPE STATIC) - ENDIF(BUILD_SHARED) - --SUBDIRS(cbind forbind) -+ADD_DEFINITIONS(-DNOT_NETCDF4) -+ -+#SUBDIRS(cbind forbind) -+SUBDIRS(cbind) - - find_path( NETCDF_INCLUDE_DIR netcdf.h - $ENV{ACCESS}/inc -@@ -37,26 +40,26 @@ - $ENV{NETCDF_DIR}/ncdump - ) - --# Hack for HDF5 --find_library( HDF5_LIBRARY hdf5 -- $ENV{ACCESS}/lib/shared -- $ENV{ACCESS}/lib -- $ENV{NETCDF_DIR}/lib -- $ENV{NETCDF_DIR}/libsrc/.libs -- /usr/local/hdf5/lib -- ) --find_library( HDF5HL_LIBRARY hdf5_hl -- $ENV{ACCESS}/lib/shared -- $ENV{ACCESS}/lib -- $ENV{NETCDF_DIR}/lib -- $ENV{NETCDF_DIR}/libsrc/.libs -- /usr/local/hdf5/lib -- ) -- --# Check for ZLib, but only if using HDF5. --FIND_PACKAGE(ZLIB) --IF(NOT ZLIB_LIBRARY) -- MESSAGE(FATAL_ERROR "HDF5 Support specified, cannot find ZLib.") --ENDIF() --SET(USE_ZLIB ON) --INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS}) -+## Hack for HDF5 -+#find_library( HDF5_LIBRARY hdf5 -+# $ENV{ACCESS}/lib/shared -+# $ENV{ACCESS}/lib -+# $ENV{NETCDF_DIR}/lib -+# $ENV{NETCDF_DIR}/libsrc/.libs -+# /usr/local/hdf5/lib -+# ) -+#find_library( HDF5HL_LIBRARY hdf5_hl -+# $ENV{ACCESS}/lib/shared -+# $ENV{ACCESS}/lib -+# $ENV{NETCDF_DIR}/lib -+# $ENV{NETCDF_DIR}/libsrc/.libs -+# /usr/local/hdf5/lib -+# ) -+# -+## Check for ZLib, but only if using HDF5. -+#FIND_PACKAGE(ZLIB) -+#IF(NOT ZLIB_LIBRARY) -+# MESSAGE(FATAL_ERROR "HDF5 Support specified, cannot find ZLib.") -+#ENDIF() -+#SET(USE_ZLIB ON) -+#INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS}) diff --git a/external/patches/netcdf-large-model.patch b/external/patches/netcdf-large-model.patch deleted file mode 100644 index b14dd84..0000000 --- a/external/patches/netcdf-large-model.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff -ru netcdf-4.3.1.orig/include/netcdf.h netcdf-4.3.1/include/netcdf.h ---- netcdf-4.3.1.orig/include/netcdf.h 2014-01-16 15:09:24.000000000 -0700 -+++ netcdf-4.3.1/include/netcdf.h 2014-10-22 08:58:26.687510896 -0600 -@@ -225,11 +225,11 @@ - As a rule, NC_MAX_VAR_DIMS <= NC_MAX_DIMS. - */ - /**@{*/ --#define NC_MAX_DIMS 1024 -+#define NC_MAX_DIMS 65536 - #define NC_MAX_ATTRS 8192 --#define NC_MAX_VARS 8192 -+#define NC_MAX_VARS 524288 - #define NC_MAX_NAME 256 --#define NC_MAX_VAR_DIMS 1024 /**< max per variable dimensions */ -+#define NC_MAX_VAR_DIMS 8 /**< max per variable dimensions */ - /**@}*/ - - /** This is the max size of an SD dataset name in HDF4 (from HDF4 documentation).*/ diff --git a/external/patches/netcdf-libtool-nag.patch b/external/patches/netcdf-libtool-nag.patch deleted file mode 100644 index 967fb9c..0000000 --- a/external/patches/netcdf-libtool-nag.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- netcdf-4.1.3.orig/m4/libtool.m4 2011-06-30 17:22:42.000000000 -0600 -+++ netcdf-4.1.3/m4/libtool.m4 2013-07-25 15:04:54.367816135 -0600 -@@ -4739,6 +4739,9 @@ - lf95*) # Lahey Fortran 8.1 - _LT_TAGVAR(whole_archive_flag_spec, $1)= - tmp_sharedflag='--shared' ;; -+ nag*) # NAG 5.3.1 -+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' -+ tmp_sharedflag='-pic -Wl,-shared' ;; - xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; diff --git a/external/tarfiles/exodus-6.02.tar.gz b/external/tarfiles/exodus-6.02.tar.gz deleted file mode 100644 index 77594b8..0000000 Binary files a/external/tarfiles/exodus-6.02.tar.gz and /dev/null differ diff --git a/external/tarfiles/hypre-2.11.1.tar.gz b/external/tarfiles/hypre-2.11.1.tar.gz deleted file mode 100644 index 664e66d..0000000 Binary files a/external/tarfiles/hypre-2.11.1.tar.gz and /dev/null differ diff --git a/external/tarfiles/netcdf-4.3.1.tar.gz b/external/tarfiles/netcdf-4.3.1.tar.gz deleted file mode 100644 index e7889c5..0000000 Binary files a/external/tarfiles/netcdf-4.3.1.tar.gz and /dev/null differ diff --git a/external/tarfiles/yajl-2.0.4.tar.gz b/external/tarfiles/yajl-2.0.4.tar.gz deleted file mode 100644 index 7408a64..0000000 Binary files a/external/tarfiles/yajl-2.0.4.tar.gz and /dev/null differ diff --git a/external/templates/general-command-step.cmake.in b/external/templates/general-command-step.cmake.in deleted file mode 100644 index f28dd58..0000000 --- a/external/templates/general-command-step.cmake.in +++ /dev/null @@ -1,18 +0,0 @@ -# CMake @_ep_name@ @_action@ file - -# Now run the @_action@ script -execute_process( - COMMAND sh @_script@ - RESULT_VARIABLE result - WORKING_DIRECTORY "@_work_dir@" -) - -if (result) - set(msg "@_ep_name@ @_action@ command failed") - foreach(arg IN LISTS command ) - set(msg "${msg} '${arg}'") - endforeach() - message(FATAL_ERROR ${msg}) -endif() - - diff --git a/external/templates/hypre-build-step.sh.in b/external/templates/hypre-build-step.sh.in deleted file mode 100644 index 33c66a6..0000000 --- a/external/templates/hypre-build-step.sh.in +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# CMake generates this file -# Replaces each @VAR@ with value of ${VAR} - -# Ensure a uniform build with the correct compiler -export CFLAGS="@hypre_cflags@" -export LDFLAGS="@hypre_ldflags@" - - -# C Compiler definition requires the -# link and cflags since in somes cases these -# are needed to create libHYPRE.* but -# not passed to the link coomand. -export CC="@CMAKE_C_COMPILER@ ${CFLAGS} ${LDFLAGS}" -export F77="" - -# HYPRE in-source build under src -cd @hypre_source_dir@/src -make all -make_ret=$? -echo "make all returned $make_ret" - -exit $make_ret diff --git a/external/templates/hypre-configure-step.sh.in b/external/templates/hypre-configure-step.sh.in deleted file mode 100644 index cd4e7c9..0000000 --- a/external/templates/hypre-configure-step.sh.in +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# CMake generates this file -# Replaces each @VAR@ with value of ${VAR} - - -# Useful environment variables -export CFLAGS='@hypre_cflags@' -export LDFLAGS='@hypre_ldflags@' - -# C Compiler definition requires the -# link and cflags since in somes cases these -# are needed to create libHYPRE.* but -# not passed to the link coomand. -export CC="@CMAKE_C_COMPILER@ ${CFLAGS} ${LDFLAGS}" -export F77="" - -cd @hypre_source_dir@/src -./configure --prefix=@hypre_install_dir@ \ - --without-fei \ - --disable-fortran \ - @TPL_SHARED_SWITCH@ \ - @hypre_mpi_opt@ \ - @hypre_blas_opt@ \ - @hypre_lapack_opt@ \ - @hypre_debug_opt@ - -exit $? diff --git a/external/templates/hypre-install-step.sh.in b/external/templates/hypre-install-step.sh.in deleted file mode 100644 index 192cdcb..0000000 --- a/external/templates/hypre-install-step.sh.in +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# CMake generates this file -# Replaces each @VAR@ with value of ${VAR} - -# HYPRE recommends running with the make configure target -cd @hypre_source_dir@/src -make install -make_ret=$? -echo "make install returned $make_ret" - -exit $make_ret diff --git a/external/templates/netcdf-patch-step.sh.in b/external/templates/netcdf-patch-step.sh.in deleted file mode 100644 index 5cce372..0000000 --- a/external/templates/netcdf-patch-step.sh.in +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -# CMake generates this file -# Replaces each @VAR@ with value of ${VAR} - -# Change the nc_max_dims, nc_max_vars, and nc_max_var_dim -nc_max_dims=65536 -nc_max_vars=524288 -nc_max_var_dims=8 - -# Search for netcdf.h and netcdf_base.h files -# netcdf_base.h file was removed in version 4.1.3 -header_list=`find @netcdf_source_dir@ -name netcdf.h -or -name netcdf_base.h` - -for header in ${header_list} -do - echo "Patching file ${header}" - @PERL_EXECUTABLE@ -w -i -p -e "s:#define NC_MAX_DIMS[\s]+[\d]+:#define NC_MAX_DIMS ${nc_max_dims}:" $header - @PERL_EXECUTABLE@ -w -i -p -e "s:#define NC_MAX_VARS[\s]+[\d]+:#define NC_MAX_VARS ${nc_max_vars}:" $header - @PERL_EXECUTABLE@ -w -i -p -e "s:#define NC_MAX_VAR_DIMS[\s]+[^\s]+.*:#define NC_MAX_VAR_DIMS ${nc_max_var_dims}:" $header - - #grep NC_MAX_DIMS ${header} - #grep NC_MAX_VARS ${header} - #grep NC_MAX_VAR_DIMS ${header} - -done - -# Fix libtools.m4 so it knows how to deal correctly with nagfor and shared libraries. -patch_file_list=netcdf-libtool-nag.patch -for file in ${patch_file_list} -do - patch -d @netcdf_source_dir@ -p1 < @patch_file_dir@/$file -done diff --git a/petaca/CMakeLists.txt b/petaca/CMakeLists.txt deleted file mode 100644 index 096331f..0000000 --- a/petaca/CMakeLists.txt +++ /dev/null @@ -1,143 +0,0 @@ -# ############################################################################ # -# # -# Petaca (CMake) # -# # -# ############################################################################ # - -# ---------------------------------------------------------------------------- # -# Set policy and CMake version requirements -# ---------------------------------------------------------------------------- # -cmake_minimum_required(VERSION 3.3) - -# ---------------------------------------------------------------------------- # -# Project definitions -# ---------------------------------------------------------------------------- # -project(Petaca Fortran C) - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${Petaca_SOURCE_DIR}/cmake/Modules/") - -# The parameter list stuff requires the yajl library. -# If necessary set YAJL_INCLUDE_DIR and YAJL_LIBRARY_DIR. -find_package(YAJL REQUIRED) -if(YAJL_VERSION VERSION_LESS "2.0.1") - message(FATAL_ERROR "libyajl 2.0.1 or later is required") -endif() - -set(Petaca_INCLUDE_DIR ${Petaca_SOURCE_DIR}/include) - -# ---------------------------------------------------------------------------- # -# Build Options -# ---------------------------------------------------------------------------- # - -option(ENABLE_TESTS "Build test programs" ON) -option(ENABLE_EXAMPLES "Build example programs" OFF) - -#------------------------------------------------------------------------------- -# Compiler Definitions -#------------------------------------------------------------------------------- - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() - -if(CMAKE_Fortran_COMPILER_ID STREQUAL "NAG") - set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -w=uda -DNDEBUG") - set(CMAKE_Fortran_FLAGS_DEBUG "-g90") -elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") - set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -assume realloc_lhs") - set(CMAKE_Fortran_FLAGS_DEBUG "-g -C -assume realloc_lhs") -elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") - set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -ffree-line-length-none") - set(CMAKE_Fortran_FLAGS_DEBUG "-g -fbacktrace -ffree-line-length-none -fcheck=all -Wall -Wextra") -endif() - -# Fortran preprocessor defines -set(Fortran_COMPILE_DEFINITIONS) -if(CMAKE_Fortran_COMPILER_ID MATCHES Intel) - if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "13.1.0") - message(FATAL_ERROR "ERROR: Intel Fortran 13.1.0 or later is required; " - "your version is ${CMAKE_Fortran_COMPILER_VERSION}") - endif() - list(APPEND Fortran_COMPILE_DEFINITIONS INTEL_BUG20140921) - list(APPEND Fortran_COMPILE_DEFINITIONS NO_2008_GENERIC_RESOLUTION) - list(APPEND Fortran_COMPILE_DEFINITIONS NO_2008_LHS_POLY_REALLOC) - if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "16.0.0") - list(APPEND Fortran_COMPILE_DEFINITIONS INTEL_DPD200357656) - endif() - if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "15.0.3") - list(APPEND Fortran_COMPILE_DEFINITIONS INTEL_DPD200357694) - list(APPEND Fortran_COMPILE_DEFINITIONS INTEL_DPD200357693) - list(APPEND Fortran_COMPILE_DEFINITIONS INTEL_CHECK_BUG) - list(APPEND Fortran_COMPILE_DEFINITIONS NO_2008_PTR_FUN_RESULT_IS_VAR) - endif() - if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "15.0.0") - list(APPEND Fortran_COMPILE_DEFINITIONS INTEL_DPD200255963) - list(APPEND Fortran_COMPILE_DEFINITIONS INTEL_DPD200249493) - list(APPEND Fortran_COMPILE_DEFINITIONS INTEL_DPD200237118) - list(APPEND Fortran_COMPILE_DEFINITIONS NO_2008_EXECUTE_COMMAND_LINE) - endif() - if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "14.0.0") - list(APPEND Fortran_COMPILE_DEFINITIONS INTEL_DPD200237219) - list(APPEND Fortran_COMPILE_DEFINITIONS INTEL_DPD200237121) - list(APPEND Fortran_COMPILE_DEFINITIONS INTEL_DPD200242779) - endif() -elseif(CMAKE_Fortran_COMPILER_ID MATCHES NAG) - include(NAGFortranCompilerVersion) # set CMAKE_Fortran_COMPILER_VERSION - if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "5.3.1") - message(FATAL_ERROR "NAG Fortran versions prior to 5.3.1 are not supported; " - "your version is ${CMAKE_Fortran_COMPILER_VERSION}") - endif() - if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "6.0.0") - list(APPEND Fortran_COMPILE_DEFINITIONS NO_2008_SOURCED_ALLOC_ARRAY) - list(APPEND Fortran_COMPILE_DEFINITIONS NO_2008_LHS_POLY_REALLOC) - endif() - if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "5.3.2.990") - list(APPEND Fortran_COMPILE_DEFINITIONS NAG_88538) - list(APPEND Fortran_COMPILE_DEFINITIONS NAG_88549) - endif() -elseif(CMAKE_Fortran_COMPILER_ID MATCHES GNU) - if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "6.0.0") - list(APPEND Fortran_COMPILE_DEFINITIONS NO_2008_SOURCED_ALLOC_ARRAY) - endif() - list(APPEND Fortran_COMPILE_DEFINITIONS NO_2008_GENERIC_RESOLUTION) - list(APPEND Fortran_COMPILE_DEFINITIONS NO_2008_LHS_POLY_REALLOC) - list(APPEND Fortran_COMPILE_DEFINITIONS GNU_67564) - list(APPEND Fortran_COMPILE_DEFINITIONS GNU_61767) - # Eliminate spurious runtime check errors caused by GCC gug PR67505 - set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -fcheck=no-recursion") - # GFortran warning - if(NOT WIN32) - string(ASCII 27 esc) - set(BoldRed "${esc}[1;31m") - set(ResetColor "${esc}[m") - endif() - message(WARNING "${BoldRed}" - "GFortran ${CMAKE_Fortran_COMPILER_VERSION} has incomplete/flawed support of " - "finalization (PR37336), unlimited polymorphic variables (PR67564), and " - "deferred-length character variables (PR68241), which may result in the " - "code not executing properly; see https://gcc.gnu.org/bugzilla/query.cgi." - "${ResetColor}") -endif() - -# Append preprocessor defines to the compiler flags -foreach(def ${Fortran_COMPILE_DEFINITIONS}) - set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -D${def}") -endforeach() -message(STATUS "The Fortran compiler identification is " - "${CMAKE_Fortran_COMPILER_ID} ${CMAKE_Fortran_COMPILER_VERSION}") -message(STATUS "CMAKE_Fortran_FLAGS=${CMAKE_Fortran_FLAGS}") - -#------------------------------------------------------------------------------- -# Installation Definitions -#------------------------------------------------------------------------------- - -add_subdirectory(src) - -if(ENABLE_TESTS) - enable_testing() - add_subdirectory(test) -endif() - -if(ENABLE_EXAMPLES) - add_subdirectory(examples) -endif() diff --git a/petaca/README.pececillo b/petaca/README.pececillo deleted file mode 100644 index 73e0d08..0000000 --- a/petaca/README.pececillo +++ /dev/null @@ -1,2 +0,0 @@ -This is revision c4f48f1 of -git clone http://git.code.sf.net/p/petaca/code petaca-code diff --git a/petaca/cmake/Modules/CMakeFortranCompilerVersion.cmake b/petaca/cmake/Modules/CMakeFortranCompilerVersion.cmake deleted file mode 100644 index e5cfee7..0000000 --- a/petaca/cmake/Modules/CMakeFortranCompilerVersion.cmake +++ /dev/null @@ -1,10 +0,0 @@ -# -# Determine the Fortran compiler version -# -# CMAKE_Fortran_COMPILER_VERSION -- the version string (x.y.z) -# - -if (CMAKE_Fortran_COMPILER_ID MATCHES Intel) - execute_process (COMMAND ${CMAKE_Fortran_COMPILER} --version OUTPUT_VARIABLE CMAKE_Fortran_COMPILER_VERSION) - string (REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" CMAKE_Fortran_COMPILER_VERSION ${CMAKE_Fortran_COMPILER_VERSION}) -endif () diff --git a/petaca/examples/CMakeLists.txt b/petaca/examples/CMakeLists.txt deleted file mode 100644 index ca72463..0000000 --- a/petaca/examples/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -add_subdirectory(map_any_type) -add_subdirectory(parameter_list_type) -add_subdirectory(yajl-fort) -add_subdirectory(timer_tree) diff --git a/petaca/examples/map_any_type/CMakeLists.txt b/petaca/examples/map_any_type/CMakeLists.txt deleted file mode 100644 index 7af8512..0000000 --- a/petaca/examples/map_any_type/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -add_executable (example example.F90) -target_link_libraries(example petaca) - -### Preprocessor defines; mainly compiler bug workarounds. -foreach (def ${Fortran_COMPILE_DEFINITIONS}) - set_property (TARGET example APPEND PROPERTY COMPILE_DEFINITIONS ${def}) -endforeach () diff --git a/petaca/examples/parameter_list_type/CMakeLists.txt b/petaca/examples/parameter_list_type/CMakeLists.txt deleted file mode 100644 index 767ec21..0000000 --- a/petaca/examples/parameter_list_type/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_executable (json_input_example json_input_example.F90) -target_link_libraries(json_input_example petaca) diff --git a/petaca/examples/timer_tree/CMakeLists.txt b/petaca/examples/timer_tree/CMakeLists.txt deleted file mode 100644 index 89aa8cc..0000000 --- a/petaca/examples/timer_tree/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_executable (timer_tree_example timer_tree_example.F90) -target_link_libraries(timer_tree_example petaca) diff --git a/petaca/examples/yajl-fort/CMakeLists.txt b/petaca/examples/yajl-fort/CMakeLists.txt deleted file mode 100644 index 7fe82bc..0000000 --- a/petaca/examples/yajl-fort/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_executable (yajl_fort_parse_example yajl_fort_parse_example.F90) -target_link_libraries(yajl_fort_parse_example petaca) diff --git a/petaca/src/CMakeLists.txt b/petaca/src/CMakeLists.txt deleted file mode 100644 index a52f209..0000000 --- a/petaca/src/CMakeLists.txt +++ /dev/null @@ -1,44 +0,0 @@ -set(Petaca_SOURCE_FILES - f90_assert.F90 - fortran_dynamic_loader.F90 - map_any_type.F90 - yajl_fort.F90 - yajl_ext.c - json.F90 - parameter_entry_class.F90 - parameter_list_type.F90 - parameter_list_json.F90 - state_history_type.F90 - secure_hash/secure_hash_class.F90 - secure_hash/secure_hash_factory.F90 - secure_hash/md5_hash_type.F90 - secure_hash/sha1_hash_type.F90 - timer_tree_type.F90) - -if(CMAKE_Fortran_COMPILER_ID MATCHES GNU) - set_property (SOURCE secure_hash/md5_hash_type.F90 - secure_hash/sha1_hash_type.F90 - PROPERTY COMPILE_FLAGS -fno-range-check) -endif() - -set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod_files/) - -include_directories(${YAJL_INCLUDE_DIR}) # for yajl_ext.c - -add_library(petaca ${Petaca_SOURCE_FILES}) - -target_link_libraries(petaca PUBLIC yajl dl) - -target_include_directories(petaca PUBLIC - $ - $ - $ -) - -install(TARGETS petaca - EXPORT truchas - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib -) - -install(DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} DESTINATION include) diff --git a/petaca/templates/map_template.F90 b/petaca/templates/map_template.F90 deleted file mode 100644 index 44fc8db..0000000 --- a/petaca/templates/map_template.F90 +++ /dev/null @@ -1,375 +0,0 @@ -!! -!! MAP_ANY_TYPE -!! -!! This module defines a map data structure (or associative array) which stores -!! (key, value) pairs as the elements of the structure. The keys are unique and -!! are regarded as mapping (or indexing) to the value associated with the key. -!! In this implementation keys are character strings but the values may be a -!! scalar value of any intrinsic or derived type. An associated iterator data -!! structure is also defined which gives a sequential access to all elements of -!! the map structure. -!! -!! Neil Carlson -!! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! -!! Copyright (c) 2011 Neil N. Carlson -!! -!! Permission is hereby granted, free of charge, to any person obtaining a -!! copy of this software and associated documentation files (the "Software"), -!! to deal in the Software without restriction, including without limitation -!! the rights to use, copy, modify, merge, publish, distribute, sublicense, -!! and/or sell copies of the Software, and to permit persons to whom the -!! Software is furnished to do so, subject to the following conditions: -!! -!! The above copyright notice and this permission notice shall be included -!! in all copies or substantial portions of the Software. -!! -!! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -!! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -!! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -!! THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -!! LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -!! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -!! DEALINGS IN THE SOFTWARE. -!! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! -!! PROGRAMMING INTERFACE -!! -!! The derived types MAP_ANY and MAP_ANY_ITERATOR are defined. -!! * Scalar assignment is defined for both types with the expected semantics. -!! * Finalization is defined for MAP_ANY objects so that when they are -!! deallocated, explicitly or automatically, all allocated data associated -!! with the map is deallocated. -!! * The structure constructor MAP_ANY() evaluates to an empty map. -!! * The structure constructor MAP_ANY_ITERATOR(MAP) evaluates to an iterator -!! positioned at the beginning element of the specified map. -!! The types have the following type-bound procedures. -!! -!! MAP_ANY TYPE-BOUND PROCEDURES -!! -!! INSERT(KEY,VALUE) adds the specified key and associated value to the map. -!! If the mapping already exists, its value is replaced with the specifed one. -!! -!! REMOVE(KEY) removes the specified key from the map and deallocates the -!! associated value. If the mapping does not exist, the map is unchanged. -!! -!! MAPPED(KEY) returns the value .TRUE. if a mapping for the specified key -!! exists; otherwise it returns .FALSE. -!! -!! VALUE(KEY) returns a CLASS(*) pointer to the mapped value for the specified -!! key, or a null pointer if the map does not contain the key. -!! -!! CLEAR() removes all elements from the map, leaving it with a size of 0. -!! -!! EMPTY() returns .TRUE. if the map contains no elements (i.e., has size 0). -!! -!! SIZE() returns the number of elements in the map. -!! -!! MAP_ANY_ITERATOR TYPE-BOUND PROCEDURES -!! -!! NEXT() advances the iterator to the next element in the map. -!! -!! AT_END() returns .TRUE. if the iterator has reached the end; that is, -!! it has gone past the last element of the map. -!! -!! KEY() returns the character string key for the current element. -!! -!! VALUE() returns a CLASS(*) pointer to the value for the current element. -!! -!! A CAUTION ABOUT VALUES. The values contained in a map are copies of the -!! values passed to the INSERT method, but they are shallow copies (or clones) -!! as created by sourced allocation. For intrinsic types these are genuine -!! copies but for derived type values the literal contents of the object are -!! copied. For a pointer component this means that a copy of the pointer is -!! made but not a copy of its target; the original pointer and its copy will -!! have the same target. This also applies to the assignment of maps where -!! the values in the lhs map are sourced-allocation clones of the values in -!! the rhs map. -!! - -module map_any_type - - implicit none - private - - public :: dump - - type :: list_item - character(:), allocatable :: key - class(*), allocatable :: value - type(list_item), pointer :: next => null(), prev => null() - contains - final :: dealloc_list_item - end type list_item - - type, public :: map_any - private - type(list_item), pointer :: first => null() - contains - procedure :: insert - procedure :: remove - procedure :: value - procedure :: mapped - procedure :: size => map_size - procedure :: empty - procedure :: clear - procedure, private :: copy - generic :: assignment(=) => copy - final :: dealloc_map_any - end type map_any - - type, public :: map_any_iterator - class(list_item), pointer, private :: item => null() - contains - procedure :: next => iter_next - procedure :: at_end => iter_at_end - procedure :: key => iter_key - procedure :: value => iter_value - end type map_any_iterator - - !! User-defined MAP_ANY_ITERATOR structure constructor - interface map_any_iterator - procedure map_any_begin - end interface - -contains - - !! Final procedure for MAP_ANY objects. This is recursive because the - !! CLASS(*) values in the map may themselves be MAP_ANY objects or be - !! derived data types having a MAP_ANY component. - recursive subroutine dealloc_map_any (this) - type(map_any), intent(inout) :: this - if (associated(this%first)) deallocate(this%first) - end subroutine dealloc_map_any - - !! Final procedure for LIST_ITEM objects. This recursively follows the - !! NEXT pointer. When deallocating a linked-list structure only the root - !! needs to be explicitly deallocated. When the desire is to deallocate a - !! single LIST_ITEM object, first nullify the NEXT point to prevent the - !! recursive finalization from possibly deallocating more than it should. - recursive subroutine dealloc_list_item (this) - type(list_item), intent(inout) :: this - if (associated(this%next)) deallocate(this%next) - end subroutine dealloc_list_item - - !!!! AUXILLARY ROUTINES !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - !! Returns a pointer to a new initialized (but unlinked) LIST_ITEM. - function new_list_item (key, value) - character(*), intent(in) :: key - class(*), intent(in) :: value - type(list_item), pointer :: new_list_item - allocate(new_list_item) - new_list_item%key = key - allocate(new_list_item%value, source=value) - new_list_item%prev => new_list_item - end function new_list_item - - !! Returns a pointer to the LIST_ITEM having the specified key, - !! or a null pointer of none was found. - function find_list_item (this, key) result (item) - class(map_any), intent(in) :: this - character(*), intent(in) :: key - type(list_item), pointer :: item - item => this%first - do while (associated(item)) - if (item%key == key) exit - item => item%next - end do - end function find_list_item - - !! Blindly links the given LIST_ITEM (as made by NEW_LIST_ITEM) to the end - !! of the list; it does not check that the key is unique (someone else must). - subroutine append_list_item (this, item) - class(map_any), intent(inout) :: this - type(list_item), pointer, intent(in) :: item - type(list_item), pointer :: tail - if (associated(this%first)) then - tail => this%first%prev - tail%next => item - item%prev => tail - this%first%prev => item - else - item%prev => item - this%first => item - end if - end subroutine append_list_item - - !! Creates a (recursive) copy of the (forward) linked-list structure rooted - !! with the given LIST_ITEM object. A pointer to the copy root is returned - !! by the function. All the PREV pointers in the copy are properly defined, - !! including that of the root, which points to the end of the list, and so - !! the result is appropriate as the target of MAP_ANY%FIRST. - recursive function item_copy (item) result (copy) - type(list_item), intent(in) :: item - type(list_item), pointer :: copy - allocate(copy, source=item) - if (associated(item%next)) then - copy%next => item_copy(item%next) - copy%prev => copy%next%prev - copy%next%prev => copy - else - copy%prev => copy - end if - end function item_copy - - !!!! MAP_ANY TYPE-BOUND PROCEDURES !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - !! Returns a CLASS(*) pointer to the mapped value for KEY, - !! or a null pointer if KEY is not mapped. - function value (this, key) - class(map_any), intent(in) :: this - character(*), intent(in) :: key - class(*), pointer :: value - type(list_item), pointer :: item - item => find_list_item(this, key) - if (associated(item)) then - value => item%value - else - value => null() - end if - end function value - - !! Inserts the (KEY, VALUE) pair into the map. If the mapping already - !! exists its value is replaced with the specified value. - subroutine insert (this, key, value) - class(map_any), intent(inout) :: this - character(*), intent(in) :: key - class(*), intent(in) :: value - type(list_item), pointer :: item - item => find_list_item(this, key) - if (associated(item)) then - !! Replace existing value with the given one. - !! F2008 alternative: item%value = value - if (allocated(item%value)) deallocate(item%value) - allocate(item%value, source=value) - else - call append_list_item(this, new_list_item(key, value)) - end if - end subroutine insert - - !! Removes KEY from the map and deallocates the mapped value. - !! If the mapping does not exist the map is unchanged. - subroutine remove (this, key) - class(map_any), intent(inout) :: this - character(*), intent(in) :: key - type(list_item), pointer :: item - item => find_list_item(this, key) - if (associated(item)) then - if (associated(item%prev, item)) then ! single item list - this%first => null() - else if (associated(this%first, item)) then ! first item of multiple - this%first => item%next - item%next%prev => item%prev - else if (.not.associated(item%next)) then ! last item of multiple - item%prev%next => item%next - this%first%prev => item%prev - else ! interior item of multiple - item%prev%next => item%next - item%next%prev => item%prev - end if - item%next => null() ! stop recursive finalization when item is deallocated - deallocate(item) - end if - end subroutine remove - - !! All elements of the map are removed, leaving it with a size of 0. - subroutine clear (this) - class(map_any), intent(inout) :: this - if (associated(this%first)) deallocate(this%first) - end subroutine clear - - !! Returns true if a mapping for KEY exists; otherwise returns false. - logical function mapped (this, key) - class(map_any), intent(in) :: this - character(*), intent(in) :: key - mapped = associated(find_list_item(this, key)) - end function mapped - - !! Returns true if the map contains no elements (size is 0). - logical function empty (this) - class(map_any), intent(in) :: this - empty = .not.associated(this%first) - end function empty - - !! Returns the number of elements in the map. - integer function map_size (this) - class(map_any), intent(in) :: this - type(list_item), pointer :: item - map_size = 0 - item => this%first - do while (associated(item)) - map_size = map_size + 1 - item => item%next - end do - end function map_size - - !! Defined assignment operator for MAP_ANY objects. - recursive subroutine copy (lmap, rmap) - class(map_any), intent(inout) :: lmap ! inout in case lmap is rmap - class(map_any), intent(in) :: rmap - if (associated(rmap%first,lmap%first)) return ! lmap and rmap are the same - if (associated(lmap%first)) deallocate(lmap%first) - if (associated(rmap%first)) lmap%first => item_copy(rmap%first) - end subroutine copy - - !!!! MAP_ANY_ITERATOR TYPE-BOUND PROCEDURES !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - !! Defined MAP_ANY_ITERATOR constructor that is positioned - !! to the beginning element of the specified MAP_ANY map. - function map_any_begin (map) result (iter) - class(map_any), intent(in) :: map - type(map_any_iterator) :: iter - iter%item => map%first - end function map_any_begin - - !! Advances the iterator to the next element in the map. - subroutine iter_next (this) - class(map_any_iterator), intent(inout) :: this - if(associated(this%item)) this%item => this%item%next - end subroutine iter_next - - !! Returns true if the iterator has reached the end; that is, it has - !! gone past the last element of the map. - pure logical function iter_at_end (this) - class(map_any_iterator), intent(in) :: this - iter_at_end = .not.associated(this%item) - end function iter_at_end - - !! Returns the key for the current element. - function iter_key (this) - class(map_any_iterator), intent(in) :: this - character(:), allocatable :: iter_key - iter_key = this%item%key - end function iter_key - - !! Returns a CLASS(*) pointer to the value of the current element. - function iter_value (this) - class(map_any_iterator), intent(in) :: this - class(*), pointer :: iter_value - iter_value => this%item%value - end function iter_value - - subroutine dump (this) - type(map_any), intent(in) :: this - type(list_item), pointer :: item, last, tail - item => this%first - if (associated(item)) then - write(*,'(a)',advance='no') trim(item%key) - tail => item%prev - last => item - item => item%next - do while (associated(item)) - if (.not.associated(last,item%prev)) write(*,'(1x,a)',advance='no') 'X<' - write(*,'(1x,a)',advance='no') trim(item%key) - last => item - item => item%next - end do - if (.not.associated(last,tail)) write(*,'(1x,a)',advance='no') 'XT' - write(*,*) - end if - end subroutine - -end module map_any_type diff --git a/petaca/test/CMakeLists.txt b/petaca/test/CMakeLists.txt deleted file mode 100644 index bac3264..0000000 --- a/petaca/test/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -add_subdirectory(fortran_dynamic_loader) -add_subdirectory(map_any_type) -add_subdirectory(parameter_list_type) -add_subdirectory(state_history_type) -add_subdirectory(secure_hash) -add_subdirectory(timer_tree) diff --git a/petaca/test/fortran_dynamic_loader/CMakeLists.txt b/petaca/test/fortran_dynamic_loader/CMakeLists.txt deleted file mode 100644 index 42976b2..0000000 --- a/petaca/test/fortran_dynamic_loader/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -add_executable (test_fortran_dynamic_loader test_fortran_dynamic_loader.F90) -target_link_libraries(test_fortran_dynamic_loader petaca) -add_test(fortran_dynamic_loader test_fortran_dynamic_loader) - -# Shared library loaded by the test. -add_library(mylib SHARED mylib.F90) diff --git a/petaca/test/map_any_type/CMakeLists.txt b/petaca/test/map_any_type/CMakeLists.txt deleted file mode 100644 index dcaa94a..0000000 --- a/petaca/test/map_any_type/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_executable (test_map_any_type test_map_any_type.F90) -target_link_libraries(test_map_any_type petaca) -add_test(map_any test_map_any_type) diff --git a/petaca/test/parameter_list_type/CMakeLists.txt b/petaca/test/parameter_list_type/CMakeLists.txt deleted file mode 100644 index cf34116..0000000 --- a/petaca/test/parameter_list_type/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -add_executable (test_any_scalar_type test_any_scalar_type.F90) -target_link_libraries(test_any_scalar_type petaca) -add_test(any_scalar test_any_scalar_type) - -add_executable (test_any_vector_type test_any_vector_type.F90) -target_link_libraries(test_any_vector_type petaca) -add_test(any_vector test_any_vector_type) - -add_executable (test_any_matrix_type test_any_matrix_type.F90) -target_link_libraries(test_any_matrix_type petaca) -add_test(any_matrix test_any_matrix_type) - -add_executable (test_parameter_list_type test_parameter_list_type.F90) -target_link_libraries(test_parameter_list_type petaca) -add_test(parameter_list test_parameter_list_type) diff --git a/petaca/test/secure_hash/CMakeLists.txt b/petaca/test/secure_hash/CMakeLists.txt deleted file mode 100644 index 2953492..0000000 --- a/petaca/test/secure_hash/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -add_executable (test_secure_hash test_secure_hash.F90) -target_link_libraries(test_secure_hash petaca) -add_test(secure_hash test_secure_hash) - -#add_executable (time_hash time_hash.F90) -#target_link_libraries(time_hash petaca) - -### Preprocessor defines; mainly compiler bug workarounds. -foreach (def ${Fortran_COMPILE_DEFINITIONS}) - set_property (TARGET test_secure_hash APPEND PROPERTY COMPILE_DEFINITIONS ${def}) -endforeach () diff --git a/petaca/test/state_history_type/CMakeLists.txt b/petaca/test/state_history_type/CMakeLists.txt deleted file mode 100644 index dfa016f..0000000 --- a/petaca/test/state_history_type/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_executable (test_state_history_type test_state_history_type.F90) -target_link_libraries(test_state_history_type petaca) -add_test(state_history test_state_history_type) diff --git a/petaca/test/timer_tree/CMakeLists.txt b/petaca/test/timer_tree/CMakeLists.txt deleted file mode 100644 index 53246d8..0000000 --- a/petaca/test/timer_tree/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_executable (test_timer_tree test_timer_tree.F90) -target_link_libraries(test_timer_tree petaca) -add_test(timer_tree test_timer_tree) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3e6c123..954ad79 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,13 +1,5 @@ -# This is the core Pececillo library. -add_subdirectory(lib) +add_subdirectory(petaca) # the petaca library +add_subdirectory(lib) # core pececillo library +add_subdirectory(unit) # unit tests -# This is the basic heat conduction solver. -add_subdirectory(hc) - -# This is the basic flow solver. -add_subdirectory(flow) - -# A unit test executable -add_subdirectory(unit) - -install(DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} DESTINATION include) +#install(DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} DESTINATION include) diff --git a/src/flow/CMakeLists.txt b/src/flow/CMakeLists.txt deleted file mode 100644 index 8df8fbe..0000000 --- a/src/flow/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -project(Pececillo-flow) - -include_directories(${Pececillo_SOURCE_DIR}/src/lib) -include_directories(${Pececillo_MODULE_DIR} ${Petaca_MODULE_DIR}) - -set(SOURCE_FILES - NS_solver_type.F90 - flow_sim_type.F90) - -# Create a library (so we can unit test) -add_library(libpececillo-flow ${SOURCE_FILES}) -target_link_libraries(libpececillo-flow pececillo) - -# Add Support for OpenMP. This needs to be present in the CMakeFile -# that controls linking of the final executable. -# find_package(OpenMP) -# if (OPENMP_FOUND) -# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") -# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") -# set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_C_FLAGS}") -# endif() - - -# HC driver -add_executable(pececillo-flow flow_main.F90) -target_link_libraries(pececillo-flow libpececillo-flow) - -#add_subdirectory(test) - -install(TARGETS pececillo-flow DESTINATION lib) -install(TARGETS pececillo-flow DESTINATION bin) diff --git a/src/flow/NS_solver_type.F90 b/src/flow/NS_solver_type.F90 deleted file mode 100644 index bf1c308..0000000 --- a/src/flow/NS_solver_type.F90 +++ /dev/null @@ -1,490 +0,0 @@ -!! -!! FLOW_SOLVER_TYPE -!! -!! This module defines a class that encapsulates a (time) solver for the -!! Navier-Stokes equations. -!! -!! TODO: * Figure out what the prepass is and how to do it. Basically, on the first cycle -!! Truchas executes -!! use projection_data_module, only: mac_projection_iterations, prelim_projection_iterations -!! use viscous_data_module, only: prelim_viscous_iterations, viscous_iterations -!! if (cycle_number == 0) then -!! ! Special operations required during the prepass -!! prelim_projection_iterations = mac_projection_iterations !or 0 if all solid -!! prelim_viscous_iterations = viscous_iterations !or 0 if all solid -!! velocity_cc = velocity_cc_n -!! end if -!! -!! Zechariah J. Jibben -!! June 2015 -!! - -#include "f90_assert.fpp" -!#define DEBUG - -module NS_solver_type - - use kinds, only: r8 - use parameter_list_type - use unstr_mesh_type - use mesh_geom_type - use matl_props_type - use logging_services - use bndry_func_class - use scalar_func_class - use projection_module - use predictor_module - implicit none - private - - type, public :: NS_solver - private - - type(unstr_mesh), pointer :: mesh => null() ! reference only -- do not own - type(mesh_geom), pointer :: gmesh => null() ! reference only -- do not own - type(matl_props), pointer :: mprop => null() ! reference only -- do not own - - real(r8), pointer :: vof(:,:) => null() ! reference only -- do not own - real(r8), pointer :: volume_flux(:,:,:) => null() ! reference only -- do not own - - !! Pending/current state - type(projection_solver) :: projection - type(predictor_solver) :: predictor - real(r8) :: t, dt - type(parameter_list), pointer :: projection_solver_params => null(), & - prediction_solver_params => null() - - real(r8), public, allocatable :: velocity_cc(:,:), pressure_cc(:), fluxing_velocity(:,:), & - fluidRho(:) - real(r8), allocatable :: gradP_dynamic_over_rho_cc(:,:), fluidVof(:), body_force(:) - real(r8) :: viscous_implicitness, CFL_multiplier, max_dt - class(bndry_func), public, allocatable :: pressure_bc, velocity_bc - class(scalar_func), allocatable :: pressure_init - logical :: boussinesq_approximation, inviscid - logical, public :: use_prescribed_velocity - integer, public :: prescribed_velocity_case - contains - procedure :: init - procedure :: init_matls - procedure :: init_mprop - procedure :: set_initial_state - procedure :: timestep_size - procedure :: step - procedure, private :: update_prescribed_velocity - procedure, private :: fluid_to_move - procedure, private :: fluid_properties - end type NS_solver - -contains - - subroutine init (this, mesh, gmesh, params) - - use consts, only: ndim,nfc - use bc_factory_type - use scalar_func_factories - use parameter_list_type ! intel 15 needs this here, seems like it might be a bug - - class(NS_solver), intent(out) :: this - type(unstr_mesh), intent(in), target :: mesh - type(mesh_geom), intent(in), target :: gmesh - type(parameter_list) :: params - - type(parameter_list), pointer :: plist, func_params - character(:), allocatable :: context,errmsg - integer :: stat - type(bc_factory) :: bcfact - - this%mesh => mesh - this%gmesh => gmesh - allocate(this%velocity_cc(ndim,this%mesh%ncell), this%pressure_cc(this%mesh%ncell), & - this%fluidRho(this%mesh%ncell), this%fluidVof(this%mesh%ncell), & - this%gradP_dynamic_over_rho_cc(ndim,this%mesh%ncell), & - this%fluxing_velocity(nfc,this%mesh%ncell)) - - context = 'processing ' // params%name() // ': ' - - !! get the CFL multiplier - !! tells the timestep to be a certain factor smaller than the actual restriction - if (params%is_scalar('cfl-multiplier')) then - call params%get ('cfl-multiplier', this%CFL_multiplier, stat=stat, errmsg=errmsg) - else - call LS_fatal (context//'missing "cfl-multiplier" sublist parameter') - end if - - !! get the maximum allowed timestep - !! if the the flow is currently 0, we don't want an infinite timestep size, now do we? - if (params%is_scalar('max-dt')) then - call params%get ('max-dt', this%max_dt, stat=stat, errmsg=errmsg) - else - call LS_fatal (context//'missing "max-dt" sublist parameter') - end if - - !! check for prescribed velocity case - this%use_prescribed_velocity = params%is_scalar('prescribed-velocity') - if (this%use_prescribed_velocity) then - call params%get ('prescribed-velocity', this%prescribed_velocity_case, stat=stat, & - errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - - this%projection_solver_params => null() - this%prediction_solver_params => null() - return - end if - - !! for now, ignore buoyancy - this%boussinesq_approximation = .false. - - !! check for a body force - if (params%is_vector('body-force')) then - call params%get ('body-force', this%body_force, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - else - allocate(this%body_force(ndim)) - this%body_force = 0.0_r8 - end if - - !! store the projection solver's hypre parameters - if (params%is_sublist('projection-solver')) then - this%projection_solver_params => params%sublist('projection-solver') - else - call LS_fatal (context//'missing "projection-solver" sublist parameter') - end if - - if (params%is_sublist('prediction-solver')) then - this%prediction_solver_params => params%sublist('prediction-solver') - if (this%prediction_solver_params%is_scalar('viscous-implicitness')) then - call this%prediction_solver_params%get ('viscous-implicitness', this%viscous_implicitness, & - stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - else - this%viscous_implicitness = 0.0_r8 - end if - else - call LS_fatal (context//'missing "projection-solver" sublist parameter') - end if - - !! initialize boundary conditions - if (params%is_sublist('bc')) then - call bcfact%init (this%mesh, params%sublist('bc')) - call bcfact%alloc_bc ('dirichlet-pressure', this%pressure_bc) - call bcfact%alloc_bc ('dirichlet-velocity', this%velocity_bc) - else - call LS_fatal (context//'missing "bc" sublist parameter') - end if - - !! initialize initial condition functions - if (params%is_sublist('initial-condition')) then - plist => params%sublist('initial-condition') - - if (.not.plist%is_sublist('pressure')) call LS_fatal (context//'missing "initial-condition/pressure" sublist parameter') - - func_params => plist%sublist('pressure') - call alloc_scalar_func (this%pressure_init, func_params) - else - call LS_fatal (context//'missing "initial-condition" sublist parameter') - end if - - end subroutine init - - ! point vof-related quantities to the arrays owned by the vof solver - subroutine init_matls (this, vof, volume_flux) - - class(NS_solver), intent(inout) :: this - real(r8), target, intent(in) :: vof(:,:), volume_flux(:,:,:) - - this%vof => vof - this%volume_flux => volume_flux - - end subroutine init_matls - - subroutine init_mprop (this, mprop) - - class(NS_solver), intent(inout) :: this - type(matl_props), target :: mprop - - this%mprop => mprop - this%inviscid = all(mprop%viscosity == 0.0_r8) - - end subroutine init_mprop - - ! initialize state variables - subroutine set_initial_state (this) - - class(NS_solver), intent(inout) :: this - - integer :: i - - ! set initial time - this%t = 0.0_r8 - - ! TODO: * set initial values based on user input, especially fluidRho and fluidVof - ! * maybe thread this? - - if (this%use_prescribed_velocity) then - call this%update_prescribed_velocity () - - this%fluidRho = 1.0_r8 - else - this%velocity_cc = 0.0_r8 - this%fluxing_velocity = 0.0_r8 - - write(*,*) 'WARNING: hard-coded initial condition (gradp)' - do i = 1,this%mesh%ncell - this%fluidVof(i) = sum(this%vof(:,i), mask=.not.this%mprop%is_immobile) - - ! TODO: modify fluidRho with fluidDeltaRho, if following the Boussinesq approximation - this%fluidRho(i) = sum(this%vof(:,i)*this%mprop%density, mask=.not.this%mprop%is_immobile) & - / merge(this%fluidVof(i), 1.0_r8, this%fluidVof(i) > 0.0_r8) - - - this%pressure_cc(i) = this%pressure_init%eval(this%gmesh%xc(:,i)) - this%gradP_dynamic_over_rho_cc(:,i) = 0.0_r8 ![0.0_r8, -0.25_r8, 0.0_r8] / this%fluidRho(i) - end do - end if - - if (associated(this%projection_solver_params)) then - call this%projection%init (this%mesh, this%gmesh, this%projection_solver_params) - else - call this%projection%init (this%mesh, this%gmesh) - end if - if (associated(this%prediction_solver_params)) then - call this%predictor%init (this%mesh, this%gmesh, this%prediction_solver_params) - else - call this%predictor%init (this%mesh, this%gmesh) - end if - - end subroutine set_initial_state - - ! sets the velocity to a prescribed value across the entire domain - subroutine update_prescribed_velocity (this) - - use consts, only: nfc - use prescribed_velocity_fields, only: prescribed_velocity - - class(NS_solver), intent(inout) :: this - - integer :: i,f - - !$omp parallel do private(f) - do i = 1,this%mesh%ncell - this%velocity_cc(:,i) = prescribed_velocity (this%gmesh%xc(:,i), this%t, & - this%prescribed_velocity_case) - - do f = 1,nfc - this%fluxing_velocity(f,i) = dot_product( & - prescribed_velocity (this%gmesh%fc(:,this%mesh%cface(f,i)), this%t, & - this%prescribed_velocity_case), & - this%gmesh%outnorm(:,f,i)) - end do - end do - !$omp end parallel do - - end subroutine update_prescribed_velocity - - ! Navier-Stokes (NS) driver: increment NS equations by one time step. - ! TODO: figure out a smarter way of sending the hypre_hybrid parameters down the pipeline - subroutine step (this, dt, t) - - use consts, only: ndim - use timer_tree_type - - class(NS_solver), intent(inout) :: this - real(r8), intent(in) :: dt, t - - real(r8) :: fluidRho_n(this%mesh%ncell), fluidVof_n(this%mesh%ncell), rho(this%mesh%ncell), & - velocity_cc_n(ndim,this%mesh%ncell), min_fluidRho - logical :: solid_face(this%mesh%nface), is_pure_immobile(this%mesh%ncell) - - call start_timer ('navier stokes update') - - this%t = t - - ! check if we are using a prescribed velocity - if (this%use_prescribed_velocity) then - call this%update_prescribed_velocity () - else - call this%velocity_bc%compute (this%t) - call this%pressure_bc%compute (this%t) - - ! evaluate cell properties excluding immobile materials, and - ! check that there are at least some flow equations to solve - call this%fluid_properties (rho, fluidRho_n, fluidVof_n, velocity_cc_n, min_fluidRho, & - solid_face, is_pure_immobile) - - ! step the incompressible Navier-Stokes equations - if (this%fluid_to_move(is_pure_immobile, solid_face)) then - call this%predictor%solve (this%velocity_cc, this%gradP_dynamic_over_rho_cc, dt, & - this%volume_flux, this%fluidRho, fluidRho_n, this%vof, this%fluidVof, fluidVof_n, & - velocity_cc_n, this%fluxing_velocity, this%viscous_implicitness, this%inviscid, & - solid_face, is_pure_immobile, this%mprop, this%velocity_bc) - call this%projection%solve (this%velocity_cc, this%pressure_cc, & - this%gradP_dynamic_over_rho_cc, this%fluxing_velocity, dt, this%fluidRho, fluidRho_n, & - min_fluidRho, this%fluidVof, this%vof, this%body_force, solid_face, is_pure_immobile, & - this%mprop, this%velocity_bc, this%pressure_bc) - else ! Everything solid; set velocities to zero and check again in the next timestep. - this%fluxing_velocity = 0.0_r8 - this%velocity_cc = 0.0_r8 - end if - end if - - this%t = t+dt - - !write(*,*) 'maxfvel', maxval(this%fluxing_velocity) - !write(*,*) 'minmaxvel', minval(this%velocity_cc(2,:)), maxval(this%velocity_cc(2,:)) - - call stop_timer ('navier stokes update') - - end subroutine step - - ! calculate fluid properties such as various density quantities, - ! whether cells are immobile, whether faces are solid, - ! and zero out velocities on immobile cells and solid faces - subroutine fluid_properties (this, cellRho, fluidRho_n, fluidVof_n, velocity_cc_n, & - min_fluidRho, solid_face, is_pure_immobile) - - use consts, only: nfc, cutvof, fluid_cutoff - - class(NS_solver), intent(inout) :: this - real(r8), intent(out) :: cellRho(:), fluidRho_n(:), fluidVof_n(:), & - velocity_cc_n(:,:), min_fluidRho - logical, intent(out) :: solid_face(:), is_pure_immobile(:) - - real(r8) :: real_fluidVof(size(fluidVof_n)) - integer :: i, f - - do i = 1,this%mesh%ncell - ! save previous timestep values - fluidRho_n(i) = this%fluidRho(i) - fluidVof_n(i) = this%fluidVof(i) - - ! update current/next timestep values from the recent interface advection update - cellRho(i) = sum(this%vof(:,i)*this%mprop%density) ! TODO: is this used anywhere? - - this%fluidVof(i) = sum(this%vof(:,i), mask=.not.this%mprop%is_immobile) - - ! TODO: modify fluidRho with fluidDeltaRho, if following the Boussinesq approximation - this%fluidRho(i) = sum(this%vof(:,i)*this%mprop%density, mask=.not.this%mprop%is_immobile) & - / merge(this%fluidVof(i), 1.0_r8, this%fluidVof(i) > 0.0_r8) - - ! vof of mobile and non-void materials - real_fluidVof(i) = sum(this%vof(:,i), & - mask=.not.this%mprop%is_immobile .and. .not.this%mprop%is_void) - - ! cutRho(i) = sum(cutVof*this%mprop%density, & - ! mask=.not.this%mprop%is_immobile .and. .not.this%mprop%is_void .and. this%vof(:,i)>0.0_r8) - - is_pure_immobile(i) = this%fluidVof(i) < fluid_cutoff !& - ! ! subroutine turn_off_flow - ! .or. .not.any(this%gmesh%xc(:,i) < region(:)%x1(:) .or. this%gmesh%xc(:,i) > region(:)%x2(:)) - - ! zero out velocities in cells which have completely - ! solidified between the last flow call and this one - ! TODO: don't modify velocity here--enforce this condition in projection where it is set - if (is_pure_immobile(i) .or. this%fluidRho(i) == 0.0_r8) this%velocity_cc(:,i) = 0.0_r8 - - ! save previous timestep velocity - velocity_cc_n(:,i) = this%velocity_cc(:,i) - end do - - min_fluidRho = minval(this%fluidRho*this%fluidVof/real_FluidVof, mask=real_FluidVof > 0.0_r8) - - ! a solid face is one where either connected cell is pure immobile - do f = 1,this%mesh%nface - solid_face(f) = is_pure_immobile(this%gmesh%fcell(1,f)) - if (this%gmesh%fcell(2,f) > 0) & - solid_face(f) = solid_face(f) .or. is_pure_immobile(this%gmesh%fcell(2,f)) - end do - - ! with some way to grab the local face id of a face given its global id, - ! this could be merged into the above face loop - ! for it to work in parallel, would also need to be sure threads are not - ! trying to write to a cell simultaneously - ! could also make fluxing_velocity a 1D array over faces, but that is much more work - ! TODO: don't modify fluxing_velocity here - do i = 1,this%mesh%ncell - do f = 1,nfc - if (solid_face(this%mesh%cface(f,i))) this%fluxing_velocity(f,i) = 0.0_r8 - end do - end do - - end subroutine fluid_properties - - ! decide whether or not fluid flow is needed for this step - logical function fluid_to_move (this, is_pure_immobile, solid_face) - - use consts, only: nfc - - class(NS_solver), intent(in) :: this - logical, intent(in) :: is_pure_immobile(:), solid_face(:) - - integer :: i, f - - ! check if we can skip flow in this timestep - ! we can skip the flow if there is no inflow of real fluid - ! and there is no flow within the mesh - - fluid_to_move = .false. - do i = 1,this%mesh%ncell - if (is_pure_immobile(i)) cycle - - ! check if there is any flow inside the mesh - do f = 1,nfc - fluid_to_move = .not.solid_face(f) .and. this%gmesh%cneighbor(f,i) > 0 - - ! if we have found any fluid motion, we don't need to check the rest of the mesh - if (fluid_to_move) return - end do - end do - - ! TODO: check boundaries - ! if (boundary_cond(f)==DIRICHLET_PRESSURE) then - ! if (BC_mat(f) /= NULL_I) fluid_to_move = material_density(BC_mat(f)) > 0.0_r8 - ! else if (boundary_cond(f)==DIRICHLET_VELOCITY) then - ! ! unfortunately, can't check both these if statements at once - ! ! because fortran doesn't short-circuit, which can lead to segfaults - ! if (BC_mat(f) /= NULL_I) & - ! if (material_density(BC_mat(f)) > 0.0_r8) & - ! fluid_to_move = dot_product(BC_vel(:,f), gmesh%outnorm(:,f,c)) < 0.0_r8 - ! end if - - end function fluid_to_move - - real(r8) function timestep_size (this, remaining_dt) - - use array_utils, only: isZero - - class(NS_solver), intent(in) :: this - real(r8), intent(in) :: remaining_dt ! the remaining time left for this flow_sim step - - integer :: i - real(r8) :: tmp, dx - - timestep_size = huge(1.0_r8) - do i = 1,this%mesh%ncell - ! TODO: get the smallest cell spacing more intelligently - ! this will cause problems with very skewed cells - dx = this%mesh%volume(i)**(1.0_r8/3.0_r8) - - ! advection - tmp = max(maxval(this%fluxing_velocity(:,i)), 0.0_r8) - if (tmp>0.0_r8) timestep_size = min(timestep_size, this%CFL_multiplier* dx / tmp) - - ! if we are doing mostly-explicit viscous flow, reduce the step size as necessary - if (.not.this%use_prescribed_velocity .and. .not.this%inviscid & - .and. this%viscous_implicitness < 0.5_r8) then - tmp = viscosityCell(this%mprop, this%vof(:,i), this%fluidVof(i)) - if (tmp>0.0_r8) timestep_size = min(timestep_size, this%CFL_multiplier * dx**2 / tmp) - end if - end do - - ! ensure the timestep size is not larger than the remaining time in this cycle - ! or the requested maximum timestep size - timestep_size = min(timestep_size, remaining_dt, this%max_dt) - - ! if the timestep is *almost* enough to finish this cycle, set it to the remaining time - ! this avoids extremely small (near machine zero) timesteps in the next iteration - if (isZero(timestep_size - remaining_dt)) timestep_size = remaining_dt - - end function timestep_size - -end module NS_solver_type diff --git a/src/flow/flow_main.F90 b/src/flow/flow_main.F90 deleted file mode 100644 index a22f957..0000000 --- a/src/flow/flow_main.F90 +++ /dev/null @@ -1,69 +0,0 @@ -!! -!! FLOW_MAIN -!! -!! A Basic driver for the flow model. -!! -!! Zechariah J. Jibben (zjibben@lanl.gov) -!! June 2015 -!! - -#include "f90_assert.fpp" - -program flow_main - - use,intrinsic :: iso_fortran_env, only: output_unit, error_unit - use,intrinsic :: iso_c_binding, only: C_NEW_LINE - use logging_services - use timer_tree_type - use parameter_list_type - use parameter_list_json - use flow_sim_type - implicit none - - integer :: n, num_arg, inlun, stat - character(256) :: arg - character(:), allocatable :: prog, infile, errmsg - type(parameter_list), pointer :: params - type(flow_sim) :: sim - - !! Get the program name from the command line. - call get_command (arg) - n = scan(arg, '/', back=.true.) - prog = trim(arg(n+1:)) ! remove the leading path component, if any - - !! Get the input file name from the command line. - num_arg = command_argument_count() - if (num_arg == 1) then - call get_command_argument (1, arg) - infile = trim(arg) - else - write(error_unit,'(a)') 'usage: ' // prog // ' INFILE' - stop - end if - - !! Initialize the logging service routines; output goes to stdout. - call LS_initialize ([output_unit]) !, LS_VERB_NOISY) - - !! Read the parameter list from the input file. - open(newunit=inlun,file=infile,action='read',access='stream') - call parameter_list_from_json_stream (inlun, params, errmsg) - if (.not.associated(params)) call LS_fatal ("error reading input file:" // C_NEW_LINE // errmsg) - close(inlun) - - !! Set up the simulation and run it. - !call set_timer_type (realtime_timing) - call start_timer ('simulation') - call sim%init (params) - call sim%run (stat, errmsg) - if (stat /= 0) call LS_fatal ('FLOW_SIM: '//errmsg) - call stop_timer ('simulation') - - !! Write some timing info. - call LS_info (C_NEW_LINE//'Timing Summary:'//C_NEW_LINE) - call write_timer_tree (output_unit, indent=3) - - !! And quit. - call LS_info ('') - call LS_exit - -end program flow_main diff --git a/src/flow/flow_sim_type.F90 b/src/flow/flow_sim_type.F90 deleted file mode 100644 index 127c219..0000000 --- a/src/flow/flow_sim_type.F90 +++ /dev/null @@ -1,338 +0,0 @@ -!! -!! FLOW_SIM_TYPE -!! -!! This module defines a class that encapsulates a flow simulation. -!! This drives the time integration and generates the output; it is very basic. -!! -!! Zechariah J. Jibben -!! June 2015 -!! - -#include "f90_assert.fpp" - -module flow_sim_type - - use kinds, only: r8 - use unstr_mesh_type - use mesh_geom_type - use matl_props_type - use NS_solver_type - use vof_solver_type - use logging_services - use timer_tree_type - implicit none - private - - type, public :: flow_sim - type(unstr_mesh), pointer :: mesh => null() - type(mesh_geom), pointer :: gmesh => null() - type(NS_solver), pointer :: ns_solver => null() - type(vof_solver), pointer :: vof_solver => null() - type(matl_props), pointer :: mprop => null() - - !! Integration control - real(r8) :: dt_init - real(r8) :: dt_min - real(r8), allocatable :: tout(:) - !! - integer :: nfile = 0 ! output file counter - logical :: dump_intrec - contains - procedure :: init - procedure :: run - procedure, private :: step - procedure, private :: write_solution - final :: flow_sim_delete - end type flow_sim - -contains - - !! Final subroutine for HC_SIM objects. - subroutine flow_sim_delete (this) - type(flow_sim), intent(inout) :: this - if (associated(this%mesh)) deallocate(this%mesh) - if (associated(this%gmesh)) deallocate(this%gmesh) - if (associated(this%ns_solver)) deallocate(this%ns_solver) - if (associated(this%vof_solver)) deallocate(this%vof_solver) - end subroutine flow_sim_delete - - subroutine init (this, params) - - use parameter_list_type - use unstr_mesh_factory - use unstr_mesh_func - use vof_init -#ifdef _OPENMP - use omp_lib, only: omp_get_max_threads -#endif - - class(flow_sim), intent(out) :: this - type(parameter_list) :: params - - integer :: stat - type(parameter_list), pointer :: plist - character(:), allocatable :: errmsg, context - integer, allocatable :: tmp(:) - real(r8) :: t_init - - call start_timer ('initialization') - call LS_info ('Initializing the simulation', LS_VERB_NOISY) - - !! Create the mesh and discretization object. - write(*,*) 'initializing mesh...' - call start_timer ('mesh') - if (params%is_sublist('mesh')) then - plist => params%sublist('mesh') - this%mesh => new_unstr_mesh(plist) - else - call LS_fatal ('missing "mesh" sublist parameter') - end if - allocate(this%gmesh) - call this%gmesh%init (this%mesh) - call stop_timer ('mesh') - - !! Create the navier stokes solver. - write(*,*) 'initializing Navier-Stokes solver...' - call start_timer ('ns-solver') - if (params%is_sublist('ns-solver')) then - plist => params%sublist('ns-solver') - allocate(this%ns_solver) - call this%ns_solver%init (this%mesh, this%gmesh, plist) - else - call LS_fatal ('missing "ns-solver" sublist parameter') - end if - call stop_timer ('ns-solver') - - !! Load material properties - write(*,*) 'Reading material properties...' - if (params%is_sublist('material-properties')) then - plist => params%sublist('material-properties') - allocate(this%mprop) - call this%mprop%init (plist) - call this%ns_solver%init_mprop (this%mprop) - else if (this%ns_solver%use_prescribed_velocity) then - allocate(this%mprop) - ! get the number of materials from the material id array - if (params%is_sublist('vof-solver')) then - plist => params%sublist('vof-solver') - call plist%get ('materials', tmp, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - ! set all materials to non-void - allocate(this%mprop%is_void(size(tmp))) - this%mprop%is_void = .false. - else - call LS_fatal ('missing "vof-solver" sublist parameter') - end if - else - call LS_fatal ('missing "material-properties" sublist parameter') - end if - - !! Create the volume of fluid solver. - write(*,*) 'initializing vof solver...' - call start_timer ('vof-solver') - if (params%is_sublist('vof-solver')) then - plist => params%sublist('vof-solver') - allocate(this%vof_solver) - call this%vof_solver%init (this%mesh, this%gmesh, this%mprop%nmat, & - this%ns_solver%fluxing_velocity, this%ns_solver%fluidRho, plist, & - this%ns_solver%velocity_bc) - call this%ns_solver%init_matls(this%vof_solver%vof, this%vof_solver%volume_flux_tot) - else - call LS_fatal ('missing "vof-solver" sublist parameter') - end if - - ! print plane reconstructions - this%dump_intrec = .true. ! TODO: grab from input file -#ifdef _OPENMP - ! only dump interface reconstruction if running in serial - this%dump_intrec = this%dump_intrec .and. omp_get_max_threads() == 1 -#endif - call stop_timer ('vof-solver') - - !! Simulation control parameters - write(*,*) 'loading simulation control parameters...' - if (params%is_sublist('sim-control')) then - plist => params%sublist('sim-control') - context = 'processing ' // plist%name() // ': ' - call plist%get ('initial-time', t_init, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - call plist%get ('initial-time-step', this%dt_init, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - if (this%dt_init <= 0.0_r8) call LS_fatal (context//'"initial-time-step" must be > 0.0') - call plist%get ('min-time-step', this%dt_min, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - if (this%dt_min > this%dt_init) & - call LS_fatal (context//'require "min-time-step" <= "initial-time-step"') - call plist%get ('output-times', this%tout, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - !TODO: check for strictly increasing values in TOUT, TOUT > t_init, or sort - !and cull those < t_init. - else - call LS_fatal ('missing "sim-control" sublist parameter') - end if - - !! set initial state - call start_timer ('initial-state') - - !! Generate the initial material configuration - write(*,*) 'initializing material layout...' - plist => params%sublist('vof-solver') - if (plist%is_sublist('initial-vof')) then - plist => plist%sublist('initial-vof') - call this%vof_solver%set_initial_state(plist) - else - call LS_fatal ('missing "initial-vof" sublist parameter') - end if - - !! Set the initial flow, pressure, density, fluidvof fields - write(*,*) 'initializing flow...' - call this%ns_solver%set_initial_state () - - call stop_timer ('initial-state') - - call stop_timer ('initialization') - - end subroutine init - - ! this is the main driver, only separating dumps - ! it calls a separate routine for flow subcycles - subroutine run (this, stat, errmsg) - - class(flow_sim), intent(inout) :: this - integer, intent(out) :: stat - character(:), allocatable, intent(out) :: errmsg - - integer :: n - real(r8) :: t - character(80) :: string(2) - - call start_timer ('integration') - write(*,*) 'running simulation...' - - !! Write the initial solution. - t = 0.0_r8 - if (this%dump_intrec) call this%vof_solver%update_intrec_surf () - call this%write_solution (t) - - call LS_info ('') - write(string(1),'(a,es12.5)') 'Beginning integration at T = ', t - call LS_info (string(1)) - - do n = 1, size(this%tout) - call this%step (this%tout(n)-t, t) - - t = this%tout(n) - call this%write_solution (t) - - write(string(1),'(a,es12.5,a)') 'Completed integration to T = ', this%tout(n) - call LS_info (string(1)) - !call LS_info (string(2)) - end do - - call LS_info ('') - write(string(1),'(a,es12.5,a)') 'Completed integration to T = ', this%tout(size(this%tout)) - call LS_info (string(1)) - - stat = 0 - call stop_timer ('integration') - - ! print L1, L2, and Linf error norms (TODO: optionally) - call this%vof_solver%print_error_norms () - end subroutine run - - ! update the flow from t to t+dt, subcycling as necessary - subroutine step (this, dt, t) - - class(flow_sim), intent(inout) :: this - real(r8), intent(in) :: dt, t - - real(r8) :: flow_dt, tlocal - integer, save :: iter = 0 - - ! ! DEBUGGING/SCALING ################## - ! integer, parameter :: nsteps = 1 - ! write(*,*) 'WARNING - number of timesteps forced' - ! ! DEBUGGING/SCALING ################## - - tlocal = 0.0_r8 - do while (tlocal -!! September 2014 -!! -!! NOTES -!! -!! This is a rough first pass and much work remains to clean this up. -!! In particular the following points should be addressed. -!! -!! 1. Only the (2,2) (face-face) block of the diffusion matrix is needed -!! but we are hijacking the machinery of the full diffusion matrix to -!! get it. Significant wasted memory here. We are also hijacking the -!! full HC residual when only the algebraic portion is needed. -!! -!! 2. This potentially has several use cases beyond just solving for -!! the initial face temperatures; e.g., making them exactly consistent -!! as part of the nonlinear time step solves (the residual in the -!! algebraic equation is exactly the local face flux mismatch). For -!! this, some further attention needs to be paid to the different -!! phases of the calculation, and exposing them individually to avoid -!! unnecessary repeated work when doing multiple solves, as opposed to -!! a single one-off solve. -!! -!! 4. The calculation of the matrix probably should be a HC_model -!! method. This is because it depends on BC, and otherwise code that -!! depends on BC will be scattered all over the place, where ever the -!! diffusion matrix is used (preconditioners, for example). -!! -!! 5. The HC_model residual method is being used to get the rhs for the -!! algebraic system. A significant portion of the residual is ignored -!! and it also requires udot (we pass 0) -- more wasted memory here. -!! It would be nice to avoid this if possible, but not if that means -!! replicated residual code. -!! - -#include "f90_assert.fpp" - -module HC_AE_solver_type - - use kinds, only: r8 - use HC_model_type - use mfd_diff_matrix_type - use hypre_hybrid_type - use parameter_list_type - use logging_services - implicit none - private - - type, public :: HC_AE_solver - private - type(HC_model), pointer :: model => null() ! reference only -- do not own - type(parameter_list), pointer :: params => null() ! reference only - do not own - contains - procedure :: init - procedure :: solve - end type HC_AE_solver - -contains - - subroutine init (this, model, params) - class(HC_AE_solver), intent(out) :: this - type(HC_model), intent(in), target :: model - type(parameter_list), pointer :: params - this%model => model - this%params => params - end subroutine init - - subroutine solve (this, t, tcell, tface, stat, errmsg) - - class(HC_AE_solver), intent(inout) :: this - real(r8), intent(in) :: t, tcell(:) - real(r8), intent(inout) :: tface(:) - integer, intent(out) :: stat - character(:), allocatable, intent(out) :: errmsg - - type(mfd_diff_matrix), target :: dm - type(hypre_hybrid) :: solver - real(r8), allocatable :: coef(:), z(:), u(:), udot(:) - real(r8), allocatable, target :: r(:) - real(r8), pointer :: rface(:) - real(r8) :: norm - integer :: num_itr, num_dscg_itr, num_pcg_itr - character(80) :: string - - ASSERT(size(tcell) == this%model%mesh%ncell) - ASSERT(size(tface) == this%model%mesh%nface) - - !! Compute the RHS. - allocate(u(this%model%num_dof()), udot(this%model%num_dof()), r(this%model%num_dof())) - udot = 0.0_r8 - u = 0.0_r8 - call this%model%set_cell_temp (tcell, u) - call this%model%set_face_temp (tface, u) - call this%model%residual (t, u, udot, r) - call this%model%get_face_temp_view (r, rface) - norm = sqrt(sum(rface**2)) - if (LS_VERBOSITY >= LS_VERB_NOISY) then - write(string,'(a,es9.2)') 'HC_AE_solver%solve: initial ||rface||_2 = ', norm - call LS_info (string) - end if - if (norm == 0.0_r8) return - - !! Compute the matrix (the A22 submatrix) - allocate(coef(size(tcell))) - call this%model%conductivity (tcell, coef) - call dm%init (this%model%disc) - call dm%compute (coef) - call this%model%temp_bc%compute (t) - call dm%set_dir_faces (this%model%temp_bc%index) - deallocate(coef) - - !! Setup the linear solver. - call this%params%set ('krylov-method', 'cg') - call this%params%get ('max-iter', num_itr) - call this%params%set ('max-ds-iter', num_itr) - call this%params%set ('max-amg-iter', num_itr) - if (LS_VERBOSITY >= LS_VERB_NOISY) then - call this%params%set ('print-level', 1) - call this%params%set ('logging-level', 1) - else - call this%params%set ('print-level', 0) - call this%params%set ('logging-level', 0) - end if - call solver%init (dm%a22, this%params) - call solver%setup - - !! Solve - allocate(z(size(tface))) - z = 0.0_r8 - call solver%solve (rface, z, stat) - tface = tface - z - - if (LS_VERBOSITY >= LS_VERB_NOISY) then - call solver%get_metrics (num_itr, num_dscg_itr, num_pcg_itr, norm) - write(string,'(3(a,i0),a,es9.2)') 'HC_AE_solver%solve: num_itr = ', num_itr, & - ' (', num_dscg_itr, ', ', num_pcg_itr, '), ||r||/||b|| = ', norm - call LS_info (string) - - !! Check the residual. - call this%model%set_face_temp (tface, u) - call this%model%residual (t, u, udot, r) - write(string,'(a,es9.2)') 'HC_AE_solver%solve: ||rface||_2 = ', sqrt(sum(rface**2)) - call LS_info (string) - end if - - if (stat /= 0) then - call solver%get_metrics (num_itr, num_dscg_itr, num_pcg_itr, norm) - write(string,'(3(a,i0),a,es9.2)') 'failed to converge: num_itr = ', num_itr, & - ' (', num_dscg_itr, ', ', num_pcg_itr, '), ||r||/||b|| = ', norm - errmsg = trim(string) - end if - - end subroutine solve - -end module HC_AE_solver_type diff --git a/src/hc/HC_idaesol_model_type.F90 b/src/hc/HC_idaesol_model_type.F90 deleted file mode 100644 index d7f6ef8..0000000 --- a/src/hc/HC_idaesol_model_type.F90 +++ /dev/null @@ -1,94 +0,0 @@ -!! -!! HC_IDAESOL_MODEL_TYPE -!! -!! This module defines an extension of the IDAESOL_MODEL abstract class that -!! implements the methods required by the ODE integrator. It bundles up -!! several different computational pieces and adapts them to the required -!! interface. -!! -!! Neil N. Carlson -!! August 2014 -!! - -#include "f90_assert.fpp" - -module HC_idaesol_model_type - - use kinds, only: r8 - use HC_model_type - use HC_precon_type - use HC_norm_type - use idaesol_type, only: idaesol_model - implicit none - private - - type, extends(idaesol_model), public :: HC_idaesol_model - type(HC_model), pointer :: model => null() ! reference only -- do not own - type(HC_precon), pointer :: precon => null() ! reference only -- do not own - type(HC_norm), pointer :: norm => null() ! reference only -- do not own - contains - procedure :: init - !! Deferred procedures from IDAESOL_MODEL - procedure :: size => model_size - procedure :: compute_f - procedure :: apply_precon - procedure :: compute_precon - procedure :: du_norm - procedure :: schk - end type HC_idaesol_model - -contains - - subroutine init (this, model, precon, norm) - class(HC_idaesol_model), intent(out) :: this - class(HC_model), intent(in), target :: model - class(HC_precon), intent(in), target :: precon - class(HC_norm), intent(in), target :: norm - this%model => model - this%precon => precon - this%norm => norm - ASSERT(associated(this%model, precon%model)) - !ASSERT(associated(this%model, norm%model)) - end subroutine init - - integer function model_size (this) - class(HC_idaesol_model), intent(in) :: this - model_size = this%model%num_dof() - end function model_size - - subroutine compute_f (this, t, u, udot, f) - class(HC_idaesol_model) :: this - real(r8), intent(in) :: t, u(:), udot(:) - real(r8), intent(out) :: f(:) - call this%model%residual (t, u, udot, f) - end subroutine compute_f - - subroutine apply_precon (this, t, u, f) - class(HC_idaesol_model) :: this - real(r8), intent(in) :: t, u(:) - real(r8), intent(inout) :: f(:) - call this%precon%apply (f) - end subroutine apply_precon - - subroutine compute_precon (this, t, u, dt) - class(HC_idaesol_model) :: this - real(r8), intent(in) :: t, u(:), dt - call this%precon%compute (t, u, dt) - end subroutine compute_precon - - subroutine du_norm (this, u, du, error) - class(HC_idaesol_model) :: this - real(r8), intent(in) :: u(:), du(:) - real(r8), intent(out) :: error - call this%norm%compute (u, du, error) - end subroutine du_norm - - subroutine schk (this, u, stage, errc) - class(HC_idaesol_model) :: this - real(r8), intent(in) :: u(:) - integer, intent(in) :: stage - integer, intent(out) :: errc - errc = 0 ! solution is fine - end subroutine schk - -end module HC_idaesol_model_type diff --git a/src/hc/HC_main.F90 b/src/hc/HC_main.F90 deleted file mode 100644 index 3573d86..0000000 --- a/src/hc/HC_main.F90 +++ /dev/null @@ -1,68 +0,0 @@ -!! -!! HC_MAIN -!! -!! A Basic driver for the heat conduction (HC) model. -!! -!! Neil N. Carlson -!! September 2014 -!! - -#include "f90_assert.fpp" - -program HC_main - - use,intrinsic :: iso_fortran_env, only: output_unit, error_unit - use,intrinsic :: iso_c_binding, only: C_NEW_LINE - use logging_services - use timer_tree_type - use parameter_list_type - use parameter_list_json - use HC_sim_type - implicit none - - integer :: n, num_arg, inlun, stat - character(256) :: arg - character(:), allocatable :: prog, infile, errmsg - type(parameter_list), pointer :: params - type(HC_sim) :: sim - - !! Get the program name from the command line. - call get_command (arg) - n = scan(arg, '/', back=.true.) - prog = trim(arg(n+1:)) ! remove the leading path component, if any - - !! Get the input file name from the command line. - num_arg = command_argument_count() - if (num_arg == 1) then - call get_command_argument (1, arg) - infile = trim(arg) - else - write(error_unit,'(a)') 'usage: ' // prog // ' INFILE' - stop - end if - - !! Initialize the logging service routines; output goes to stdout. - call LS_initialize ([output_unit]) !, LS_VERB_NOISY) - - !! Read the parameter list from the input file. - open(newunit=inlun,file=infile,action='read',access='stream') - call parameter_list_from_json_stream (inlun, params, errmsg) - if (.not.associated(params)) call LS_fatal ("error reading input file:" // C_NEW_LINE // errmsg) - close(inlun) - - !! Set up the simulation and run it. - call start_timer ('simulation') - call sim%init (params) - call sim%run (stat, errmsg) - if (stat /= 0) call LS_fatal ('HC_SIM: '//errmsg) - call stop_timer ('simulation') - - !! Write some timing info. - call LS_info (C_NEW_LINE//'Timing Summary:'//C_NEW_LINE) - call write_timer_tree (output_unit, indent=3) - - !! And quit. - call LS_info ('') - call LS_exit - -end program diff --git a/src/hc/HC_model_type.F90 b/src/hc/HC_model_type.F90 deleted file mode 100644 index ffd870a..0000000 --- a/src/hc/HC_model_type.F90 +++ /dev/null @@ -1,273 +0,0 @@ -!! -!! HC_MODEL_TYPE -!! -!! This module defines a class that encapsulates the ODE system arising from -!! the mimetic finite difference discretization of the heat conduction equation -!! over an unstructured 3D mesh. This is a basic version of the linear heat -!! equation with constant coefficients, and fully general Dirichlet and flux -!! boundary conditions. -!! -!! Neil N. Carlson -!! Adapted for F2008, April 2014 -!! - -#include "f90_assert.fpp" - -module HC_model_type - - use kinds, only: r8 - use unstr_mesh_type - use mfd_disc_type - use data_layout_type - use bndry_func_class - use timer_tree_type - implicit none - private - - type, public :: HC_model - type(mfd_disc), pointer :: disc => null() ! reference only -- do not own - type(unstr_mesh), pointer :: mesh => null() ! reference only -- do not own - !! Variable layout - type(data_layout) :: layout - integer :: cell_heat_segid, cell_temp_segid, face_temp_segid - !! Boundary condition data - class(bndry_func), allocatable :: temp_bc, flux_bc - !! Constant model parameters (simple first step) - real(r8) :: rho, cp, kappa, q - contains - procedure :: init - procedure :: num_dof - procedure :: H_of_T - procedure :: T_of_H - procedure :: dHdT - procedure :: conductivity - procedure :: source - procedure :: get_cell_heat_view - procedure :: get_cell_temp_view - procedure :: get_face_temp_view - procedure :: get_cell_heat_copy - procedure :: get_cell_temp_copy - procedure :: get_face_temp_copy - procedure :: set_cell_heat - procedure :: set_cell_temp - procedure :: set_face_temp - procedure :: residual - end type HC_model - -contains - - subroutine init (this, disc, params) - - use parameter_list_type - use bc_factory_type - use logging_services - - class(HC_model), intent(out) :: this - type(mfd_disc), intent(in), target :: disc - type(parameter_list) :: params - - integer :: stat - character(:), allocatable :: context, errmsg - type(bc_factory) :: bcfact - - this%disc => disc - this%mesh => disc%mesh - - !! Create the packed layout of the model variables. - this%cell_heat_segid = this%layout%alloc_segment(this%mesh%ncell) - this%cell_temp_segid = this%layout%alloc_segment(this%mesh%ncell) - this%face_temp_segid = this%layout%alloc_segment(this%mesh%nface) - call this%layout%alloc_complete - - !! Model parameters - context = 'processing ' // params%name() // ': ' - call params%get ('density', this%rho, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - if (this%rho <= 0.0_r8) call LS_fatal (context//'"density" must be > 0.0') - call params%get ('specific-heat', this%cp, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - if (this%cp <= 0.0_r8) call LS_fatal (context//'"specific-heat" must be > 0.0') - call params%get ('conductivity', this%kappa, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - if (this%kappa <= 0.0_r8) call LS_fatal (context//'"conductivity" must be > 0.0') - call params%get ('source', this%q, default=0.0_r8, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - - !! Initialize the boundary condition components - if (params%is_sublist('bc')) then - call bcfact%init (this%mesh, params%sublist('bc')) - call bcfact%alloc_bc ('dirichlet', this%temp_bc) - call bcfact%alloc_bc ('flux', this%flux_bc) - else - call LS_fatal (context//'missing "bc" sublist parameter') - end if - - end subroutine init - - integer function num_dof (this) - class(HC_model), intent(in) :: this - num_dof = this%layout%layout_size() - end function num_dof - - subroutine H_of_T (this, temp, value) - class(HC_model), intent(in) :: this - real(r8), intent(in) :: temp(:) - real(r8), intent(out) :: value(:) - value = (this%rho * this%cp) * temp - end subroutine H_of_T - - subroutine T_of_H (this, enth, value) - class(HC_model), intent(in) :: this - real(r8), intent(in) :: enth(:) - real(r8), intent(out) :: value(:) - value = enth / (this%rho * this%cp) - end subroutine T_of_H - - subroutine dHdT (this, temp, value) - class(HC_model), intent(in) :: this - real(r8), intent(in) :: temp(:) - real(r8), intent(out) :: value(:) - value = (this%rho * this%cp) - end subroutine dHdT - - subroutine conductivity (this, temp, value) - class(HC_model), intent(in) :: this - real(r8), intent(in) :: temp(:) - real(r8), intent(out) :: value(:) - value = this%kappa - end subroutine conductivity - - subroutine source (this, t, value) - class(HC_model), intent(in) :: this - real(r8), intent(in) :: t - real(r8), intent(out) :: value(:) - value = this%q - end subroutine source - - - subroutine get_cell_heat_view (this, array, view) - class(HC_model), intent(in) :: this - real(r8), target, intent(in) :: array(:) - real(r8), pointer :: view(:) - call this%layout%segment_view (array, this%cell_heat_segid, view) - end subroutine get_cell_heat_view - - subroutine get_cell_temp_view (this, array, view) - class(HC_model), intent(in) :: this - real(r8), target, intent(in) :: array(:) - real(r8), pointer :: view(:) - call this%layout%segment_view (array, this%cell_temp_segid, view) - end subroutine get_cell_temp_view - - subroutine get_face_temp_view (this, array, view) - class(HC_model), intent(in) :: this - real(r8), target, intent(in) :: array(:) - real(r8), pointer :: view(:) - call this%layout%segment_view (array, this%face_temp_segid, view) - end subroutine get_face_temp_view - - subroutine get_cell_heat_copy (this, array, copy) - class(HC_model), intent(in) :: this - real(r8), intent(in), target :: array(:) - real(r8), intent(inout) :: copy(:) - call this%layout%segment_copy (array, this%cell_heat_segid, copy) - end subroutine get_cell_heat_copy - - subroutine get_cell_temp_copy (this, array, copy) - class(HC_model), intent(in) :: this - real(r8), intent(in), target :: array(:) - real(r8), intent(inout) :: copy(:) - call this%layout%segment_copy (array, this%cell_temp_segid, copy) - end subroutine get_cell_temp_copy - - subroutine get_face_temp_copy (this, array, copy) - class(HC_model), intent(in) :: this - real(r8), intent(in), target :: array(:) - real(r8), intent(inout) :: copy(:) - call this%layout%segment_copy (array, this%face_temp_segid, copy) - end subroutine get_face_temp_copy - - subroutine set_cell_heat (this, source, array) - class(HC_model), intent(in) :: this - real(r8), intent(in) :: source(:) - real(r8), intent(inout), target :: array(:) - real(r8), pointer :: view(:) - call this%layout%segment_view (array, this%cell_heat_segid, view) - view = source(:size(view)) - end subroutine set_cell_heat - - subroutine set_cell_temp (this, source, array) - class(HC_model), intent(in) :: this - real(r8), intent(in) :: source(:) - real(r8), intent(inout), target :: array(:) - real(r8), pointer :: view(:) - call this%layout%segment_view (array, this%cell_temp_segid, view) - view = source(:size(view)) - end subroutine set_cell_temp - - subroutine set_face_temp (this, source, array) - class(HC_model), intent(in) :: this - real(r8), intent(in) :: source(:) - real(r8), intent(inout), target :: array(:) - real(r8), pointer :: view(:) - call this%layout%segment_view (array, this%face_temp_segid, view) - view = source(:size(view)) - end subroutine set_face_temp - - - subroutine residual (this, t, u, udot, f) - - class(HC_model), intent(inout) :: this - real(r8), intent(in) :: t, u(:), udot(:) - real(r8), intent(out) :: f(:) - target :: u, udot, f - - real(r8), pointer :: Hcell(:), Tcell(:), Fcell(:), Fface(:), Hdot(:) - real(r8) :: Tface(this%mesh%nface), cval(this%mesh%ncell) - real(r8), allocatable :: Fdir(:) - - call start_timer ('hc-residual') - - !!!! RESIDUAL OF THE ALGEBRAIC ENTHALPY-TEMPERATURE RELATION !!!!!!!!!!!!!!!!! - - call this%get_cell_heat_view (u, Hcell) - call this%get_cell_temp_view (u, Tcell) - call this%get_cell_heat_view (f, Fcell) - call this%H_of_T (Tcell, cval) - Fcell = Hcell - cval - - !!!! RESIDUAL OF THE HEAT EQUATION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - !! Pre-compute the Dirichlet condition residual and impose the Dirichlet data. - call this%get_face_temp_copy (u, Tface) ! NB: copy, will modify boundary - call this%temp_bc%compute (t) - associate (index => this%temp_bc%index, value => this%temp_bc%value) - Fdir = Tface(index) - value - Tface(index) = value - end associate - - !! Compute the generic heat equation residual. - call this%get_cell_temp_view (f, Fcell) - call this%get_face_temp_view (f, Fface) - call this%conductivity (Tcell, cval) - call this%disc%apply_diff (cval, Tcell, Tface, Fcell, Fface) - call this%source (t, cval) - call this%get_cell_heat_view (udot, Hdot) - Fcell = Fcell + this%mesh%volume*(Hdot - cval) - - !! Dirichlet condition residuals. - associate (faces => this%temp_bc%index) - Fface(faces) = Fdir ! overwrite with pre-computed values - end associate - - !! Simple flux BC contribution. - call this%flux_bc%compute (t) - associate (index => this%flux_bc%index, value => this%flux_bc%value) - Fface(index) = Fface(index) + this%mesh%area(index) * value - end associate - - call stop_timer ('hc-residual') - - end subroutine residual - -end module HC_model_type diff --git a/src/hc/HC_norm_type.F90 b/src/hc/HC_norm_type.F90 deleted file mode 100644 index 41f5546..0000000 --- a/src/hc/HC_norm_type.F90 +++ /dev/null @@ -1,107 +0,0 @@ -!! -!! HC_NORM_TYPE -!! -!! This module defines a derived type that encapsulates the norm used for -!! solution increments of the heat conduction model. -!! -!! Neil N. Carlson -!! Adapted for F2003, July 2014 -!! - -#include "f90_assert.fpp" - -module HC_norm_type - - use kinds, only: r8 - use HC_model_type - implicit none - private - - type, public :: HC_norm - private - type(HC_model), pointer :: model => null() ! reference only -- do not own - real(r8) :: abs_T_tol ! absolute temperature tolerance - real(r8) :: rel_T_tol ! relative temperature tolerance - real(r8) :: abs_H_tol ! absolute enthalpy tolerance - real(r8) :: rel_H_tol ! relative enthalpy tolerance - contains - procedure :: init - procedure :: compute - end type HC_norm - -contains - - subroutine init (this, model, params) - - use parameter_list_type - use logging_services - - class(HC_norm), intent(out) :: this - type(HC_model), intent(in), target :: model - type(parameter_list) :: params - - integer :: stat - character(:), allocatable :: context, errmsg - - this%model => model - - context = 'processing ' // params%name() // ': ' - call params%get ('temp-abs-tol', this%abs_T_tol, default=0.0_r8, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - call params%get ('temp-rel-tol', this%rel_T_tol, default=0.0_r8, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - if (this%abs_T_tol < 0.0_r8) call LS_fatal (context//'"temp-abs-tol" must be >= 0.0') - if (this%rel_T_tol < 0.0_r8) call LS_fatal (context//'"temp-rel-tol" must be >= 0.0') - if (this%abs_T_tol == 0.0_r8 .and. this%rel_T_tol == 0.0_r8) & - call LS_fatal (context//'"temp-abs-tol" and "temp-rel-tol" cannot both be 0.0') - - call params%get ('enth-abs-tol', this%abs_H_tol, default=0.0_r8, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - call params%get ('enth-rel-tol', this%rel_H_tol, default=0.0_r8, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - if (this%abs_H_tol < 0.0_r8) call LS_fatal (context//'"enth-abs-tol" must be >= 0.0') - if (this%rel_H_tol < 0.0_r8) call LS_fatal (context//'"enth-rel-tol" must be >= 0.0') - if (this%abs_H_tol == 0.0_r8 .and. this%rel_H_tol == 0.0_r8) & - call LS_fatal (context//'"enth-abs-tol" and "enth-rel-tol" cannot both be 0.0') - - end subroutine init - - - subroutine compute (this, u, du, du_norm) - - class(HC_norm), intent(in) :: this - real(r8), intent(in), target :: u(:), du(:) - real(r8), intent(out) :: du_norm - - real(r8), pointer :: useg(:), duseg(:) - - ASSERT(size(u) == size(du)) - ASSERT(size(u) == this%model%num_dof()) - - du_norm = 0.0_r8 - - !! Cell temperature delta norm - call this%model%get_cell_temp_view (u, useg) - call this%model%get_cell_temp_view (du, duseg) - du_norm = max(du_norm, maxerr(useg, duseg, this%abs_T_tol, this%rel_T_tol)) - - !! Face temperature delta norm - call this%model%get_face_temp_view (u, useg) - call this%model%get_face_temp_view (du, duseg) - du_norm = max(du_norm, maxerr(useg, duseg, this%abs_T_tol, this%rel_T_tol)) - - !! Cell enthalpy delta norm - call this%model%get_cell_heat_view (u, useg) - call this%model%get_cell_heat_view (du, duseg) - du_norm = max(du_norm, maxerr(useg, duseg, this%abs_T_tol, this%rel_T_tol)) - - contains - - real(r8) function maxerr (u, du, atol, rtol) - real(r8), intent(in) :: u(:), du(:), atol, rtol - maxerr = maxval(abs(du)/(atol + rtol*abs(u))) - end function - - end subroutine compute - -end module HC_norm_type diff --git a/src/hc/HC_precon_type.F90 b/src/hc/HC_precon_type.F90 deleted file mode 100644 index e8e8ff4..0000000 --- a/src/hc/HC_precon_type.F90 +++ /dev/null @@ -1,149 +0,0 @@ -!! -!! HC_PRECON_TYPE -!! -!! This module defines a derived type that encapsulates the preconditioner for -!! the heat conduction model. -!! -!! Neil N. Carlson -!! Adapted for F2008, April 2014 -!! -!! PROGRAMMING INTERFACE -!! -!! The module defines the derived type HC_PRECON_TYPE. It has the following -!! type bound procedures. -!! -!! INIT(MODEL, PARAMS) initializes the object. MODEL is of type HC_MODEL. -!! The object will hold a reference to the model, and so the actual argument -!! must have the target attribute and persist for the lifetime of the object. -!! The PARAMETER_LIST type argument PARAMS gives the parameters for the -!! preconditioner. For this model there is only the single heat equation -!! and the expected parameters are those described for MFD_DIFF_PRECON. -!! -!! COMPUTE(T, U, DT) computes the preconditioner for the model at time T, -!! unknown vector U, and time step DT. It must be called before calling -!! the APPLY procedure. -!! -!! APPLY(F) applies the preconditioner for the model to the vector F, which is -!! overwritten with the result. -!! - -#include "f90_assert.fpp" - -module HC_precon_type - - use kinds, only: r8 - use HC_model_type - use unstr_mesh_type - use mfd_diff_precon_type - use mfd_diff_matrix_type - use parameter_list_type - use timer_tree_type - implicit none - private - - type, public :: HC_precon - type(HC_model), pointer :: model => null() ! reference only -- do not own - type(unstr_mesh), pointer :: mesh => null() ! reference only -- do not own - real(r8) :: dt ! time step - real(r8), allocatable :: dHdT(:) ! derivative of the enthalpy/temperature relation - type(mfd_diff_precon) :: hcprecon ! heat equation preconditioner - contains - procedure :: init - procedure :: compute - procedure :: apply - end type HC_precon - -contains - - subroutine init (this, model, params) - - class(HC_precon), intent(out) :: this - type(HC_model), intent(in), target :: model - type(parameter_list) :: params - - type(mfd_diff_matrix), allocatable :: dm - - this%model => model - this%mesh => model%mesh - - !! Heat density/temperature relation derivative. - allocate(this%dHdT(this%mesh%ncell)) - - !! Create the preconditioner for the heat equation. - !! The preconditioner assumes ownership of the matrix. - allocate (dm) - call dm%init (model%disc) - call this%hcprecon%init (dm, params) - - end subroutine init - - subroutine compute (this, t, u, dt) - - class(HC_precon), intent(inout) :: this - real(r8), intent(in) :: t, dt - real(r8), intent(in), target :: u(:) - - real(r8), pointer :: temp(:) - real(r8) :: coef(this%mesh%ncell) - type(mfd_diff_matrix), pointer :: dm - - call start_timer ('hc-precon-compute') - call start_timer ('matrix-compute') - - ASSERT(size(u) == this%model%num_dof()) - ASSERT(dt > 0.0_r8) - - this%dt = dt ! the time step size - - !! Grab the matrix; we will update its values. - dm => this%hcprecon%matrix() - - !! Jacobian of the heat equation diffusion operator ignoring nonlinearities. - call this%model%get_cell_temp_view (u, temp) - call this%model%conductivity (temp, coef) - call dm%compute (coef) - - !! Contribution from the time derivative (H/T relation eliminated). - call this%model%dHdT (temp, this%dHdT) - call dm%incr_cell_diag (this%mesh%volume * this%dHdT / dt) - - !! Dirichlet boundary condition fixups. - call this%model%temp_bc%compute (t) - call dm%set_dir_faces (this%model%temp_bc%index) - call stop_timer ('matrix-compute') - - !! The matrix is now complete; re-compute the preconditioner. - call this%hcprecon%compute - - call stop_timer ('hc-precon-compute') - - end subroutine compute - - subroutine apply (this, f) - - class(HC_precon), intent(in) :: this - real(r8), intent(inout), target :: f(:) - - real(r8), pointer :: f0(:), f1(:), f2(:) - - call start_timer ('hc-precon-apply') - - !! Heat equation cell residual with the H/T relation residual eliminated. - call this%model%get_cell_heat_view (f, f0) - call this%model%get_cell_temp_view (f, f1) - f1 = f1 - (this%mesh%volume/this%dt)*f0 - - !! Heat equation face residual. - call this%model%get_face_temp_view (f, f2) - - !! Precondition the heat equation. - call this%hcprecon%apply (f1, f2) - - !! Backsubstitute to obtain the preconditioned H/T-relation residual. - f0 = f0 + this%dHdT*f1 - - call stop_timer ('hc-precon-apply') - - end subroutine apply - -end module HC_precon_type diff --git a/src/hc/HC_sim_type.F90 b/src/hc/HC_sim_type.F90 deleted file mode 100644 index 62c76c1..0000000 --- a/src/hc/HC_sim_type.F90 +++ /dev/null @@ -1,261 +0,0 @@ -!! -!! HC_SIM_TYPE -!! -!! This module defines a class that encapsulates a heat conduction simulation. -!! This drives the time integration and generates the output; it is very basic. -!! -!! Neil N. Carlson -!! September 2014 -!! - -#include "f90_assert.fpp" - -module HC_sim_type - - use kinds, only: r8 - use unstr_mesh_type - use mfd_disc_type - use HC_model_type - use HC_solver_type - use logging_services - use timer_tree_type - implicit none - private - - type, public :: HC_sim - type(unstr_mesh), pointer :: mesh => null() - type(mfd_disc), pointer :: disc => null() - type(HC_model), pointer :: model => null() - type(HC_solver), pointer :: solver => null() - !! Integration control - real(r8) :: dt_init - real(r8) :: dt_min - real(r8), allocatable :: tout(:) - !! - integer :: nfile = 0 ! output file counter - contains - procedure :: init - procedure :: run - procedure, private :: write_solution - final :: HC_sim_delete - end type HC_sim - -contains - - !! Final subroutine for HC_SIM objects. - subroutine HC_sim_delete (this) - type(HC_sim), intent(inout) :: this - if (associated(this%mesh)) deallocate(this%mesh) - if (associated(this%disc)) deallocate(this%disc) - if (associated(this%model)) deallocate(this%model) - if (associated(this%solver)) deallocate(this%solver) - end subroutine HC_sim_delete - - subroutine init (this, params) - - use parameter_list_type - use unstr_mesh_factory - use unstr_mesh_func - - class(HC_sim), intent(out) :: this - type(parameter_list) :: params - - integer :: stat - type(parameter_list), pointer :: plist - character(:), allocatable :: errmsg, context - real(r8), allocatable :: temp(:) - real(r8) :: t_init - - call start_timer ('initialization') - call LS_info ('Initializing the simulation', LS_VERB_NOISY) - - !! Create the mesh and discretization object. - call start_timer ('mesh') - if (params%is_sublist('mesh')) then - plist => params%sublist('mesh') - this%mesh => new_unstr_mesh(plist) - else - call LS_fatal ('missing "mesh" sublist parameter') - end if - call stop_timer ('mesh') - call start_timer ('mfd-discretization') - allocate(this%disc) - call this%disc%init (this%mesh) - call stop_timer ('mfd-discretization') - - !! Create the heat conduction model. - call start_timer ('hc-model') - if (params%is_sublist('hc-model')) then - plist => params%sublist('hc-model') - allocate(this%model) - call this%model%init (this%disc, plist) - else - call LS_fatal ('missing "hc-model" sublist parameter') - end if - call stop_timer ('hc-model') - - !! Create the heat conduction solver. - call start_timer ('hc-solver') - if (params%is_sublist('hc-solver')) then - plist => params%sublist('hc-solver') - allocate(this%solver) - call this%solver%init (this%model, plist) - else - call LS_fatal ('missing "hc-solver" sublist parameter') - end if - call stop_timer ('hc-solver') - - !! Simulation control parameters - if (params%is_sublist('sim-control')) then - plist => params%sublist('sim-control') - context = 'processing ' // plist%name() // ': ' - call plist%get ('initial-time', t_init, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - call plist%get ('initial-time-step', this%dt_init, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - if (this%dt_init <= 0.0_r8) call LS_fatal (context//'"initial-time-step" must be > 0.0') - call plist%get ('min-time-step', this%dt_min, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - if (this%dt_min > this%dt_init) call LS_fatal (context//'require "min-time-step" <= "initial-time-step"') - call plist%get ('output-times', this%tout, stat=stat, errmsg=errmsg) - if (stat /= 0) call LS_fatal (context//errmsg) - !TODO: check for strictly increasing values in TOUT, TOUT > t_init, or sort - !and cull those < t_init. - else - call LS_fatal ('missing "sim-control" sublist parameter') - end if - - !! Generate the initial temperature field - call start_timer ('initial-state') - if (params%is_sublist('initial-temperature')) then - plist => params%sublist('initial-temperature') - allocate(temp(this%mesh%ncell)) - call compute_mesh_func (this%mesh, plist, temp) - else - call LS_fatal ('missing "initial-temperature" sublist parameter') - end if - - !! Define the initial heat conduction state - call this%solver%set_initial_state (t_init, temp, this%dt_init) - call stop_timer ('initial-state') - - call stop_timer ('initialization') - - end subroutine init - - subroutine run (this, stat, errmsg) - - class(HC_sim), intent(inout) :: this - integer, intent(out) :: stat - character(:), allocatable, intent(out) :: errmsg - - integer :: n, status - real(r8) :: t, hnext - real(r8), allocatable :: u(:) - character(80) :: string(2) - - call start_timer ('integration') - - allocate(u(this%model%num_dof())) - - !! Write the initial solution. - t = this%solver%time() - call this%solver%get_solution_copy (u) - call this%write_solution (t, u) - - call LS_info ('') - write(string(1),'(a,es12.5)') 'Beginning integration at T = ', t - call LS_info (string(1)) - - hnext = this%dt_init - do n = 1, size(this%tout) - if (this%tout(n) <= this%solver%time()) then - t = this%tout(n) - call this%solver%get_interpolated_solution (t, u) - call this%write_solution (t, u) - else - call this%solver%integrate (hnext, status, tout=this%tout(n), hmin=this%dt_min) - t = this%solver%time() - select case (status) - case (SOLVED_TO_TOUT) - call this%solver%get_interpolated_solution (this%tout(n), u) - call this%write_solution (this%tout(n), u) - case (STEP_FAILED) - call this%solver%get_solution_copy (u) - call this%write_solution (t, u) - stat = -1 - errmsg = 'failed to take a step' - return - case (STEP_SIZE_TOO_SMALL) - call this%solver%get_solution_copy (u) - call this%write_solution (t, u) - stat = -1 - errmsg = 'next time step is too small' - return - case (BAD_INPUT) - stat = -1 - errmsg = 'bad integrator input parameters' - return - case default - stat = -1 - errmsg = 'unknown integrator return status' - return - end select - call this%solver%write_metrics (string) - call LS_info ('') - call LS_info (string(1)) - call LS_info (string(2)) - end if - end do - - call LS_info ('') - write(string(1),'(a,es12.5,a)') 'Completed integration to T = ', this%tout(size(this%tout)) - call LS_info (string(1)) - - stat = 0 - call stop_timer ('integration') - - end subroutine run - - !! This auxiliary subroutine writes the solution to a GMV format viz file. - !! There are lots of better things we could do here (write back to an Exodus - !! file, VTK, or an HDF5 file), but procedures for writing GMV output were - !! immediately available. - - subroutine write_solution (this, t, u) - - use unstr_mesh_gmv - - class(HC_sim), intent(inout) :: this - real(r8), intent(in) :: t - real(r8), intent(in), target :: u(:) - - character(16) :: filename - real(r8), pointer :: hcell(:), tcell(:), tface(:) - - call start_timer ('output') - - write(filename,'(a,i4.4)') 'out.gmv.', this%nfile - this%nfile = this%nfile + 1 - - call this%model%get_cell_heat_view (u, hcell) - call this%model%get_cell_temp_view (u, tcell) - call this%model%get_face_temp_view (u, tface) - - call gmv_open (trim(filename)) - call gmv_write_unstr_mesh (this%mesh) - call gmv_begin_variables (time=t) - call gmv_write_cell_var (this%mesh, hcell, 'H') - call gmv_write_cell_var (this%mesh, tcell, 'T') - call gmv_end_variables - call gmv_write_unstr_mesh_surf (this%mesh) - call gmv_begin_surfvars - call gmv_write_surf_var (this%mesh, tface, 'T') - call gmv_end_surfvars - call gmv_close - - call stop_timer ('output') - - end subroutine write_solution - -end module HC_sim_type diff --git a/src/hc/HC_solver_type.F90 b/src/hc/HC_solver_type.F90 deleted file mode 100644 index 0b95b18..0000000 --- a/src/hc/HC_solver_type.F90 +++ /dev/null @@ -1,356 +0,0 @@ -!! -!! HC_SOLVER_TYPE -!! -!! This module defines a class that encapsulates a (time) solver for the -!! discrete heat conduction model. It is based on IDAESOL which is an -!! integrator for index-1 DAE systems that uses BDF2 time discretization. -!! -!! Neil N. Carlson -!! Adapted for F2008, August 2014 -!! - -#include "f90_assert.fpp" -!#define DEBUG - -module HC_solver_type - - use kinds, only: r8 - use unstr_mesh_type - use HC_model_type - use HC_precon_type - use HC_norm_type - use HC_idaesol_model_type - use idaesol_type - use logging_services - implicit none - private - - type, public :: HC_solver - private - type(HC_model), pointer :: model => null() ! reference only -- do not own - type(HC_precon), pointer :: precon => null() - type(HC_norm), pointer :: norm => null() - type(HC_idaesol_model), pointer :: integ_model => null() - type(idaesol) :: integ - !! Pending/current state - real(r8) :: t, dt - real(r8), pointer :: u(:) => null() ! potentially a target - contains - procedure :: init - procedure :: set_initial_state - procedure :: test_initial_state - procedure :: integrate - procedure :: time - procedure :: get_interpolated_solution - procedure :: get_solution_view - procedure :: get_solution_copy - procedure :: write_metrics - !procedure :: advance_state - !procedure :: commit_pending_state - final :: HC_solver_delete - end type HC_solver - - !! Export integration return statuses from IDAESOL_TYPE; - !! INTEGRATE returns one of these values. - public :: SOLVED_TO_TOUT, SOLVED_TO_NSTEP - public :: BAD_INPUT, STEP_FAILED, STEP_SIZE_TOO_SMALL - -contains - - subroutine HC_solver_delete (this) - type(HC_solver), intent(inout) :: this - if (associated(this%precon)) deallocate(this%precon) - if (associated(this%norm)) deallocate(this%norm) - if (associated(this%integ_model)) deallocate(this%integ_model) - if (associated(this%u)) deallocate(this%u) - end subroutine HC_solver_delete - - subroutine init (this, model, params) - - use parameter_list_type - - class(HC_solver), intent(out) :: this - type(HC_model), intent(in), target :: model - type(parameter_list) :: params - - type(parameter_list), pointer :: plist - character(:), allocatable :: context - - this%model => model - - allocate(this%u(this%model%num_dof())) - - !! Create the preconditioner - context = 'processing ' // params%name() // ': ' - if (params%is_sublist('preconditioner')) then - plist => params%sublist('preconditioner') - allocate(this%precon) - call this%precon%init (this%model, plist) - else - call LS_fatal (context//'missing "preconditioner" sublist parameter') - end if - - !! Create the error norm - if (params%is_sublist('error-norm')) then - allocate(this%norm) - plist => params%sublist('error-norm') - call this%norm%init (this%model, plist) - else - call LS_fatal (context//'missing "error-norm" sublist parameter') - end if - - !! Create the IDAESOL model - allocate(this%integ_model) - call this%integ_model%init (this%model, this%precon, this%norm) - - !! Create the IDAESOL integrator - if (params%is_sublist('integrator')) then - plist => params%sublist('integrator') - call this%integ%init (this%integ_model, plist) - else - call LS_fatal (context//'missing "integrator" sublist parameter') - end if - - end subroutine init - - subroutine set_initial_state (this, t, temp, dt) - - class(HC_solver), intent(inout) :: this - real(r8), intent(in) :: t, temp(:), dt - - integer :: stat - character(:), allocatable :: errmsg - real(r8), allocatable :: udot(:) - - allocate(udot(size(this%u))) - call compute_initial_state (this%model, t, temp, dt, this%u, udot, stat, errmsg) - if (stat /= 0) call LS_fatal ('HC_SOLVER%SET_INITIAL_STATE: ' // errmsg) - call this%integ%set_initial_state (t, this%u, udot) - - end subroutine set_initial_state - - subroutine test_initial_state (this, t, temp, dt, u, udot) - - class(HC_solver), intent(inout) :: this - real(r8), intent(in) :: t, temp(:), dt - real(r8), intent(out) :: u(:), udot(:) - - integer :: stat - character(:), allocatable :: errmsg - - ASSERT(size(u) == this%model%num_dof()) - ASSERT(size(u) == size(udot)) - - call compute_initial_state (this%model, t, temp, dt, u, udot, stat, errmsg) - if (stat /= 0) call LS_fatal ('HC_SOLVER%SET_INITIAL_STATE: ' // errmsg) - - end subroutine test_initial_state - - !! Returns the current integration time. - real(r8) function time (this) - class(HC_solver), intent(in) :: this - time = this%integ%last_time() - end function time - - !! Returns the solution U interpolated to time T. This should only - !! be called when the integrator has first stepped across time T, so - !! that T lies within an interval of very recent time steps where - !! solution data is currently available. - subroutine get_interpolated_solution (this, t, u) - class(HC_solver), intent(in) :: this - real(r8), intent(in) :: t - real(r8), intent(out) :: u(:) - ASSERT(size(u) == this%model%num_dof()) - call this%integ%get_interpolated_state (t, u) - end subroutine get_interpolated_solution - - subroutine get_solution_view (this, u) - class(HC_solver), intent(in) :: this - real(r8), pointer, intent(out) :: u(:) - call this%integ%get_last_state_view (u) - end subroutine get_solution_view - - subroutine get_solution_copy (this, u) - class(HC_solver), intent(in) :: this - real(r8), intent(out) :: u(:) - call this%integ%get_last_state_copy (u) - end subroutine get_solution_copy - - subroutine write_metrics (this, string) - class(HC_solver), intent(in) :: this - character(*), intent(out) :: string(:) - ASSERT(size(string) == 2) - call this%integ%write_metrics (string) - end subroutine write_metrics - - !! This delegates to the IDAESOL integration driver. A target time (TOUT) - !! and/or (maximum) number of steps (NSTEP) is specified and the driver - !! integrates until the target time or number of steps has been reached. - !! The driver will adjust the time step as needed, and attempt to recover - !! from failed steps by decreasing the time step if necessary. The minimum - !! and maximum step sizes (HMIN/HMAX) can be specified; if not, there is no - !! limit. The maximum number of attempts (MTRY) at a time step can also be - !! specified; it defaults to a reasonable value. The integration status is - !! returned in STATUS; the possible values from IDAESOL are exported (see - !! above). The input value of HNEXT is the initial time step the driver - !! will attempt to use. Its return value is the time step the driver would - !! use on the next step if it were continuing to integrate. For the first - !! call, HNEXT should be set to the (user-specified) initial time step, but - !! thereafter the return value should normally be used for the next call. - !! It permissible to change it, but there is little reason to do so in this - !! multi-step driver scenario. - - subroutine integrate (this, hnext, status, nstep, tout, hmin, hmax, mtry) - - class(HC_solver), intent(inout) :: this - real(r8), intent(inout) :: hnext - integer, intent(out) :: status - integer, intent(in), optional :: nstep, mtry - real(r8), intent(in), optional :: tout, hmin, hmax - - call this%integ%integrate (hnext, status, nstep, tout, hmin, hmax, mtry) - - end subroutine integrate - - !! This auxiliary procedure computes the consistent initial state (u, du/dt) - !! given the initial cell temperatures. For a typical explicit ODE system - !! du/dt = F(t,u) this is trivial; u is given and F evaluated to get du/dt. - !! However for our implicit index-1 DAE system F(t,u,du/dt) = 0 this is much - !! more involved. We are only given part of u; the remaining part must - !! obtained by solving the algebraic equation portion of the DAE system. - !! Furthermore F=0 only defines du/dt for the cell enthalpies; the remaining - !! time derivatives must be solved for (by differentiating F=0 with respect - !! to time) or approximated (which we do here). - !! - !! NB: the time step DT is used to approximate the time derivatives of the - !! cell and face temperatures. The current integration algorithm uses FE - !! to get an initial guess for either a BDF1 or trapezoid starting step. - !! Consequently, the best choice of DT would be the initial time step, as - !! this will give a predicted state that is exactly consistent. - - subroutine compute_initial_state (model, t, temp, dt, u, udot, stat, errmsg) - - use HC_AE_solver_type - use parameter_list_type - - class(HC_model), intent(inout), target :: model - real(r8), intent(in) :: t, temp(:), dt - real(r8), intent(out), target :: u(:), udot(:) - integer, intent(out) :: stat - character(:), allocatable, intent(out) :: errmsg - - type(HC_AE_solver) :: solver - real(r8), allocatable, target :: f(:) - real(r8), pointer :: u1(:), u2(:), u3(:), f1(:), f2(:), f3(:), hdot(:) - type(parameter_list), pointer :: params - - ASSERT(size(temp) == model%mesh%ncell) - ASSERT(size(u) == model%num_dof()) - ASSERT(size(udot) == size(u)) - - call model%get_cell_heat_view (u, u1) ! enthalpy - call model%get_cell_temp_view (u, u2) ! cell temp - call model%get_face_temp_view (u, u3) ! face temp - - u2 = temp ! set the cell temperatures from the input - call model%H_of_T (u2, u1) ! compute the cell enthalpy - - !! Solve for the face temperatures. - allocate(params) - call params%set ('max-iter', 100) !TODO: expose as input - call params%set ('rel-tol', 1.0d-6) !TODO: expose as input - call solver%init (model, params) - u3 = 0.0_r8 ! initial guess (we could do much better) - call solver%solve (t, u2, u3, stat, errmsg) - if (stat /= 0) then - errmsg = 'face temp solve 1: ' // errmsg - return - end if - - !! The DAE system F(t,u,udot) = 0 gives the time derivative of the cell - !! enthalpy as a a function of the cell and face temperatures. We back - !! out what it is by computing F with udot set equal 0. The info is - !! contained in the cell temperature section of F. By construction, the - !! the remaining sections should be zero (the cell enthalpy section to - !! round-off, and the face temperature section to the solver tolerance). - - allocate(f(size(u))) - call model%get_cell_heat_view (f, f1) ! enthalpy / enthalpy-temp AE - call model%get_cell_temp_view (f, f2) ! cell temp / heat conduction DE - call model%get_face_temp_view (f, f3) ! face temp / face-cell temp AE - - udot = 0.0_r8 - call model%residual (t, u, udot, f) - - call model%get_cell_heat_view (udot, hdot) - hdot = -f2 / model%mesh%volume - - !! The time derivative of the cell and face temperatures are approximated - !! by a finite difference. The enthalpy is advanced by a small time step - !! using its time derivative (forward Euler), and then associated advanced - !! cell and face temperatures are solved for using the algebraic relations. - - f1 = u1 + dt*hdot ! advance the enthalpy - call model%T_of_H (f1, f2) ! compute cell temperature - f3 = u3 ! initial guess (probably not half bad) - call solver%solve (t+dt, f2, f3, stat, errmsg) ! compute face temperature - if (stat /= 0) then - errmsg = 'face temp solve 2: ' // errmsg - return - end if - - f2 = (f2 - u2) / dt - call model%set_cell_temp (f2, udot) - - f3 = (f3 - u3) / dt - call model%set_face_temp (f3, udot) - - deallocate(params) - -#ifdef DEBUG - call model%residual (t, u, udot, f) - print *, '||f1||_max =', maxval(abs(f1)) - print *, '||f2||_max =', maxval(abs(f2)) - print *, '||f3||_max =', maxval(abs(f3)) -#endif - end subroutine compute_initial_state - -! subroutine advance_state (this, t, hnext, stat) -! -! use logging_services -! use string_utilities, only: i_to_c -! -! class(HC_solver), intent(inout) :: this -! real(r8), intent(in) :: t -! real(r8), intent(out) :: hnext -! integer, intent(out) :: stat -! -! call this%solver%step (t, this%u, hnext, stat) -! -! if (stat == 0) then -! this%t = t -! this%state_is_pending = .true. -! else -! this%state_is_pending = .false. -! select case (stat) -! case (1) -! call LS_info ('HC_SOLVER: step rejected: excessive predictor error', LS_VERB_NOISY) -! case (2) -! call LS_info ('HC_SOLVER: step failed: nonlinear iteration failure', LS_VERB_NOISY) -! case (3) -! call LS_info ('HC_SOLVER: step failed: inadmissable predicted solution', LS_VERB_NOISY) -! case default -! call LS_info ('HC_SOLVER: step failed: unrecognized status: '//i_to_c(stat), LS_VERB_NOISY) -! end select -! end if -! -! end subroutine advance_state -! -! subroutine commit_pending_state (this) -! class(HC_solver), intent(inout) :: this -! INSIST(this%state_is_pending) -! call this%solver%commit_state (this%t, this%u) -! this%state_is_pending = .false. -! end subroutine commit_pending_state - -end module HC_solver_type diff --git a/src/hc/test/CMakeLists.txt b/src/hc/test/CMakeLists.txt deleted file mode 100644 index 666e3bf..0000000 --- a/src/hc/test/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -project(PececilloHCTest) - -include(CTest) - -# Want test modules in the build directory. -unset(CMAKE_Fortran_MODULE_DIRECTORY) - -include_directories(${Pececillo_MODULE_DIR}) - -add_executable(test_HC_AE_solver_type test_HC_AE_solver_type.F90) -target_link_libraries(test_HC_AE_solver_type pececillo-hc) -add_test(hypre_HC_AE_solver test_HC_AE_solver_type) diff --git a/src/hc/test/test_HC_AE_solver_type.F90 b/src/hc/test/test_HC_AE_solver_type.F90 deleted file mode 100644 index 83a60ee..0000000 --- a/src/hc/test/test_HC_AE_solver_type.F90 +++ /dev/null @@ -1,218 +0,0 @@ -program test_HC_AE_solver_type - - use kinds, only: r8 - use unstr_mesh_type - use unstr_mesh_factory - use unstr_mesh_gmv - use mfd_disc_type - use HC_model_type - use HC_AE_solver_type - use parameter_list_type - use logging_services - use,intrinsic :: iso_fortran_env, only: output_unit -#ifdef NAGFOR - use,intrinsic :: f90_unix, only: exit -#endif - implicit none - - integer :: status = 0 - - call LS_initialize ([output_unit], LS_VERB_NOISY) - - call test1 - call test2 - call exit (status) - -contains - - !! Regular grid. Should recover test function to machine epsilon, but - !! only a single CG iteration. - - subroutine test1 - - type(unstr_mesh), pointer :: mesh - type(mfd_disc), target :: disc - type(HC_model), target :: model - type(HC_AE_solver) :: solver - type(parameter_list), pointer :: HC_params, PCG_params, plist - real(r8), allocatable :: ucell(:), uface(:), uface_ref(:) - real(r8) :: xc(3), error - integer :: n, j, stat - character(:), allocatable :: errmsg - - !! 2D mesh on [0,1]^2 (one cell thick in z) - mesh => new_unstr_mesh([0.0_r8, 0.0_r8, 0.0_r8], [1.0_r8, 1.0_r8, 0.1_r8], [5,8,1]) - call disc%init (mesh) - - !! Instantiate the HC model... - !! First define the HC parameter list. Only conductivity and the BC are - !! significant. Our test function is u(x,y) = 2x + y. Cell values will - !! be set using this function and we aim to recover matching face values - !! and so need to set BC consistent with that. - allocate(HC_params) - call HC_params%set ('density', 2.0_r8) - call HC_params%set ('specific-heat', 0.25_r8) - call HC_params%set ('conductivity', 0.5_r8) - !! Dirichlet BC on the left and bottom - plist => HC_params%sublist ('bc') - plist => plist%sublist ('left-bottom') - call plist%set ('condition', 'dirichlet') - call plist%set ('face-sets', [1,3]) - plist => plist%sublist('data-function') - call plist%set ('type', 'polynomial') - call plist%set ('poly-coef', [2.0_r8, 1.0_r8]) - call plist%set ('poly-powers', reshape([0,1,0, 0,0,1],shape=[3,2])) - !! Flux BC on the right - plist => HC_params%sublist ('bc') - plist => plist%sublist ('right') - call plist%set ('condition', 'flux') - call plist%set ('face-sets', [2]) - call plist%set ('data-constant', -1.0_r8) - !! Flux BC on the top - plist => HC_params%sublist ('bc') - plist => plist%sublist ('top') - call plist%set ('condition', 'flux') - call plist%set ('face-sets', [4]) - call plist%set ('data-constant', -0.5_r8) - !! Symmetry BC on the z=const boundaries - plist => HC_params%sublist ('bc') - plist => plist%sublist ('symmetry') - call plist%set ('condition', 'flux') - call plist%set ('face-sets', [5,6]) - call plist%set ('data-constant', 0.0_r8) - !! Now create the HC model. - call model%init (disc, HC_params) - - !! Instantiate the face solver. - allocate(PCG_params) - call PCG_params%set ('rel-tol', 1.0d-12) - call PCG_params%set ('max-iter', 50) - !call PCG_params%set ('error tolerance', 1.0d-12) - !call PCG_params%set ('max iterations', 100) - !call PCG_params%set ('num cycles', 1) - !call PCG_params%set ('print level', 2) - !call PCG_params%set ('debug level', 0) - !call PCG_params%set ('logging level', 1) - call solver%init (model, PCG_params) - - !! Define cell values and initial guess for face values - allocate(ucell(mesh%ncell), uface(mesh%nface), uface_ref(mesh%nface)) - do j = 1, mesh%ncell - xc = sum(mesh%x(:,mesh%cnode(:,j)),dim=2) / size(mesh%cnode,1) - ucell(j) = 2*xc(1) + xc(2) - end do - call random_number (uface) ! initial guess - - call solver%solve (0.0_r8, ucell, uface, stat, errmsg) - if (stat /= 0) then - status = 1 - write(*,'(a,es9.2)') 'test1: solver returned an error: ', errmsg - end if - - !! Compare solution to expected values. - do j = 1, mesh%nface - xc = sum(mesh%x(:,mesh%fnode(:,j)),dim=2) / size(mesh%fnode,1) - uface_ref(j) = 2*xc(1) + xc(2) - end do - error = maxval(abs(uface-uface_ref)) - write(*,'(a,es9.2)') 'test1: ||uface-uface_ref||_max =', error - if (error > 1.0e-15) then - status = 1 - write(*,'(a)') 'test1: error exceeds tolerance' - end if - - end subroutine - - !! Similar problem but with a randomized mesh to make CG do some work. - !! Can no longer recover test function exactly because of nonorthog mesh. - - subroutine test2 - - type(unstr_mesh), pointer :: mesh - type(mfd_disc), target :: disc - type(HC_model), target :: model - type(HC_AE_solver) :: solver - type(parameter_list), pointer :: HC_params, PCG_params, plist - real(r8), allocatable :: ucell(:), uface(:), uface_ref(:) - real(r8) :: xc(3), error - integer :: n, j, stat - character(:), allocatable :: errmsg - - !! 3D mesh on [0,1]^3 - mesh => new_unstr_mesh([real(r8)::0,0,0], [real(r8)::1,1,1], [17,15,16], eps=0.001_r8) - call disc%init (mesh) - - !! Instantiate the HC model... - !! First define the HC parameter list. Only conductivity and the BC are - !! significant. Our test function is u(x,y,z) = x + 2y - 4z. Cell values - !! will be set using this function and we aim to recover matching face - !! values and so need to set BC consistent with that. - allocate(HC_params) - call HC_params%set ('density', 2.0_r8) - call HC_params%set ('specific-heat', 0.25_r8) - call HC_params%set ('conductivity', 0.5_r8) - !! Dirichlet BC on the left, front, and bottom - plist => HC_params%sublist ('bc') - plist => plist%sublist ('left-bottom') - call plist%set ('condition', 'dirichlet') - call plist%set ('face-sets', [1,3,5]) - plist => plist%sublist('data-function') - call plist%set ('type', 'polynomial') - call plist%set ('poly-coef', [1.0_r8, 2.0_r8, -4.0_r8]) - call plist%set ('poly-powers', reshape([0,1,0,0, 0,0,1,0, 0,0,0,1],shape=[4,3])) - !! Flux BC on the right - plist => HC_params%sublist ('bc') - plist => plist%sublist ('right') - call plist%set ('condition', 'flux') - call plist%set ('face-sets', [2]) - call plist%set ('data-constant', -0.5_r8) - !! Flux BC on the back - plist => HC_params%sublist ('bc') - plist => plist%sublist ('back') - call plist%set ('condition', 'flux') - call plist%set ('face-sets', [4]) - call plist%set ('data-constant', -1.0_r8) - !! Flux BC on the top - plist => HC_params%sublist ('bc') - plist => plist%sublist ('symmetry') - call plist%set ('condition', 'flux') - call plist%set ('face-sets', [6]) - call plist%set ('data-constant', 2.0_r8) - !! Now create the HC model. - call model%init (disc, HC_params) - - !! Instantiate the face solver. - allocate(PCG_params) - call PCG_params%set ('rel-tol', 1.0d-12) - call PCG_params%set ('max-iter', 50) - call solver%init (model, PCG_params) - - !! Define cell values and initial guess for face values - allocate(ucell(mesh%ncell), uface(mesh%nface), uface_ref(mesh%nface)) - do j = 1, mesh%ncell - xc = sum(mesh%x(:,mesh%cnode(:,j)),dim=2) / size(mesh%cnode,1) - ucell(j) = xc(1) + 2*xc(2) - 4*xc(3) - end do - call random_number (uface) ! initial guess - - call solver%solve (0.0_r8, ucell, uface, stat, errmsg) - if (stat /= 0) then - status = 1 - write(*,'(a,es9.2)') 'test2: solver returned an error: ', errmsg - end if - - !! Compare solution to expected values. - do j = 1, mesh%nface - xc = sum(mesh%x(:,mesh%fnode(:,j)),dim=2) / size(mesh%fnode,1) - uface_ref(j) = xc(1) + 2*xc(2) - 4*xc(3) - end do - error = maxval(abs(uface-uface_ref)) - write(*,'(a,es9.2)') 'test2: ||uface-uface_ref||_max =', error - if (error > 1.0e-4) then - status = 1 - write(*,'(a)') 'test2: error exceeds tolerance' - end if - - end subroutine - -end program test_HC_AE_solver_type diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 37e9f3f..0059a0c 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -1,13 +1,4 @@ -project(Pececillo-Lib) - -# # This contains utilities for the flow solver -# add_subdirectory(flow) - -include_directories(${Pececillo_SOURCE_DIR}/src/lib) -include_directories(${Pececillo_MODULE_DIR} ${Petaca_MODULE_DIR}) -include_directories(${HYPRE_INCLUDE_DIRS}) - -set(Pececillo_SOURCE_FILES +set(SRC # General utilities f90_assert.F90 kinds.F90 @@ -133,9 +124,30 @@ set(Pececillo_SOURCE_FILES unstr_mesh_gmv.F90 ) -add_library(pececillo ${Pececillo_SOURCE_FILES}) -add_dependencies(pececillo hypre) -target_link_libraries(pececillo petaca ${HYPRE_LIBRARIES} exodus lapack) -install(TARGETS pececillo DESTINATION lib) +set(HEADERS f90_assert.fpp) + +add_library(pec_core ${SRC} ${HEADERS}) +add_library(pececillo::core ALIAS pec_core) + +set(LIB_MOD_DIR ${CMAKE_CURRENT_BINARY_DIR}/mod_files/) +set_target_properties(pec_core PROPERTIES Fortran_MODULE_DIRECTORY ${LIB_MOD_DIR}) + +target_link_libraries(pec_core petaca hypre exodus lapack) + +target_include_directories(pec_core PUBLIC + $ + $ + $ +) + +install(TARGETS pec_core + EXPORT pec_core + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) +install(DIRECTORY ${LIB_MOD_DIR} DESTINATION include) +install(FILES ${HEADERS} DESTINATION include) -add_subdirectory(test) +# if(ENABLE_TESTS) +# add_subdirectory(test) +# endif() diff --git a/petaca/COPYRIGHT b/src/petaca/COPYRIGHT similarity index 100% rename from petaca/COPYRIGHT rename to src/petaca/COPYRIGHT diff --git a/petaca/README b/src/petaca/README similarity index 100% rename from petaca/README rename to src/petaca/README diff --git a/petaca/TODO b/src/petaca/TODO similarity index 100% rename from petaca/TODO rename to src/petaca/TODO diff --git a/src/petaca/cmake/Modules/FindYAJL.cmake b/src/petaca/cmake/Modules/FindYAJL.cmake new file mode 100644 index 0000000..06b83d0 --- /dev/null +++ b/src/petaca/cmake/Modules/FindYAJL.cmake @@ -0,0 +1,54 @@ +# This module finds the YAJL library and include file directory. +# YAJL_FOUND is set to True if both are found, and the following +# variables are returned. +# +# YAJL_INCLUDE_DIRS +# YAJL_LIBRARIES +# YAJL_VERSION +# +# This module also defines the imported library target "yajl". It is +# generally enough to include "yajl" as a target link library; cmake +# will automatically handle adding the appropriate compile include flags +# and collection of link libraries. +# +# Set the variable CMAKE_PREFIX_PATH to provide a hint to the module for +# where to find the library and header file. This is searched before the +# standard system locations. + +find_path(YAJL_INCLUDE_DIR yajl/yajl_common.h) +find_library(YAJL_LIBRARY NAMES yajl yajl_s) + +if(NOT YAJL_VERSION) + if(YAJL_INCLUDE_DIR AND YAJL_LIBRARY) + set(yajl_version_h ${YAJL_INCLUDE_DIR}/yajl/yajl_version.h) + include(SearchHeaderFile) + search_header_file(${yajl_version_h} "YAJL_MAJOR" _major) + search_header_file(${yajl_version_h} "YAJL_MINOR" _minor) + search_header_file(${yajl_version_h} "YAJL_MICRO" _micro) + set(YAJL_VERSION ${_major}.${_minor}.${_micro}) + unset(_major) + unset(_minor) + unset(_micro) + unset(yajl_version_h) + else() + set(YAJL_VERSION YAJL_VERSION-NOTFOUND) + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(YAJL + REQUIRED_VARS YAJL_LIBRARY YAJL_INCLUDE_DIR + VERSION_VAR YAJL_VERSION) + +if(YAJL_FOUND) + set(YAJL_INCLUDE_DIRS ${YAJL_INCLUDE_DIR}) + set(YAJL_LIBRARIES ${YAJL_LIBRARY}) + mark_as_advanced(YAJL_INCLUDE_DIR YAJL_LIBRARY) + if(NOT TARGET yajl) + add_library(yajl UNKNOWN IMPORTED) + set_target_properties(yajl PROPERTIES + IMPORTED_LOCATION "${YAJL_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${YAJL_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${YAJL_LIBRARIES}") + endif() +endif() diff --git a/petaca/cmake/Modules/NAGFortranCompilerVersion.cmake b/src/petaca/cmake/Modules/NAGFortranCompilerVersion.cmake similarity index 100% rename from petaca/cmake/Modules/NAGFortranCompilerVersion.cmake rename to src/petaca/cmake/Modules/NAGFortranCompilerVersion.cmake diff --git a/src/petaca/cmake/Modules/SearchHeaderFile.cmake b/src/petaca/cmake/Modules/SearchHeaderFile.cmake new file mode 100644 index 0000000..1f2f2a4 --- /dev/null +++ b/src/petaca/cmake/Modules/SearchHeaderFile.cmake @@ -0,0 +1,14 @@ +function(search_header_file config_h defmacro outvar) + cmake_parse_arguments(search_header_file "STRIP_QUOTES" "" "" ${ARGN}) + if(EXISTS "${config_h}") + set(_regexp "^#define[ \t]+${defmacro}[ \t]+") + file(STRINGS "${config_h}" _string REGEX "${_regexp}") + string(REGEX REPLACE "${_regexp}(.+)$" "\\1" _string "${_string}") + if(search_header_file_STRIP_QUOTES) + string(REPLACE "\"" "" _string "${_string}") + endif() + else() + set(_string ${outvar}-NOTFOUND) + endif() + set(${outvar} ${_string} PARENT_SCOPE) +endfunction() diff --git a/petaca/doc/documentation.template b/src/petaca/doc/documentation.template similarity index 100% rename from petaca/doc/documentation.template rename to src/petaca/doc/documentation.template diff --git a/petaca/doc/fortran_dynamic_loader.pdf b/src/petaca/doc/fortran_dynamic_loader.pdf similarity index 100% rename from petaca/doc/fortran_dynamic_loader.pdf rename to src/petaca/doc/fortran_dynamic_loader.pdf diff --git a/petaca/doc/fortran_dynamic_loader.tex b/src/petaca/doc/fortran_dynamic_loader.tex similarity index 100% rename from petaca/doc/fortran_dynamic_loader.tex rename to src/petaca/doc/fortran_dynamic_loader.tex diff --git a/petaca/doc/map_any_type.pdf b/src/petaca/doc/map_any_type.pdf similarity index 100% rename from petaca/doc/map_any_type.pdf rename to src/petaca/doc/map_any_type.pdf diff --git a/petaca/doc/map_any_type.tex b/src/petaca/doc/map_any_type.tex similarity index 100% rename from petaca/doc/map_any_type.tex rename to src/petaca/doc/map_any_type.tex diff --git a/petaca/doc/parameter_lists.pdf b/src/petaca/doc/parameter_lists.pdf similarity index 100% rename from petaca/doc/parameter_lists.pdf rename to src/petaca/doc/parameter_lists.pdf diff --git a/petaca/doc/parameter_lists.tex b/src/petaca/doc/parameter_lists.tex similarity index 100% rename from petaca/doc/parameter_lists.tex rename to src/petaca/doc/parameter_lists.tex diff --git a/petaca/doc/secure_hash.tex b/src/petaca/doc/secure_hash.tex similarity index 100% rename from petaca/doc/secure_hash.tex rename to src/petaca/doc/secure_hash.tex diff --git a/petaca/doc/state_history_type.pdf b/src/petaca/doc/state_history_type.pdf similarity index 100% rename from petaca/doc/state_history_type.pdf rename to src/petaca/doc/state_history_type.pdf diff --git a/petaca/doc/state_history_type.tex b/src/petaca/doc/state_history_type.tex similarity index 100% rename from petaca/doc/state_history_type.tex rename to src/petaca/doc/state_history_type.tex diff --git a/petaca/doc/timer_tree.pdf b/src/petaca/doc/timer_tree.pdf similarity index 100% rename from petaca/doc/timer_tree.pdf rename to src/petaca/doc/timer_tree.pdf diff --git a/petaca/doc/timer_tree.tex b/src/petaca/doc/timer_tree.tex similarity index 100% rename from petaca/doc/timer_tree.tex rename to src/petaca/doc/timer_tree.tex diff --git a/petaca/doc/yajl_fort.pdf b/src/petaca/doc/yajl_fort.pdf similarity index 100% rename from petaca/doc/yajl_fort.pdf rename to src/petaca/doc/yajl_fort.pdf diff --git a/petaca/doc/yajl_fort.tex b/src/petaca/doc/yajl_fort.tex similarity index 100% rename from petaca/doc/yajl_fort.tex rename to src/petaca/doc/yajl_fort.tex diff --git a/petaca/examples/map_any_type/example.F90 b/src/petaca/examples/map_any_type/example.F90 similarity index 100% rename from petaca/examples/map_any_type/example.F90 rename to src/petaca/examples/map_any_type/example.F90 diff --git a/petaca/examples/parameter_list_type/json_input_example.F90 b/src/petaca/examples/parameter_list_type/json_input_example.F90 similarity index 100% rename from petaca/examples/parameter_list_type/json_input_example.F90 rename to src/petaca/examples/parameter_list_type/json_input_example.F90 diff --git a/petaca/examples/parameter_list_type/parameter_list_example.F90 b/src/petaca/examples/parameter_list_type/parameter_list_example.F90 similarity index 100% rename from petaca/examples/parameter_list_type/parameter_list_example.F90 rename to src/petaca/examples/parameter_list_type/parameter_list_example.F90 diff --git a/petaca/examples/timer_tree/timer_tree_example.F90 b/src/petaca/examples/timer_tree/timer_tree_example.F90 similarity index 100% rename from petaca/examples/timer_tree/timer_tree_example.F90 rename to src/petaca/examples/timer_tree/timer_tree_example.F90 diff --git a/petaca/examples/yajl-fort/data.json b/src/petaca/examples/yajl-fort/data.json similarity index 100% rename from petaca/examples/yajl-fort/data.json rename to src/petaca/examples/yajl-fort/data.json diff --git a/petaca/examples/yajl-fort/yajl_fort_emit_example.F90 b/src/petaca/examples/yajl-fort/yajl_fort_emit_example.F90 similarity index 100% rename from petaca/examples/yajl-fort/yajl_fort_emit_example.F90 rename to src/petaca/examples/yajl-fort/yajl_fort_emit_example.F90 diff --git a/petaca/examples/yajl-fort/yajl_fort_parse_example.F90 b/src/petaca/examples/yajl-fort/yajl_fort_parse_example.F90 similarity index 100% rename from petaca/examples/yajl-fort/yajl_fort_parse_example.F90 rename to src/petaca/examples/yajl-fort/yajl_fort_parse_example.F90 diff --git a/petaca/include/concatenate.h b/src/petaca/include/concatenate.h similarity index 100% rename from petaca/include/concatenate.h rename to src/petaca/include/concatenate.h diff --git a/petaca/include/f90_assert.fpp b/src/petaca/include/f90_assert.fpp similarity index 100% rename from petaca/include/f90_assert.fpp rename to src/petaca/include/f90_assert.fpp diff --git a/petaca/include/stringify.h b/src/petaca/include/stringify.h similarity index 100% rename from petaca/include/stringify.h rename to src/petaca/include/stringify.h diff --git a/petaca/src/f90_assert.F90 b/src/petaca/src/f90_assert.F90 similarity index 100% rename from petaca/src/f90_assert.F90 rename to src/petaca/src/f90_assert.F90 diff --git a/petaca/src/fortran_dynamic_loader.F90 b/src/petaca/src/fortran_dynamic_loader.F90 similarity index 100% rename from petaca/src/fortran_dynamic_loader.F90 rename to src/petaca/src/fortran_dynamic_loader.F90 diff --git a/petaca/src/json.F90 b/src/petaca/src/json.F90 similarity index 100% rename from petaca/src/json.F90 rename to src/petaca/src/json.F90 diff --git a/petaca/src/map_any_type.F90 b/src/petaca/src/map_any_type.F90 similarity index 100% rename from petaca/src/map_any_type.F90 rename to src/petaca/src/map_any_type.F90 diff --git a/petaca/src/parameter_entry_class.F90 b/src/petaca/src/parameter_entry_class.F90 similarity index 100% rename from petaca/src/parameter_entry_class.F90 rename to src/petaca/src/parameter_entry_class.F90 diff --git a/petaca/src/parameter_list_json.F90 b/src/petaca/src/parameter_list_json.F90 similarity index 100% rename from petaca/src/parameter_list_json.F90 rename to src/petaca/src/parameter_list_json.F90 diff --git a/petaca/src/parameter_list_type.F90 b/src/petaca/src/parameter_list_type.F90 similarity index 100% rename from petaca/src/parameter_list_type.F90 rename to src/petaca/src/parameter_list_type.F90 diff --git a/petaca/src/secure_hash/md5_hash_type.F90 b/src/petaca/src/secure_hash/md5_hash_type.F90 similarity index 100% rename from petaca/src/secure_hash/md5_hash_type.F90 rename to src/petaca/src/secure_hash/md5_hash_type.F90 diff --git a/petaca/src/secure_hash/reference-C-code/md5.c b/src/petaca/src/secure_hash/reference-C-code/md5.c similarity index 100% rename from petaca/src/secure_hash/reference-C-code/md5.c rename to src/petaca/src/secure_hash/reference-C-code/md5.c diff --git a/petaca/src/secure_hash/reference-C-code/md5.h b/src/petaca/src/secure_hash/reference-C-code/md5.h similarity index 100% rename from petaca/src/secure_hash/reference-C-code/md5.h rename to src/petaca/src/secure_hash/reference-C-code/md5.h diff --git a/petaca/src/secure_hash/reference-C-code/sha1.c b/src/petaca/src/secure_hash/reference-C-code/sha1.c similarity index 100% rename from petaca/src/secure_hash/reference-C-code/sha1.c rename to src/petaca/src/secure_hash/reference-C-code/sha1.c diff --git a/petaca/src/secure_hash/reference-C-code/sha1.h b/src/petaca/src/secure_hash/reference-C-code/sha1.h similarity index 100% rename from petaca/src/secure_hash/reference-C-code/sha1.h rename to src/petaca/src/secure_hash/reference-C-code/sha1.h diff --git a/petaca/src/secure_hash/reference-C-code/sha256.c b/src/petaca/src/secure_hash/reference-C-code/sha256.c similarity index 100% rename from petaca/src/secure_hash/reference-C-code/sha256.c rename to src/petaca/src/secure_hash/reference-C-code/sha256.c diff --git a/petaca/src/secure_hash/reference-C-code/sha256.h b/src/petaca/src/secure_hash/reference-C-code/sha256.h similarity index 100% rename from petaca/src/secure_hash/reference-C-code/sha256.h rename to src/petaca/src/secure_hash/reference-C-code/sha256.h diff --git a/petaca/src/secure_hash/reference-C-code/sha512.c b/src/petaca/src/secure_hash/reference-C-code/sha512.c similarity index 100% rename from petaca/src/secure_hash/reference-C-code/sha512.c rename to src/petaca/src/secure_hash/reference-C-code/sha512.c diff --git a/petaca/src/secure_hash/reference-C-code/sha512.h b/src/petaca/src/secure_hash/reference-C-code/sha512.h similarity index 100% rename from petaca/src/secure_hash/reference-C-code/sha512.h rename to src/petaca/src/secure_hash/reference-C-code/sha512.h diff --git a/petaca/src/secure_hash/secure_hash_class.F90 b/src/petaca/src/secure_hash/secure_hash_class.F90 similarity index 100% rename from petaca/src/secure_hash/secure_hash_class.F90 rename to src/petaca/src/secure_hash/secure_hash_class.F90 diff --git a/petaca/src/secure_hash/secure_hash_factory.F90 b/src/petaca/src/secure_hash/secure_hash_factory.F90 similarity index 100% rename from petaca/src/secure_hash/secure_hash_factory.F90 rename to src/petaca/src/secure_hash/secure_hash_factory.F90 diff --git a/petaca/src/secure_hash/sha1_hash_type.F90 b/src/petaca/src/secure_hash/sha1_hash_type.F90 similarity index 100% rename from petaca/src/secure_hash/sha1_hash_type.F90 rename to src/petaca/src/secure_hash/sha1_hash_type.F90 diff --git a/petaca/src/state_history_type.F90 b/src/petaca/src/state_history_type.F90 similarity index 100% rename from petaca/src/state_history_type.F90 rename to src/petaca/src/state_history_type.F90 diff --git a/petaca/src/timer_tree_type.F90 b/src/petaca/src/timer_tree_type.F90 similarity index 100% rename from petaca/src/timer_tree_type.F90 rename to src/petaca/src/timer_tree_type.F90 diff --git a/petaca/src/yajl_ext.c b/src/petaca/src/yajl_ext.c similarity index 100% rename from petaca/src/yajl_ext.c rename to src/petaca/src/yajl_ext.c diff --git a/petaca/src/yajl_fort.F90 b/src/petaca/src/yajl_fort.F90 similarity index 100% rename from petaca/src/yajl_fort.F90 rename to src/petaca/src/yajl_fort.F90 diff --git a/petaca/test/fortran_dynamic_loader/mylib.F90 b/src/petaca/test/fortran_dynamic_loader/mylib.F90 similarity index 100% rename from petaca/test/fortran_dynamic_loader/mylib.F90 rename to src/petaca/test/fortran_dynamic_loader/mylib.F90 diff --git a/petaca/test/fortran_dynamic_loader/test_fortran_dynamic_loader.F90 b/src/petaca/test/fortran_dynamic_loader/test_fortran_dynamic_loader.F90 similarity index 100% rename from petaca/test/fortran_dynamic_loader/test_fortran_dynamic_loader.F90 rename to src/petaca/test/fortran_dynamic_loader/test_fortran_dynamic_loader.F90 diff --git a/petaca/test/map_any_type/test_map_any_type.F90 b/src/petaca/test/map_any_type/test_map_any_type.F90 similarity index 100% rename from petaca/test/map_any_type/test_map_any_type.F90 rename to src/petaca/test/map_any_type/test_map_any_type.F90 diff --git a/petaca/test/parameter_list_type/test_any_matrix_type.F90 b/src/petaca/test/parameter_list_type/test_any_matrix_type.F90 similarity index 100% rename from petaca/test/parameter_list_type/test_any_matrix_type.F90 rename to src/petaca/test/parameter_list_type/test_any_matrix_type.F90 diff --git a/petaca/test/parameter_list_type/test_any_scalar_type.F90 b/src/petaca/test/parameter_list_type/test_any_scalar_type.F90 similarity index 100% rename from petaca/test/parameter_list_type/test_any_scalar_type.F90 rename to src/petaca/test/parameter_list_type/test_any_scalar_type.F90 diff --git a/petaca/test/parameter_list_type/test_any_vector_type.F90 b/src/petaca/test/parameter_list_type/test_any_vector_type.F90 similarity index 100% rename from petaca/test/parameter_list_type/test_any_vector_type.F90 rename to src/petaca/test/parameter_list_type/test_any_vector_type.F90 diff --git a/petaca/test/parameter_list_type/test_parameter_list_type.F90 b/src/petaca/test/parameter_list_type/test_parameter_list_type.F90 similarity index 100% rename from petaca/test/parameter_list_type/test_parameter_list_type.F90 rename to src/petaca/test/parameter_list_type/test_parameter_list_type.F90 diff --git a/petaca/test/secure_hash/test_secure_hash.F90 b/src/petaca/test/secure_hash/test_secure_hash.F90 similarity index 100% rename from petaca/test/secure_hash/test_secure_hash.F90 rename to src/petaca/test/secure_hash/test_secure_hash.F90 diff --git a/petaca/test/state_history_type/test_state_history_type.F90 b/src/petaca/test/state_history_type/test_state_history_type.F90 similarity index 100% rename from petaca/test/state_history_type/test_state_history_type.F90 rename to src/petaca/test/state_history_type/test_state_history_type.F90 diff --git a/petaca/test/timer_tree/test_timer_tree.F90 b/src/petaca/test/timer_tree/test_timer_tree.F90 similarity index 100% rename from petaca/test/timer_tree/test_timer_tree.F90 rename to src/petaca/test/timer_tree/test_timer_tree.F90 diff --git a/src/unit/CMakeLists.txt b/src/unit/CMakeLists.txt index b8c52aa..84125ca 100644 --- a/src/unit/CMakeLists.txt +++ b/src/unit/CMakeLists.txt @@ -1,9 +1,4 @@ -project(Pececillo-unit-tests) - -include_directories(${Pececillo_SOURCE_DIR}/src/lib) -include_directories(${Pececillo_MODULE_DIR} ${Petaca_MODULE_DIR}) - -set(SOURCE_FILES +set(SRC vof_io.F90 vof_init_test.F90 analytic_surface_type_test.F90 @@ -21,25 +16,26 @@ set(SOURCE_FILES bfgs_min_class_test.F90 unit_test.F90) -# Create a library (so we can unit test) -add_library(libpececillo-unit ${SOURCE_FILES}) -target_link_libraries(libpececillo-unit pececillo) - -# Add Support for OpenMP. This needs to be present in the CMakeFile -# that controls linking of the final executable. -# find_package(OpenMP) -# if (OPENMP_FOUND) -# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") -# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") -# set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_C_FLAGS}") -# endif() - - -# unit test driver -add_executable(pececillo-unit unit_test.F90) -target_link_libraries(pececillo-unit libpececillo-unit) - -#add_subdirectory(test) - -install(TARGETS pececillo-unit DESTINATION lib) -install(TARGETS pececillo-unit DESTINATION bin) +add_library(pec_parabfit ${SRC}) +add_library(pececillo::parabfit ALIAS pec_parabfit) + +set(LIB_MOD_DIR ${CMAKE_CURRENT_BINARY_DIR}/mod_files/) +set_target_properties(pec_parabfit PROPERTIES Fortran_MODULE_DIRECTORY ${LIB_MOD_DIR}) +target_link_libraries(pec_parabfit pececillo::core petaca) + +target_include_directories(pec_parabfit PUBLIC + $ + $ +) + +install(TARGETS pec_parabfit + EXPORT pec_parabfit + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) +install(DIRECTORY ${LIB_MOD_DIR} DESTINATION include) + +# Parabfit solver program +add_executable(pececillo-parabfit unit_test.F90) +target_link_libraries(pececillo-parabfit pececillo::parabfit) +install(TARGETS pececillo-parabfit DESTINATION bin)