Contents
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.
Note: This library will be integrated into swak4Foam starting with OF 2.0. The library is still compilable independently of the other parts of swak
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
You can also use this in post-processing with the ExecFlowFunctionObjects tool. Add this to controlDict:
functions ( massFlow { type patchMassFlow; functionObjectLibs ( "libsimpleFunctionObjects.so" ); verbose true; patches ( inlet outlet ); factor 19.7363; outputControl timeStep; outputInterval 1; } );
Then call execFlowFunctionObjects -noFlow Valid versions:
2.3 Available types
Currently the functionObjects in the library fall in two categories (the names should speak for themselves):
- per-patch calculations:
- patchAverage; does an area-weighted averaging of a field
- patchFieldFlow; does a mass-flux-weighted integration of a field
- patchForce (has been removed for the -version because a similar facility is included with the release)
- patchIntegrate; does an area-weighted integration of a field
- patchMassFlowAverage (has been included for the ); does a mass-flux-weighted averaging of a field
- patchMassFlow; computes the mass-flux through a patch
- total-volume calculations:
- misc
- panicDump: Dumps all available data if a field exceeds certain bounds ans finishes the simulation
- trackDictionary: Write the contents of selected dictionaries as they change. Detailed documentation
- sample
- extended fields writing
- writeFieldsOften: lets the user specify an additional set of fields that is to be written more frequently than specified in the controlDict
- writeAdditionalFields: lets the user specify an additional set of fields that is to be written with the other fields; they are written by AUTO_WRITE
3 Download
3.1 OpenFOAM 1.4.1
The library is available by subversion
svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder/libraries/simpleFunctionObjects/
This is the latest (possibly unstable/broken) version. The initial (hopefully stable) version is available with
svn checkout -r 595 svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder/libraries/simpleFunctionObjects/
3.2 OpenFOAM 1.5
This version is available at
svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.5/libraries/simpleFunctionObjects
3.3 OpenFOAM 1.6
This version is available at
svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.6/libraries/simpleFunctionObjects
It also works with 1.7
3.4 OpenFOAM 2.0
Starting with this version of OF is a part of swak4Foam.
--Bgschaid 18:25, 21 April 2008 (CEST)