All Projects → hheinzer → ccfd

hheinzer / ccfd

Licence: GPL-3.0 license
A 2D finite volume CFD code, written in C

Programming Languages

c
50402 projects - #5 most used programming language
GLSL
2045 projects

Labels

Projects that are alternatives of or similar to ccfd

MAESTRO
A low Mach number stellar hydrodynamics code
Stars: ✭ 29 (+11.54%)
Mutual labels:  cfd
lettuce
Computational Fluid Dynamics based on PyTorch and the Lattice Boltzmann Method
Stars: ✭ 74 (+184.62%)
Mutual labels:  cfd
CFD
Basic Computational Fluid Dynamics (CFD) schemes implemented in FORTRAN using Finite-Volume and Finite-Difference Methods. Sample simulations and figures are provided.
Stars: ✭ 89 (+242.31%)
Mutual labels:  cfd
euler2d kokkos
Simple 2d finite volume solver for Euler equations using c++ kokkos library
Stars: ✭ 27 (+3.85%)
Mutual labels:  cfd
TrainingTracks
Materials for training tracks for continua media - OpenFOAM, vortex method, and other
Stars: ✭ 59 (+126.92%)
Mutual labels:  cfd
fosolvers
FOSolverS: a Suite of Free & Open Source Solvers. A brief overview:
Stars: ✭ 24 (-7.69%)
Mutual labels:  cfd
DLBFoam-1.0
DLBFoam: An open-source dynamic load balancing model for fast reacting flow simulations in OpenFOAM. https://doi.org/10.1016/j.cpc.2021.108073
Stars: ✭ 29 (+11.54%)
Mutual labels:  cfd
magic
MagIC is a high-performance code that solves the magneto-hydrodynamics equations in rotating spherical shells
Stars: ✭ 67 (+157.69%)
Mutual labels:  cfd
dafoam
DAFoam: Discrete Adjoint with OpenFOAM for High-fidelity Gradient-based Design Optimization
Stars: ✭ 86 (+230.77%)
Mutual labels:  cfd
2D-Elliptic-Mesh-Generator
2D orthogonal elliptic mesh generator which solves the Winslow partial differential equations
Stars: ✭ 36 (+38.46%)
Mutual labels:  cfd
hybridCentralSolvers
United collection of hybrid Central solvers - one-phase, two-phase and multicomponent versions
Stars: ✭ 42 (+61.54%)
Mutual labels:  cfd
CFD-collection
Computational fluid dynamics codes
Stars: ✭ 16 (-38.46%)
Mutual labels:  cfd
Omega2D
Two-dimensional flow solver with GUI using vortex particle and boundary element methods
Stars: ✭ 17 (-34.62%)
Mutual labels:  cfd
euler2D-kfvs-Fortran2003
2D solver for Euler equations in quadrilateral grid, using kinetic flux vector splitting scheme, written in OOP F2003
Stars: ✭ 17 (-34.62%)
Mutual labels:  cfd
SNaC
A multi-block solver for massively parallel direct numerical simulations (DNS) of fluid flows
Stars: ✭ 26 (+0%)
Mutual labels:  cfd
featool-multiphysics
FEATool - "Physics Simulation Made Easy" (Fully Integrated FEA, FEniCS, OpenFOAM, SU2 Solver GUI & Multi-Physics Simulation Platform)
Stars: ✭ 190 (+630.77%)
Mutual labels:  cfd
NGA2
Object-oriented multi-mesh version of the classic reacting turbulent multiphase flow solver
Stars: ✭ 25 (-3.85%)
Mutual labels:  cfd
Fluid2d
A versatile Python-Fortran CFD code that solves a large class of 2D flows
Stars: ✭ 49 (+88.46%)
Mutual labels:  cfd
Cfdpython
A sequence of Jupyter notebooks featuring the "12 Steps to Navier-Stokes" http://lorenabarba.com/
Stars: ✭ 2,180 (+8284.62%)
Mutual labels:  cfd
WABBIT
Wavelet Adaptive Block-Based solver for Interactions with Turbulence
Stars: ✭ 25 (-3.85%)
Mutual labels:  cfd

ccfd

The ccfd code is a drop-in replacement for cfdfv, a CFD code written in Fortran by the Institute of Aerodynamics and Gas Dynamics at the University of Stuttgart for a CFD programming course. This program uses CGNS, for storing the calculation results.

ccfd is a two-dimensional finite volume solver for the Euler- or Navier-Stokes-equation systems on structured or unstructured grids. It can perform 1st or 2nd order spacial and temporal discretization, with explicit Euler or Runge-Kutta integration, or implicit Krylov subspace iteration. The code runs on multiple threads using OpenMP parallel for loops, if compiled with -fopenmp.

Dependencies

  • git
  • gcc, or any other C compiler
  • make
  • cmake
  • gnuplot (optional, for displaying calculation residuals, available here)
  • gmsh (optional, for mesh generation, available here)
  • paraview (optional, for post-processing the results, available here)

Installation

The installation process is easiest on Linux, but possible on MacOS and Windows.

Linux

First make sure that all necessary dependencies are all installed. These can usually be obtained through your distributions package manager, on Arch based systems the following command should suffice

# pacman -S git base-devel cmake

For an Ubuntu based system the following command should be enough

# apt-get install git build-essential cmake libomp-dev

Next, navigate to the directory where you want to keep ccfd, clone the git repository and compile the code

$ cd path/to/directory
$ git clone https://github.com/hhh95/ccfd.git
$ cd ccfd
$ make

