Alexander Martinez-Marchese's Home Page

Simple CFD programs

These programs were made to solve problems in assignments from a fluid mechanics course. For more information on other methods in computational fluid dynamics, check out this Wikipedia entry.

The first program uses the Gauss-Seidel algorithm to calculate the stream function (hence the flow is incompressible and irrotational) at equally spaced points in a 1:2 expansion. The C program can be found here.

The second program calculates the trajectory of a golf ball. Compared to a trajectory calculation without air resistance, there is no analytical solution for calculating a trajectory including air resistance (using a squared law). The solution used in this program is to use a finite difference method. For every time step it calculates the current speed and then it calculates the acceleration using newton's equations and the drag equation. The C program can be found here.

The graph below shows a possible trajectory (notice how its not parabolic as expected without air resistance):