Skip to content

pyFoam: an Introduction

April 11, 2011


pyFoam is a Python front-end to the OpenFOAM (Open Source CFD Toolbox). pyFoam intends to define a new level of flexibility and user interaction scenario for numerical simulation software; it brings innovative ideas to break the long-standing wall between the solver developers and the end-users.

– If you are a careful analyst, you will be able easily understand what your solver is doing and why.

– If you are an experienced guy, it will provide you the full control over the solver execution – you will be able to

* couple different solvers you have,

* write customization subroutines,

* define your benchmarking and pre/post processing procedures.

– If you are a solver developer, you will clearly understand why users need all this features; users will be able to adopt your code to their needs even without you!

– If you are thoughtful project manager, you will appreciate this software because it increases team productivity by

* alignment of the user experience communication; solver developers and end-users will speak in the same terms and in the same language

* ability to formalize and automate most of the analyst tasks as well, as quickly be adopted to new non-standard demands

* improving quality of the calculations, because through this software your team will obtain not just solver engines, but the general way to standardize your routines

* applying the best software for every subtask you do; pyFoam will be able glue them all into one application / environment.


Why Python

– Python is mostly used in scientific and engineering programming

– Python code is easy to read, understand and learn to program

– Python support all the modern programming features

– Python code is typically 5-10 times shorter than equivalent C++ code

– Python programmer can finish in two months what two C++ programmers can’t complete in a year

– Python comes with a vast collection of libraries (as standard, as third-party)

– Object Oriented Programming (classes, inheritance, virtual functions e.t.c)

– Operators customization (user can write your own definition for ‘+’ or ‘-‘)

– Exception based error handling


Why OpenFOAM

In principle, the technology pyFoamuses (SWIG) to deliver its functionality, can be applied to any library and solver framework. At the same time pyFoam choose OpenFOAM as its source by the following reasons:

– OpenFOAM uses advanced, robust and proven numerical simulation engine

– OpenFoam allows the user to use syntax that closely resemble the partial
differential equations being solved. For example:

solve( fvm.ddt( rho, U ) + fvm.div( phi, U ) – fvm.laplacian( mu, U )  == – fvc.grad( p ) )

– It comes with a growing collection of pre-written solvers applicable to a wide range of problems

– First and most capable general purpose CFD package to be released under an open-source license


No comments yet

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: