Contrib/simpleFunctionObjects

From OpenFOAMWiki
< Contrib
Revision as of 16:25, 21 April 2008 by Bgschaid (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Valid versions: OF version 141.png

1 Description

Starting with Version 1.4 OpenFOAM has the facility of functionObjects. These are basically small pieces of code that are being executed at every time-step without explizitly being linked to the application. They are activated by the functions-list in the controlDict of the case.

1.1 Invitation for contributions

The scope of this library are functionObjects that are

  • simple
  • general enough to be used with more than one solver

Anybody who thinks that a something is missing from the library (a patchLiftDrag-object comes to mind) and feels able to implement it is invited to do so (you just need write access to the OpenFOAM-extend subversion archive)

2 Usage

2.1 Compilation and installation

Just do

wmake libso

in the directory of the sources. The library will be compiled and installed in a place (%FOAM_USER_LIBBIN) where it is usable

2.2 Additions to controlDict

A function object is activated by adding an entry like this to the system/controlDict of a case:

functions 
(
   massFlow
   {
      type patchMassFlow;
     functionObjectLibs
       (
         "libsimpleFunctionObjects.so"
       );
     verbose true;
     patches
       (
         inlet
         outlet
       );
     factor 19.7363;
   }
);

(There can be more than one function objects; each entry just has to be one named dictionary).

The entries pre-defined by the OpenFOAM-functionObject mechanism are

functionObjectLibs
Libraries that have to be loaded in order for this functionObject to work
type
the type of the function object

Standard entries (not all have to be defined) for the functionObjects in this library are

region
The mesh region for multi-mesh simulations (like FSI etc). Usually not used
verbose
The results of the calculations should be printed to the terminal (as well as being written to disk)
after
The function object should only be called after a certain time (if undefined the start of the simulation is used)
factor
A factor with which the results should be multiplied before being written to disk/terminal. Used to account for symmetries etc (not used by all function objects)

Depending on the type of the functionObject in this library these entries are used:

phi
The variable that is to be used as phi for flow calculations (Default: phi)
fields
The fields for which this calculation is done
patches
The patches on which this calculation is done

2.3 Available types

Currently the functionObjects in the library fall in two categories (the names should speak for themselves):

  • per-patch calculations:
    • patchAverage
    • patchFieldFlow
    • patchForce
    • patchIntegrate
    • patchMassFlow
  • total-volume calculations:
    • volumeAverage
    • volumeIntegrate
    • volumeMinMax

3 Download

The library is available by subversion

svn checkout https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder/libraries/simpleFunctionObjects/

This is the latest (possibly unstable/broken) version. The initial (hopefully stable) version is available with

svn checkout -r 595 https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder/libraries/simpleFunctionObjects/

--Bgschaid 18:25, 21 April 2008 (CEST)