PyFoam and swakFoam by Bernhard Gschaider

From OpenFOAM Wiki
Jump to navigation Jump to search

Go back to Collection by authors.

Basic PyFoam and swakFoam training


Used Version: OpenFOAM 7 (but with minor adaptions other versions work as well)

Further Reading: - Advanced features of swak4Foam [1] - Using PyFoam to gather data from simulations [2] - Target audience :: People who can run OpenFOAM but haven't used PyFoam and swakFoam before

This presentation gives an overview of the basic capabilities of PyFoam and swak4Foam by taking a tutorial case and 1. Running it using the PyFoam-utilities 2. Modifying it and setting boundary conditions and initial conditions using swak4Foam 3. Evaluating the results of the simulation during the run and afterwards

State and solution


Used Version: OpenFOAM v1612 (but any newer version should work as well)

Target audience people who used swak4Foam before

This is an advanced swak4Foam presentation. It shows how swak4Foam can be used to influence the solution. Either by changing "only" the numerics or the physical solution

During the tutorial three standard tutorials will be modified to demonstrate

1. Changing the numerics during the run to improve the run-time 2. Checking for convergence of the phyiscal solution instead of only the residuals and stopping the run depending on it 3. Prototyping a simple physical model without writing a proper solver for it


Used Version: OpenFOAM v1712 and foam-extend 4.1

Target audience: people who used PyFoam before is a utility from the PyFoam library that can be used to prepare a case to be set up consistently using templates and scripts. This is especially useful if the case is to be used with many different configurations (boundary conditions, material properties, models) for instance for parameter variations.

The tutorial demonstrates how to set up a well-known tutorial case so that it can be run with different solvers and OpenFOAM version to compare the results

PyFoam Programming


Used Version: OpenFOAM v1912

Target audience: people who have a basic knowledge of Python

This training demonstrates how to use the library of PyFoam to automate the running of cases and extracting data from them.

The application that this will be used for is simulating a water driven rocket and finding out what the optimal amount of water to fill it with to reach an optimal height.

In addition to PyFoam it will use standard Python packages for numerics.