There should now be two new folders, obj and bin, the last one containing the ccfd executable.

You can test the compiled binary file, by executing the following command

$ make check

This will execute ccfd in the directory check on some small cases that test specific functions of the program.

Continue with Usage.

MacOS

I only had access to MacOS High Sierra, so some things might have changed, but the general procedure should still be the same on any MacOS version. First, install a package manager that can install all the necessary software for you. I suggest Homebrew. Head on over to their website and follow the installation instructions. Once you're done, install the necessary software to compile ccfd

$ brew update
$ brew upgrade
$ brew install git gcc make cmake libomp

Due to the fact, that on MacOS gcc is linked to clang per default, which does not work well with OpenMP, you will have to make a minor edit to the Makefile. Open the file with your favorite editor and find the line that defines the C compiler to be used

CC     = gcc

Replace gcc with the version that you have installed, most likely it is gcc-9. To find out which version you have, do the following

$ ls /usr/local/bin/gcc*

Next, navigate to the directory where you want to keep ccfd, clone the git repository and compile the code

$ cd path/to/directory
$ git clone https://github.com/hhh95/ccfd.git
$ cd ccfd
$ make

There should now be two new folders, obj and bin, the last one containing the ccfd executable.

You can test the compiled binary file, by executing the following command

$ make check

This will execute ccfd in the directory check on some small cases that test specific functions of the program.

Continue with Usage. When installing ParaView, do not choose the Linux version, but the MacOS version.

When using ccfd it is very handy to have the ability to open a terminal in a folder from Finder. This is possible, but has to be activated first. Go to System-settings->Keyboard->Services and then check the box in front of the option New Terminal at Folder. Now, you can right click a folder in Finder and open a terminal in that folder.

Windows

I am still working on installing it on Windows directly, but have not yet managed to do so. For now it only works with a Linux Bash shell. Get the latest Ubuntu shell and complete the installation process. Next, start the Ubuntu shell and install the necessary utilities (if you have never used Linux before, $ in front of a command means the command can be executed as a normal user and # in front of a command means, you need administrative rights; these can be obtained by typing sudo in front of the command and entering the password)

# apt update
# apt upgrade
# apt install git build-essential cmake libomp-dev

Now change to your desired working directory

$ git clone https://github.com/hhh95/ccfd.git
$ cd ccfd
$ make

There should now be two new folders, obj and bin, the last one containing the ccfd executable.

You can test the compiled binary file, by executing the following command

$ make check

This will execute ccfd in the directory check on some small cases that test specific functions of the program.

After everything is set up, continue with Usage. However, when installing ParaView, do not install it in the Ubuntu shell, but rather install it normally for Windows. When you want to access the files created by ccfd from Windows, just type the following into the Ubuntu shell

$ explorer.exe .

This will open the directory in the Windows explorer and you can easily access the file with ParaView.

If, after trying to open ParaView, you get an error that a 'VCOMP140.DLL' library is missing, follow the explainatins of this Forum Post.

Usage

As a first step you should add the ccfd executable to your path. You can do so by running

$ source ccfdrc

Next, navigate to the calc folder. Here you will find example case files, contained in folder. First, try the Riemann problems. Navigate to the riemann folder with

$ cd riemann

Here you will find the SOD test case, as well as different versions of the case. Start a calculation with

$ ccfd sod.ini

and observe the output. There should be four new files. The initial condition of the case and the calculation results at t = 0.25 s. They should all be .csv files. You can examine them with any spreadsheet program you like. Alternatively you can use ParaView, a free post-processing program, that can visualize 1D, 2D, and 3D data. For Arch-based distributions you can install it from the package manager

# pacman -S paraview

On Ubuntu, the ParaView program in the repositories does not read CGNS files correctly for some reason. You will need to download ParaView 5.8 from the ParaView website. Next do the following

$ cd folder/where/you/downloaded/paraview
$ tar -xvf ParaView-5.8.0-MPI-Linux-Python3.7-64bit.tar.gz
# mv ParaView-5.8.0-MPI-Linux-Python3.7-64bit.tar.gz /opt
$ echo "export PATH:$PATH:/opt/ParaView-5.8.0-MPI-Linux-Python3.7-64bit/bin" >> ~/.bashrc

Next open ParaView in the directory where you performed the calculations

$ cd path/to/ccfd/calc/riemann
$ paraview &

Now, click on File->Open and select both sets of .csv files. Because the results are 1D data, you need to change from Render View to Line Chart View. In the top right of the viewing area, click on the X button. Now select Line Chart View from the list. You should now see an empty grid with an x-, and a y-axis. In the Pipeline Browser to the left, click on the eye icons in front of the loaded files. A plot should appear on the axis grid. It will probably show the initial state. In the top bar, click on the play button. Now, the final state should be shown. You will see the analytical, or exact, solution, as well as the numerical solution.

For more information on the theory, maybe have a look at Wikipedia.

The procedure for running the other cases is the same. However, if the solution data is 2D, then you do not need to switch to Line Chart View. The 2D CGNS output files will usually have more than just the solution file. You can load everything at once by selecting the file that has _Master in its name. After loading the file, select all Cell Arrays in the Pipeline Browser and click on Apply. Then you can look at the different fields of the solution, by selecting them in the top bar (where it first says Solid Color).

Some files can only be run with the Navier-Stokes equations. In order the switch between Euler and Navier-Stokes equations, open the Makefile and change the EQNSYS parameter.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].