diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..8a4ad7f2e84e410e3515a9f2530717956177daa1 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,11 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=auto + +# Explicitly declare text files you want to always be normalized and converted +# to native line endings on checkout. +*.c text +*.h text +*.cpp text +*.hpp text +*.cuh text +*.cu text diff --git a/CMake/FileUtilities.cmake b/CMake/FileUtilities.cmake index 23e256dfd85b91b1980d168c676ef6a1d2b758ea..4d42efcedd5d6a06d3d1ca12106e26c0ac875b93 100644 --- a/CMake/FileUtilities.cmake +++ b/CMake/FileUtilities.cmake @@ -6,16 +6,26 @@ ################################################################################# macro(includeAllFiles targetName file_path) - set(collectTestFiles ON) - set(collectProductionFiles ON) + if(NOT DEFINED collectTestFiles) + set(collectTestFiles ON) + endif() + + if(NOT DEFINED collectProductionFiles) + set(collectProductionFiles ON) + endif() includeFiles(${targetName} "${file_path}") endmacro(includeAllFiles) macro(includeProductionFiles targetName file_path) - set(collectTestFiles OFF) - set(collectProductionFiles ON) + if(NOT DEFINED collectTestFiles) + set(collectTestFiles OFF) + endif() + + if(NOT DEFINED collectProductionFiles) + set(collectProductionFiles ON) + endif() includeFiles(${targetName} "${file_path}") endmacro(includeProductionFiles) @@ -23,8 +33,13 @@ endmacro(includeProductionFiles) macro(includeTestFiles targetName file_paths) - set(collectTestFiles ON) - set(collectProductionFiles OFF) + if(NOT DEFINED collectTestFiles) + set(collectTestFiles ON) + endif() + + if(NOT DEFINED collectProductionFiles) + set(collectProductionFiles OFF) + endif() includeFiles(${targetName} "${file_paths}") endmacro(includeTestFiles) @@ -47,6 +62,9 @@ macro(includeFiles targetName file_paths) endforeach() + unset(collectTestFiles) + unset(collectProductionFiles) + endmacro(includeFiles) diff --git a/CMake/VirtualFluidsMacros.cmake b/CMake/VirtualFluidsMacros.cmake index 676353ea2c2e03f2f55e096948643f85f8b87ec0..cf0f24ec944883538749775ecbcdd4a43a370b3b 100644 --- a/CMake/VirtualFluidsMacros.cmake +++ b/CMake/VirtualFluidsMacros.cmake @@ -118,7 +118,6 @@ function(vf_add_library) includeProductionFiles (${library_name} "${sourceFiles}") - ################################################################# ### EXCECUTABLE ### ################################################################# diff --git a/CMake/compilerflags/AppleClang.cmake b/CMake/compilerflags/AppleClang.cmake index ef97a54a4ebe17bde5e016e04a40a187371172e9..f84d6f27ec4a28bb86ad224f86b2866037a6a2e9 100644 --- a/CMake/compilerflags/AppleClang.cmake +++ b/CMake/compilerflags/AppleClang.cmake @@ -14,11 +14,6 @@ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-O3;-fomit-frame-pointer; ############################################################################################################# LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-pthread") -############################################################################################################# -# c++ 11 support -############################################################################################################# -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-std=c++11") - # test #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_RELEASE "-Wall") @@ -31,11 +26,6 @@ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-deprecated") #deprec #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wbackslash-newline-escape") #backslash and newline separated by space LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wcomment") #'/*' within block comment -############################################################################################################# -# c++ 17 support -############################################################################################################# -#LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-std=c++17") -#LIST(APPEND CAB_COMPILER_ADDTIONAL_C_COMPILER_FLAGS "-std=c++17") #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-fext-numeric-literals") #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=0") diff --git a/CMake/compilerflags/GNU.cmake b/CMake/compilerflags/GNU.cmake index 08dc75adc01375fc35ddd46bc00ae539dce4c96c..54a11f02a661b85a80fb7ce7fe9cfb8c60b04b0d 100644 --- a/CMake/compilerflags/GNU.cmake +++ b/CMake/compilerflags/GNU.cmake @@ -10,16 +10,7 @@ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-deprecated") #deprec ############################################################################################################# LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-pthread") -############################################################################################################# -# c++ 11 support -############################################################################################################# -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-std=c++11") -############################################################################################################# -# c++ 17 support -############################################################################################################# -#LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-std=c++17") -#LIST(APPEND CAB_COMPILER_ADDTIONAL_C_COMPILER_FLAGS "-std=c++17") #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-fext-numeric-literals") #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=0") @@ -28,3 +19,5 @@ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-std=c++11") list(APPEND VF_LINK_OPTIONS -lgomp) list(APPEND VF_LINK_OPTIONS -lrt) + +list(APPEND VF_LINK_OPTIONS -ldl) diff --git a/CMake/compilerflags/Intel.cmake b/CMake/compilerflags/Intel.cmake index 4f4c7bb3ed2dad45a6f91e644fa0d74e5b4d98be..83cb9f74c500cc748a6a1e8c7440fa643d314451 100644 --- a/CMake/compilerflags/Intel.cmake +++ b/CMake/compilerflags/Intel.cmake @@ -24,11 +24,6 @@ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-xHOST;-O3;-ip;-fno-alias ############################################################################################################### #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-pthread") -############################################################################################################# -# c++ 11 support -############################################################################################################# -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-std=c++11") - list(APPEND VF_LINK_OPTIONS -parallel) list(APPEND VF_LINK_OPTIONS -irc) diff --git a/CMake/compilerflags/clang.cmake b/CMake/compilerflags/clang.cmake index 4e79d520c0b91a41d62f658092489941926bda05..4e473e381ff7d9dc36e0a910e4504d355fb0ca60 100644 --- a/CMake/compilerflags/clang.cmake +++ b/CMake/compilerflags/clang.cmake @@ -14,10 +14,6 @@ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-O3;-fomit-frame-pointer; ############################################################################################################# LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-pthread") -############################################################################################################# -# c++ 11 support -############################################################################################################# -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-std=c++11") ############################################################################################################# # disable warning @@ -26,11 +22,6 @@ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-deprecated") #deprec #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wbackslash-newline-escape") #backslash and newline separated by space LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wcomment") #'/*' within block comment -############################################################################################################# -# c++ 17 support -############################################################################################################# -#LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-std=c++17") -#LIST(APPEND CAB_COMPILER_ADDTIONAL_C_COMPILER_FLAGS "-std=c++17") #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-fext-numeric-literals") #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=0") diff --git a/CMakeLists.txt b/CMakeLists.txt index 01f46ac17ebe0a821ee6ba80489985591e604495..fbea2c2bdaca6f61428cffd6440d5eb3cddc0eaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,9 @@ project(VirtualFluids CXX) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CUDA_STANDARD 14) +set(CMAKE_CUDA_STANDARD_REQUIRED TRUE) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER ".cmake") set(libraryFolder "libs") @@ -45,6 +48,7 @@ option(BUILD_SHARED_LIBS "" ON) if(POLICY CMP0104) cmake_policy(SET CMP0104 NEW) set(CMAKE_CUDA_ARCHITECTURES 30) + # with cuda 11 the minimum architecture is 52 endif() ################################################################################# diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 54a3e307b64c14de7f540ca1e04209e7624465b8..4bf538b84b0211ada593913a556f10be0d6ed608 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,5 @@ -Contributing -============ +# Contributing + If you want to contribute to VirtualFluids, your help is very welcome. To contribute use a pull request as follows: @@ -23,3 +23,19 @@ To contribute use a pull request as follows: your extra branch(es). And last but not least: Always write your commit messages in the present tense. Your commit message should describe what the commit, when applied, does to the code – not what you did to the code. + +## Documentation + +To build sustainable research software, it is mandatory to document code. +Even if it turns out that some developments are not continued, documentation is important to help future scientists to learn from the own experiences. + +The documentation of the source code takes place… + +- in commit messages + - As it is possible to put all the information into the commit messages, we want to keep the messages short and on a higher level of abstraction. + - The commit message should briefly summarize what the commit does to the code. + +- in source code + - VirtualFluids is using Doxygen to generate Documentation from within the source code + - In most of the cases comment should describe ***why*** something was implemented and not ***how***. + - if available add formulars, references to scripts, paper, and all information you got linked to the implemented code diff --git a/docs/cpu/Documentation/doc.h b/docs/cpu/Documentation/doc.h index bdac8f8c3e0922cff1b31fead26d3c324a8647fe..0c6c4c6c30e7bc1a8691b52fa1555f2ea3d4d16b 100644 --- a/docs/cpu/Documentation/doc.h +++ b/docs/cpu/Documentation/doc.h @@ -1,31 +1,31 @@ -//index page for doxygen - -/*! \mainpage - * - * \section intro_sec Introduction - * <i>VirtualFluids</i> is an adaptive, parallel Lattice-Boltzmann flow solver - * which is comprised of various cores - * and use second order accurate compact interpolation at the interfaces, - * coupling grids of different resolutions. - * The software framework is based on object-oriented technology and uses tree-like data structures. - * These data structures are also suitable for hierarchical parallelization using a combination of PThreads and MPI and dynamic load balancing. - * - * \section install_sec Installation - * - * \subsection step1 Step 1: CMake - * Download and install <a href="http://www.cmake.org/">CMake</a>. - * If you have Windows OS oder X-Windows for Linux/Unix start <i>cmake-gui</i>. - * If you work in terminal start <i>ccmake</i>. - * \subsection step2 Step 2: project configuration - * You need set a path for <i>VirtualFluids</i> source code. It is allays <i>source</i> directory at the end of path. - * E.g. c:/vf/source. You need also set a path to build binaries. If you click <b>Configure</b> button start a project wizard and you can choose a compiler. - * Set <b>Grouped</b> and <b>Advanced</b> check boxes in CMake. In the group <i>USE</i> you have follow important options: - * \li USE_BOND - using an agent based communication framework for fault tolerance BOND - * \li USE_METIS - using a domain decomposition tool METIS - * \li USE_MPI - using MPI for distributed memory parallelization - * \li USE_YAML - using YAML - * \li USE_ZOLTAN - using domain decomposition tool ZOLTAN - * There are externals library and you need additionally compile them. - * \subsection step3 Step 4: project compilation - * Compile you project with suitable compiler. +//index page for doxygen + +/*! \mainpage + * + * \section intro_sec Introduction + * <i>VirtualFluids</i> is an adaptive, parallel Lattice-Boltzmann flow solver + * which is comprised of various cores + * and use second order accurate compact interpolation at the interfaces, + * coupling grids of different resolutions. + * The software framework is based on object-oriented technology and uses tree-like data structures. + * These data structures are also suitable for hierarchical parallelization using a combination of PThreads and MPI and dynamic load balancing. + * + * \section install_sec Installation + * + * \subsection step1 Step 1: CMake + * Download and install <a href="http://www.cmake.org/">CMake</a>. + * If you have Windows OS oder X-Windows for Linux/Unix start <i>cmake-gui</i>. + * If you work in terminal start <i>ccmake</i>. + * \subsection step2 Step 2: project configuration + * You need set a path for <i>VirtualFluids</i> source code. It is allays <i>source</i> directory at the end of path. + * E.g. c:/vf/source. You need also set a path to build binaries. If you click <b>Configure</b> button start a project wizard and you can choose a compiler. + * Set <b>Grouped</b> and <b>Advanced</b> check boxes in CMake. In the group <i>USE</i> you have follow important options: + * \li USE_BOND - using an agent based communication framework for fault tolerance BOND + * \li USE_METIS - using a domain decomposition tool METIS + * \li USE_MPI - using MPI for distributed memory parallelization + * \li USE_YAML - using YAML + * \li USE_ZOLTAN - using domain decomposition tool ZOLTAN + * There are externals library and you need additionally compile them. + * \subsection step3 Step 4: project compilation + * Compile you project with suitable compiler. */ \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.cpp index 342f2114309d0ed272aeda2fb17b77d763d9c58e..595907b5982ff6c1c1f53257b0850fd72450d798 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.cpp @@ -74,7 +74,7 @@ void VelocityBCAlgorithm::applyBC() const int invDir = D3Q27System::INVDIR[fdir]; LBMReal q = bcPtr->getQ(invDir); LBMReal velocity = bcPtr->getBoundaryVelocity(invDir); - LBMReal fReturn = f[invDir] - velocity; + LBMReal fReturn = f[invDir] - velocity; // TODO: compare with development distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir); } } diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h index fd232ff9a6e37694e04a1b81118bd90f3e7b47e6..6ecb10f02c86af013d6102e5a698486084bb8e67 100644 --- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h +++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h @@ -87,7 +87,6 @@ public: ObObject* clone() { throw UbException(UB_EXARGS,"not implemented"); } - void writeValidationAVSFile(std::string filename); virtual std::vector< std::pair<GbPoint3D,GbPoint3D> > getQsLineSet(); diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h index a3acab7d876889a658e08446b1556297dfb23842..f1c6c1c79a22124f5d3af7f088a0dfe155f7fd8e 100644 --- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h +++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h @@ -282,7 +282,6 @@ namespace D3Q27System static LBMReal getCompFeqForDirection(const int& direction, const LBMReal& drho,const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3) { using namespace UbMath; - LBMReal cu_sq=1.5*(vx1*vx1+vx2*vx2+vx3*vx3); ////----- diff --git a/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.h b/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.h index 6fa79a241c3df613ebb4a5b07f05071f93c7647c..c4cc092cc97fc3f5a287269958752ead2fb80a17 100644 --- a/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.h +++ b/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.h @@ -42,7 +42,7 @@ //! \details NullCommunicator is only a place-holder. It is only one process in shared memory. class NullCommunicator : public Communicator { - private: +private: NullCommunicator(); NullCommunicator( const NullCommunicator& ){} public: diff --git a/src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h b/src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h index 7f6f997520c56655fb105930e0fcafb07a053951..1102acac0d6c0fc761204ebb5e2463d00299e145 100644 --- a/src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h +++ b/src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h @@ -46,7 +46,7 @@ #include "stdlib.h" #include "stdio.h" #include "string.h" -#elif (defined(__amd64) || defined(__amd64__) || defined(__unix__)) && !defined(__AIX__) +#elif (defined(__amd64) || defined(__amd64__) || defined(__unix__) || defined(__CYGWIN__)) && !defined(__AIX__) #define MEMORYUTIL_LINUX #include "sys/types.h" #include "sys/sysinfo.h" @@ -80,7 +80,12 @@ namespace Utilities //Multiply in next statement to avoid int overflow on right hand side... totalPhysMem *= memInfo.mem_unit; #elif defined(MEMORYUTIL_APPLE) - long long totalPhysMem = 0; + int mib [] = { CTL_HW, HW_MEMSIZE }; + int64_t totalPhysMem; + size_t length = sizeof(totalPhysMem); + + if(sysctl(mib, 2, &totalPhysMem, &length, nullptr, 0) == -1) + return 0; #else #error "MemoryUtil::getTotalPhysMem - UnknownMachine" #endif @@ -142,12 +147,8 @@ namespace Utilities PROCESS_MEMORY_COUNTERS pmc; GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)); SIZE_T physMemUsedByMe = pmc.WorkingSetSize; - #elif defined(MEMORYUTIL_LINUX) + #elif defined(MEMORYUTIL_LINUX) || defined(MEMORYUTIL_APPLE) || defined(MEMORYUTIL_CYGWIN) long long physMemUsedByMe = (long long)getValue() * (long long)1024; - #elif defined(MEMORYUTIL_APPLE) - long long physMemUsedByMe = 0; - #elif defined(MEMORYUTIL_CYGWIN) - long long physMemUsedByMe = (long long)getValue() * (long long)1024; #else #error "MemoryUtil::getPhysMemUsedByMe - UnknownMachine" #endif