This code was tried to be written independent of the geometry and conditions. Therefore, some modifications and assumptions has been made.
-
It is observed that a cell can be a forbidden cell even if it has 2 neighbours. When a cell has fluid at its North and South at the same time (which causes overlapping of boundary conditions), the code gives error of forbidden cell.
-
Inflow and Outflow is assumed to be occur only horizontally (x-direction).
-
If domain has constant temperature at its boundaries, a new colour "5" added for pgm file and a new flag inside enum added as DIRICHLET.
-
In order to make the code independent of geometry and make the debugging easier all the boundary conditions implemented seperately for inner cells, left-right-top-bottom boundaries and four corners.
-
For the cases which include temperature calculations; T_h is assumed to be occur at the left and/or bottom boundary, T_c is assumed to be occur at the right and/or top boundary
A folder with a name "vtk" should be created inside build folder
The needed .dat files and .pgm files for each case can be found inside "Results/" folder respectively.
The .dat and .pgm files should be copied into build folder and the "sim" file should be run as follows:
Case a: Plane Shear Flow
Case b: The Karman Vortex Street
Case c: Flow over a Step
Case d: Natural Convection
Case e: Fluid Trap
Case f: Rayleigh-Benard Concevtion
Case g: Natural Convection 2
Example run:
./sim a
Changes in skeleton: inside helper.hpp/helper.cpp 1-) maxElementOfMatrix function was implemented to find maximum element of a matrix
In order for the code to be run, 1-) .dat file should be moved to build folder 2-) A folder with a name "vtk" should be created inside build folder
Code Skeleton for the CFD Lab taught at TUM Informatics
This repository contains:
- an example input file (
cavity100.dat), with100stemming from theitermax - the headers
- the files with the respective method stubs
Please fork this repository and add us as collaborators.
Find more information in the documentation.
- VTK 7 or higher
- GCC 9 (optional)
You can get you current version of GCC by running:
g++ -vIf you have GCC 9 or newer, you can set in the CMakeLists.txt file:
set(gpp9 True)If you have a version lower than 9, then you don't have to modify the CMakeLists.txt file.
This will affect how we are using the C++ filesystem library, which is available already in GCC 7 as an experimental feature.
apt-get update &&
apt-get upgrade -y &&
apt-get install -y build-essential cmake libvtk7-dev libfmt-dev
If you want, you can upgrade your compiler version to have access to more recent C++ features. This is, however, optional.
apt-get update &&
apt-get install -y software-properties-common &&
add-apt-repository -y ppa:ubuntu-toolchain-r/test &&
apt-get upgrade -y &&
apt-get install -y build-essential cmake libvtk7-dev libfmt-dev gcc-9 g++-9
apt-get install -y gcc-9 g++-9
CMake is a C++ build system generator, which simplifies the building process compared e.g. to a system-specific Makefile. The CMake configuration is defined in the CMakeList.txt file.
In order to build your code with CMake, you can follow this (quite common) procedure:
- Create a build directory:
mkdir build - Get inside it:
cd build - Configure and generate the build system:
cmake ..(Note the two dots, this means that theCmakeLists.txtFile is in the folder above) - Build your code:
make(build the executable)
You might run into a problem where the VTK library is not found. To fix this, you can try the following steps:
- Find the installation path of your VTK library
- Define this path as an environment variable, as e.g.
export VTK_DIR=".../lib/cmake/vtk-8.2" - Start in a clean build folder
- Run
cmake ..again
If you have multiple compiler versions installed you can set the GCC version which should be used by cmake like this:
export CXX=`which g++-7`Make sure to use a backtick (`) to get the which command executed. Afterwards, you can run cmake ...
The folder tests contains example files for simple unit testing with the Catch2 unit testing framework. The tests can be compiled using cmake as well.
After building, run:
ctest --verbose
With the verbose option you can get more details for failing tests.
The generate the documentation, run:
pip3 install --user mkdocs mkdocs-material
and then serve it to be able to access it through your browser:
mkdocs serve