Before and after the case

New PyFoam Features

or: Comparing solvers without any claim for correctness

Bernhard F.W. Gschaider

Wien, 2014-06-16

"The lesser the people know about how sausages and laws are made, the better they sleep in the night"

Otto v. Bismarck

Bismarck knew nothing about presentations.

This presentation is about how it was made

Who is this Bismarck anyway?


The aim of this presentation is to demonstrate two new features of PyFoam

  • Semi-automatic case setup
  • Working with IPython-notebooks

Structure of the presentation

  • What is PyFoam
  • Our "project"
  • Setting up the case
  • Getting the results

And who is PyFoam?

  • PyFoam is a Python-library
  • Aimed at working with OpenFOAM
    • Manipulates case files
    • Starts runs and analyzes their output
  • There are utilities implemented with this library
    • This is the part that people usually call "PyFoam"
  • Most parts of PyFoam written by the speaker
    • Which doesn't mean that he knows how to use it properly

Further information about PyFoam


Are usually announced:

  • On the Wiki-page
  • On the MessageBoard
  • On Twitter @swakPyFoam

The case

p-U-coupled solver

  • The next version of foam-extend has a p-U-coupled solver pUCoupledFoam
    • Sets up one big matrix with pressure and all three velocity components
    • Solves them all at the same time
  • I never worked with it before
    • But people who did are quite excited
    • Supposedly it converges faster and is more stable

The case

  • There are tutorial-cases that come with pUCoupledFoam
    • Never trust tutorials provided with the solver: Their purpose is to make the solver look good
  • Instead a well-known case is used that also comes with (Open)FOAM
    • pitzDaily: a backward facing step for which measurment data by Pitz and Daily exists
In [4]:
from IPython.display import Image
In [6]:

What we're comparing with

We like both types of music: we like Country and Western

Jake & Elwood Blues

  • There are currently two major forks of the code originally called Foam
    • OpenFOAM by ESI-OpenCFD
    • Foam-extend by Hrvoje Jasak (Wikki Ltd) and community contributors
  • Foam-extend has block-coupled matrixes for some time now
    • Until now the examples were conjugate heat transfer and coupled transport equations
  • OpenFOAM has a similar facility for approximately a year
    • There is now an option to solve the U-Eqn in regular solvers coupled
    • According to release notes current versions have improved numerics

We're going to compare:

  • coupled31 : pUCoupledFoam from foam-extend-3.1
  • segregated31: simpleFoam from foam-extend-3.1
  • segregated23: simpleFoam from OpenFOAM-2.3
  • coupled23: simpleFoam from OpenFOAM-2.3 with the coupled option for the U-Eqn

What we're comparing

  • The base case will be the pitzDaily from foam-extend-3.1
  • For OpenFOAM-2.3 the fvSchemes from OF-2.3 will be used
    • Because this is what is probably the best there
  • For pUCoupledFoam the fvSolution from the tutorial case was used

Numbers that are compared

  • Residuals
    • Are calculated the same way. So they should be comparable
  • Pressure drop between inlet and outlet
  • Detachment point of the circulation behind the step
    • The place on the lower wall where the flow changes direction
  • Profiles defined on specific locations
    • Experimental data is measured from the original paper

Detachment point

In [3]:

The measured profiles

In [7]: