diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000000000000000000000000000000000..f78e30c81f1c787e4d5748a0c624e561521f0922 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,14 @@ +{ + "name": "virtual-fluids-environment", + "extensions": [ + "mhutchie.git-graph", + "donjayamanne.githistory", + "twxs.cmake", + "ms-vscode.cpptools", + "visualstudioexptteam.vscodeintellicode", + "xaver.clang-format", + "notskm.clang-tidy" + ], + "runArgs": ["--gpus","all"], + "image": "git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu20_04:1.2" +} diff --git a/.gitignore b/.gitignore index 8708a2906743e7953fd79b8277927031b1f6a32d..182a78aa1f85b2b69ac85452b2d87fbd87e68e56 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ __pycache__/ # IDE .vscode/ +.devcontainer/ .sync/ .idea/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6f1e1c96574595578ec38151633e9360c1a51927..c985bc188d6466a77867e7958bffa34a01b334e8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -496,7 +496,6 @@ clang-tidy: - mkdir -p $CI_PROJECT_DIR/build - cd $CI_PROJECT_DIR/build - cmake .. - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_VF_CPU=ON -DBUILD_VF_GPU=OFF - python3 ../utilities/filterCompileCommands.py compile_commands.json diff --git a/AUTHORS.md b/AUTHORS.md index 00a5410811196462d6f808036be7feb5e74a102d..554a5f1614a41f8bf7528e24b13d0a8569cb210d 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -1,25 +1,28 @@ # AUTHORS VF has been developed essentially over the last fifteen years by various researchers at IRMB including (in alphabetical order): + +Damilola Adekanye, M.Sc. Dr. Benjamin Ahrenholz -M. Sc. Hussein Alihussein +Dr. Hussein Alihussein Dr. Sebastian Bindick -B. Sc. Aileen Brendel +Aileen Brendel, B.Sc. J.Prof. Dr. Martin Geier Dr. Sebastian Geller Dr. Ehsan Goraki Fard Dr. Jan Hegewald Dr. Christian Janßen -M. Sc. Konstantin Kutscher -M. Sc. Stephan Lenz +Prof. Dr.-Ing. habil. Manfred Krafczyk +Dr. Konstantin Kutscher +Dr. Stephan Lenz Dr. Jan Linxweiler -B. Sc. Lennard Lux -B. Sc. Sven Marcus -M. Sc. Sören Peters +Lennard Lux, B.Sc. +Sören Peters, M.Sc. +Sven Marcus, M.Sc. Dr. Hesameddin Safari Dr. Martin Schönherr Dipl.-Ing. Maik Stiebler Dr. Sören Textor (aka Freudiger) PD Dr. Jonas Tölke Dr. Sonja Uphoff -B. Sc. Anna Wellmann \ No newline at end of file +Anna Wellmann, M.Sc. diff --git a/CMakeLists.txt b/CMakeLists.txt index 163ec4f05ee8b12d7641f3856ae4640565101851..aef9cc07ee2f578385e3fc07e4f7fae40dbdae1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,6 +97,7 @@ IF( BUILD_VF_DOUBLE_ACCURACY ) list(APPEND VF_COMPILER_DEFINITION VF_DOUBLE_ACCURACY) ENDIF() +# set gpu features if(BUILD_VF_GPU OR BUILD_VF_GKS) include(CheckLanguage) check_language(CUDA) diff --git a/README.md b/README.md index e3dfe9b9ec569bbe3a106048f8c7c5a31f13449f..e762a1fafb43cb0657a25c17ee7f9df770d4f600 100644 --- a/README.md +++ b/README.md @@ -2,33 +2,33 @@ VirtualFluids (VF) is a research code developed at the Institute for Computational Modeling in Civil Engineering (iRMB). The code is a Computational Fluid Dynamics (CFD) solver based on the Lattice Boltzmann Method (LBM) for turbulent, thermal, multiphase and multicomponent flow problems as well as for multi-field problems such as Fluid-Structure-interaction including distributed pre- and postprocessing capabilities for simulations with more than 100 billion degrees of freedom. -## Getting Started -### Suported Platforms -VirtualFluids has been used on a variety of platforms: +## Getting Start +VirtualFluids is mainly supported on these two platforms: - Linux - - Mac OS X - Windows - - Cygwin + +VirtualFluids can also be build and used in a Docker image. An ubuntu development environment is located in the [container registry](https://git.rz.tu-bs.de/irmb/virtualfluids/container_registry). +An extensive guide about the usage and development in VirtualFluids with docker can be found [here](https://git.rz.tu-bs.de/irmb/virtualfluids/-/wikis/Getting-Start-with-the-development-of-VirtualFluids). + + +The following is a brief explanation of how to use it without Docker: ### Software Requirements - + - [CMake](https://cmake.org/) (minimum version 3.15) - C++ compiler with C++14 support - - [Paraview](https://www.paraview.org/) (most recent version) + - [Paraview](https://www.paraview.org/) for visualizations (most recent version) -with usage of the GPU: + +with usage of the GPU: - CUDA [developer.nvidia.com/cuda-zone](https://developer.nvidia.com/cuda-zone): * Minimum CUDA Version 9.0 * Minimum Compute Capability 3.0, because of maximal number of Blocks in x direction * Recommended Compute Capability 6.0, because of atomics for double precision floating point data (GKS only) - -### Contributing -To contribute to VirtualFluids please follow these [instructions](CONTRIBUTING.md). ### Build VirtualFluids ```shell -$ mkdir build -$ cd build +$ mkdir build && cd build ``` Pass the relevant [options](#options) to cmake. E.g. for the CPU part: @@ -41,11 +41,11 @@ Alternatively enable the options via the cmake-gui. ### <a id="options"></a> Options - BUILD_VF_CPU - Build VirtualFluids CPU variant -- BUILD_VF_GPU +- BUILD_VF_GPU - Build VirtualFluids GPU variant - BUILD_VF_UNIT_TESTS - Build VirtualFluids unit tests -- VF_DOUBLE_ACCURACY +- VF_DOUBLE_ACCURACY - GPU change between Double and Single Precision ### Result Files @@ -55,14 +55,15 @@ The CPU part generates a set of multiple output directories in the prescribed ou A GPU computation generates a the time series of output files directly in the output path. In Paraview these time series can be read directly. - +## Contributing +To contribute to VirtualFluids please follow these [instructions](CONTRIBUTING.md). ## Documentation The doxygen generated documentation can be found [here](https://irmb.gitlab-pages.rz.tu-bs.de/VirtualFluids_dev). ## Known Issues -If you notice any problems on your platform, please report an [issue](https://git.rz.tu-bs.de/irmb/virtualfluids/-/issues/new). +If you notice any problems on your platform, please report an [issue](https://git.rz.tu-bs.de/irmb/virtualfluids/-/issues/new). ## Authors diff --git a/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp b/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp index 321376c61b1245b8354c230e9f2f4ad84fd6e98c..565ce4ba9cd9c31d9ff3bb4b3e4f0fc32b4a58f0 100644 --- a/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp +++ b/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp @@ -68,7 +68,7 @@ LbmOrGks lbmOrGks = LBM; -const real L = 1.0; +// const real L = 1.0; const real velocity = 1.0; @@ -89,7 +89,7 @@ int setupDomain = 4; std::string path("D:/out/WTG_RUB"); //Mollok std::string inputPath("D:/out/WTG_RUB/input/"); -const uint timeStepStartOut = 0; +// const uint timeStepStartOut = 0; const uint timeStepOut = 10000; const uint timeStepEnd = 100000; @@ -127,7 +127,7 @@ void multipleLevel(const std::string& configPath) maxLevel = 5; viscosityLB = (real)3.75e-06; // LB units } else if (setupDomain == 2) { - dx = (real)1; + dx = (real)1; maxLevel = 3; viscosityLB = (real)1.5e-05; // LB units } else if (setupDomain == 3) { @@ -139,7 +139,7 @@ void multipleLevel(const std::string& configPath) maxLevel = 2; viscosityLB = (real)3.75e-06; // LB units } - + real x_min = 0.0; real x_max = 1250.0; real y_min = 0.0; @@ -165,14 +165,14 @@ void multipleLevel(const std::string& configPath) bool measureVeloProfilesOnly = false; // Two Components: true->DiffOn, false->DiffOff - bool diffOnOff = false; + // bool diffOnOff = false; // Resetting diff or flow field, e.g. after restart, do not reset diff/flow at start of measureRun ;-) - bool reset_diff = false; + // bool reset_diff = false; bool reset_flow = false; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - gridBuilder->addCoarseGrid(x_min, y_min, z_min, + gridBuilder->addCoarseGrid(x_min, y_min, z_min, x_max, y_max, z_max, dx); gridBuilder->setNumberOfLayers(0, 0); @@ -477,7 +477,7 @@ void addFineGrids(SPtr<MultipleGridBuilder> gridBuilder, uint &maxLevel, real &r } } } - } + } else if (setupDomain == 3) { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ // creates Cuboids (FG1 to FG2, lvl 1 to lvl 2) and add STLs (FG3 to FG4, lvl 3 to lvl 4) depending on maxLevel @@ -767,11 +767,11 @@ int main( int argc, char* argv[]) std::cout << "Log initialization failed: " << ex.what() << std::endl; } catch (const std::bad_alloc& e) - { + { VF_LOG_CRITICAL("Bad Alloc: {}", e.what()); } catch (const std::exception& e) - { + { VF_LOG_CRITICAL("exception: {}", e.what()); } catch (...) diff --git a/gpu.cmake b/gpu.cmake index 91204defc542e0c1360f64a9abb201f49444172a..eef54759cfbbd7dff9b6c81d9d79b2f0ef0d09b1 100644 --- a/gpu.cmake +++ b/gpu.cmake @@ -1,9 +1,3 @@ -if(BUILD_NUMERIC_TESTS) - set(CMAKE_CXX_STANDARD 17) -endif() - -############################################################# - IF( BUILD_VF_GKS ) # only use this with device of CC larger than 6.0 set(CMAKE_CUDA_FLAGS "-Xptxas=\"-v\"" CACHE STRING "" FORCE) diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h index 5c83ea7cb75e066eba0f424da0e5906dc9123136..ee5f07a02552bbb04e21be2b3abd5b7015f14144 100644 --- a/src/cpu/VirtualFluids.h +++ b/src/cpu/VirtualFluids.h @@ -140,8 +140,8 @@ #include <BoundaryConditions/SimpleSlipBCAlgorithm.h> #include <BoundaryConditions/RheologyPowellEyringModelNoSlipBCAlgorithm.h> #include <BoundaryConditions/RheologyBinghamModelVelocityBCAlgorithm.h> -#include <BoundaryConditions/MultiphaseNoSlipBCAlgorithm.h> -#include <BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.h> +#include <BoundaryConditions/MultiphaseNoSlipBCAlgorithm.h> +#include <BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.h> #include <BoundaryConditions/MultiphaseVelocityBCAdapter.h> #include <BoundaryConditions/MultiphaseVelocityBCAlgorithm.h> diff --git a/src/cpu/VirtualFluidsCore/CMakeLists.txt b/src/cpu/VirtualFluidsCore/CMakeLists.txt index 15cdceffd99515f84d60c4b6169e2da7e74ecfc3..a9ee657434ae6ace1fd85974d825469a9e038d68 100644 --- a/src/cpu/VirtualFluidsCore/CMakeLists.txt +++ b/src/cpu/VirtualFluidsCore/CMakeLists.txt @@ -22,12 +22,11 @@ IF(${USE_DEM_COUPLING}) ENDIF() if(BUILD_USE_OPENMP) - list(APPEND VF_LIBRARIES OpenMP::OpenMP_CXX) + list(APPEND VF_LIBRARIES OpenMP::OpenMP_CXX) endif() vf_add_library(BUILDTYPE static PUBLIC_LINK basics muparser ${VF_LIBRARIES} PRIVATE_LINK lbm mpi logger) - vf_get_library_name(library_name) target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/BoundaryConditions) diff --git a/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp b/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp index d2a7baee86607f7c99a30cf59910fa831ae4a7a9..85a01cd1f85cf3efc556dd176cb748fc947e972b 100644 --- a/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp +++ b/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp @@ -324,7 +324,7 @@ void BasicCalculator::interpolation(int startLevel, int maxInitLevel) ////////////////////////////////////////////////////////////////////////// void BasicCalculator::applyPreCollisionBC(int startLevel, int maxInitLevel) { - // startLevel bis maxInitLevel + // from startLevel to maxInitLevel for (int level = startLevel; level <= maxInitLevel; level++) { int size = (int)blocks[level].size(); #ifdef _OPENMP @@ -349,7 +349,7 @@ void BasicCalculator::applyPreCollisionBC(int startLevel, int maxInitLevel) ////////////////////////////////////////////////////////////////////////// void BasicCalculator::applyPostCollisionBC(int startLevel, int maxInitLevel) { - // startLevel bis maxInitLevel + // from startLevel to maxInitLevel for (int level = startLevel; level <= maxInitLevel; level++) { int size = (int)blocks[level].size(); #ifdef _OPENMP diff --git a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp index 9c52f5e0469ce5b6c6e08136f25d3c027d36bdbd..daed493b9cc1afddbd92acabcd551da0f463ea26 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp @@ -39,7 +39,6 @@ #include "Block3D.h" #include "BCArray3D.h" - #define PROOF_CORRECTNESS using namespace UbMath; diff --git a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.h index 3052f50e3e48925ed21a3c3af68cc2d247c88a02..aab4d669655efe5bd489feb3829da28e67aa9ecb 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.h @@ -79,7 +79,7 @@ protected: }; //////////////////////////////////////////////////////////////////////////////// -//! \brief forward chimera transformation \ref forwardInverseChimeraWithK +//! \brief forward chimera transformation \ref forwardInverseChimeraWithK //! Transformation from distributions to central moments according to Eq. (6)-(14) in //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a> //! Modified for lower round-off errors. @@ -112,7 +112,7 @@ inline void CumulantK17LBMKernel::backwardInverseChimeraWithK(LBMReal& mfa, LBMR mfb = m1; } //////////////////////////////////////////////////////////////////////////////// -//! \brief forward chimera transformation \ref forwardChimera +//! \brief forward chimera transformation \ref forwardChimera //! Transformation from distributions to central moments according to Eq. (6)-(14) in //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a> //! for \f$ K_{abc}=0 \f$. This is to avoid unnessary floating point operations. @@ -128,7 +128,7 @@ inline void CumulantK17LBMKernel::forwardChimera(LBMReal& mfa, LBMReal& mfb, LBM mfa = m1; } //////////////////////////////////////////////////////////////////////////////// -//! \brief backward chimera transformation \ref backwardChimera +//! \brief backward chimera transformation \ref backwardChimera //! Transformation from central moments to distributions according to Eq. (57)-(65) in //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a> //! for \f$ K_{abc}=0 \f$. This is to avoid unnessary floating point operations. diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h index 04fe8a819b143db8cc935fc893faa514805060a6..bdb443ee2e40bf53a60ebf61c249a8e80aedd4b3 100644 --- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h +++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h @@ -35,14 +35,13 @@ #define D3Q27SYSTEM_H #include <cmath> -#include <iostream> #include <string> +#include <iostream> #include "LBMSystem.h" #include "UbException.h" #include "UbMath.h" - //! \brief namespace for global system-functions namespace D3Q27System { @@ -148,7 +147,6 @@ static const int ET_BNW = 11; static const int ET_TSW = 12; static const int ET_BNE = 12; - ////////////////////////////////////////////////////////////////////////// // MACROSCOPIC VALUES /*=====================================================================*/ diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h index 5e211f87b3c5170589838bd71f8f7c22c2d4a431..d4c477dee5fbdaa4b66b3d0d3200d4cab761dc0f 100644 --- a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h @@ -53,7 +53,6 @@ public: public: LBMKernel(); - virtual ~LBMKernel() = default; virtual SPtr<LBMKernel> clone() = 0; diff --git a/src/cuda/CMakeLists.txt b/src/cuda/CMakeLists.txt index b3b37b213cab4bf0e562438264d5fea6eb4dc7b3..4d49cfedc903f3578b64916966405ea48bf28901 100644 --- a/src/cuda/CMakeLists.txt +++ b/src/cuda/CMakeLists.txt @@ -1,3 +1,3 @@ project(cuda LANGUAGES CUDA CXX) -vf_add_library(NAME cuda PUBLIC_LINK logger) +vf_add_library(NAME vf_cuda PUBLIC_LINK logger) diff --git a/src/gpu/VirtualFluids_GPU/CMakeLists.txt b/src/gpu/VirtualFluids_GPU/CMakeLists.txt index 14fdadba44069dbb098f8922b208397a609275af..3e40d54b4c4b4f188e6efb6a0b5bb3d2ed6bc3a2 100644 --- a/src/gpu/VirtualFluids_GPU/CMakeLists.txt +++ b/src/gpu/VirtualFluids_GPU/CMakeLists.txt @@ -5,8 +5,7 @@ if(MSVC) set(additional_libraries ws2_32 Traffic) # ws_32 throws an error on Phoenix endif() -vf_add_library(PUBLIC_LINK basics lbmCuda PRIVATE_LINK ${additional_libraries} GridGenerator MPI::MPI_CXX cuda) - +vf_add_library(PUBLIC_LINK basics lbmCuda PRIVATE_LINK ${additional_libraries} GridGenerator MPI::MPI_CXX vf_cuda) #SET(TPN_WIN32 "/EHsc") #https://stackoverflow.com/questions/6832666/lnk2019-when-including-asio-headers-solution-generated-with-cmake diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/RunLBMKernel.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/RunLBMKernel.cuh index ecfdb8e38bc5da02a473b6f2e67340963ed8b38a..558b4f333e7c92b372a5097aa4917dd6d1230a34 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/RunLBMKernel.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/RunLBMKernel.cuh @@ -41,7 +41,7 @@ __global__ void runKernel(KernelFunctor kernel, GPUKernelParameter kernelParamet DistributionWrapper distributionWrapper { kernelParameter.distributions, - kernelParameter.size_Mat, + (unsigned int)kernelParameter.size_Mat, kernelParameter.isEvenTimestep, k, kernelParameter.neighborX,