programming

How to write a CFD library: The Conjugate Gradient class

When it comes to Computational Fluid Dynamics (CFD) applications, the Conjugate Gradient (CG) method is one of the more used algorithms to solve the linear system of equations . It offers fast convergence, low storage requirements, and is relatively easy to implement. In this week’s article, we’ll look at how we can implement this algorithm …

How to write a CFD library: The Conjugate Gradient class Read More »

How to write a CFD library: Basic library structure

In last week’s article, we developed the discretised equation for the 1D heat diffusion equation using the finite volume method. We looked at why we need an implicit time integration technique and why this requires a linear system of equations solver. In this week’s article, we’ll explore how to set up a basic project structure …

How to write a CFD library: Basic library structure Read More »

Reduce memory bugs with smart pointers in C++

This article will look into smart pointers and why we should use them over raw pointers in C++. Smart pointers are fundamental building blocks in C++ and after 2014, ever C++ programmer should be using smart pointers instead of raw pointers, there are no excuses for raw pointers (anymore). Throughout this article, we explore how …

Reduce memory bugs with smart pointers in C++ Read More »

Understanding Lambda expressions and how to use them in C++

Lambda expressions are quite powerful in C++, but it is not immediately clear why we should use them over similar constructs such as function pointers. In this article, we look at what lambda expressions are, how they are related to function pointers, and specifically how we can apply them in some real CFD code examples. …

Understanding Lambda expressions and how to use them in C++ Read More »

How to handle inheritance and class hierarchies in C++

Another cornerstone of object-orientated programming is inheritance, which is the ability to define parent-child relations between classes. Inheritance allows child classes to derive functions and variables from the parent class and so we are able to group together classes that naturally fit together under a common base class. For example, the base class RANS may …

How to handle inheritance and class hierarchies in C++ Read More »

Why you should use C++ for CFD development

After discussing the differences between compiled, interpreted, and just-in-time compiled languages, I want to look at programming languages and discuss which ones are suitable and serious contenders for CFD solver development tasks. This is an opinionated section, and I am not trying to hide it. If you create a wish list of features a programming …

Why you should use C++ for CFD development Read More »