Contrib/pythonFlu

From OpenFOAMWiki
< Contrib(Redirected from Contrib pythonFlu)

pythonFlu is the Python wrapping for OpenFOAM C++ API.

This article is just a cut and paste from pythonFlu homepage. Francois 10:41, 6 April 2011 (CEST)

Copyrights ©

2010 - Alexey Petrov

2009 - 2010 Pebble Bed Modular Reactor (Pty) Limited (PBMR)

GNU General Public License, version 3

Developers: Alexey Petrov, Andrey Simurzin

1 Motivation

It comes from daily engineering practice. I mean the need to make OpenFOAM calculation environment more interactive and more automated at the same time.

It is hard to interact with OpenFOAM solver because of C++ code definition - it needs to be compiled before you could see the results of modifications you have made. How about the interactivity like in MatLab, where the user can actually play with its functionality step by step, immediately see the results and analyze them?

To automate interaction with solver, to run an optimization scheme or benchmark calculations you need to invent your own "scripting" wheel. This wheel will be responsible for passing the data to and fro binary solver, controlling and analyzing the solver output, running the solver execution and stopping it. Are you ready?

2 Solution

pythonFlu is the Python wrapping for OpenFOAM C++ API. It enriches the existing OpenFOAM best features, such as expressiveness and robustness, with such unique advantages as interactivity and automation. Using pythonFlu you possess all the power of OpenFOAM; you have the same performance and use the same math-like notation. Certainly, pythonFlu neither provides a commonplace GUI interface nor os going to define a solver for you, however, it gives you much more - a unique engineering environment, where everything can be accessed and run under the same Python terms.

3 Features

  • Supports different OpenFOAM versions and forks
(so, if you have some preferences on account of OpenFOAM distribution, there should be no problem)
  • Keeps the same performance as the referenced OpenFOAM C++ solvers
(even more, pythonFlu encourages solver developers to improve the original performance by avoiding unnecessary data duplication)
  • Enables definition of OpenFOAM pure Python classes derived from the corresponding C++ ones
(allows you to define custom fvPathFields and "physical models")
  • Makes it possible to distribute your pythonFlu solver code in a light-weight, portable, ready to use Python format

4 Download

You can download the latest kernel and solvers at the pythonFlu download page

5 Installation Overview

pythonFlu can be installed as from binaries, as from sources. Most easiest and straightforward way get a feeling about pythonFlu, play with it and decide whether it worths your attention and time is to install pythonFlu from binaries. Even if you can not find the pythonFlu binaries suitable for your OS version and OpenFOAM distribution you are working with, it is still better to try pythonFlu binary installation first (might be on other machine and different OpenFOAM).

Installation from sources will require, from the person who choose this way, considerable knowledge in Linux (experience in compiling OpenFOAM from sources this will be more than enough), over 2 Gb of RAM installed on the machine and some patience to wait for the compilation (it usually takes about 45 minutes).

Solvers

Starting from the 8.1-Elvis version, all pythonFlu solvers were separated from the kernel functionality and started its own life as standalone, pure Python, platform independent packages. This decision were taken from the following reasons :

  • Definition of pythonFlu kernel and pythonFlu based solvers are logically independent
  • pythonFlu based solvers are written in pure Python and could use simpler distribution technique (just source code)

So, pythonFlu solver developers can advance and distribute their work on their own; independently from pythonFlu kernel development. Therefore, if you have a great CFD idea, define it in pythonFlu terms and let people know about your achievements.

The full catalog and a way to install the referenced pythonFlu solvers can be found here.