Contrib/equationReader

From OpenFOAMWiki
< Contrib
Revision as of 21:23, 19 July 2010 by Marupio (Talk | contribs)

1 What is it?

equationParser is an extension to OpenFOAM that allows you to use equations in a dictionary file in place of scalars or dimensionedScalars. For example:

nu          nu [0 2 -1 0 0 0 0] "1.2 + 3 * alpha^sin(pi_/6)";
aScalar     "nu / max(5, alpha)";
alpha       1.3;

2 Features

  • Order of operations - it is fully compliant with the conventional order of operations to an arbitrary parenthesis depth;
  • Equation dependency tracking - equations can depend on one another to an arbitrary hierarchy depth;
  • Circular-reference detection - it will halt computations when a circular reference is detected;
  • On-the-fly equation mapping - it will automatically perform substitution on other equations when they are needed, even if they aren't specifically called for in the solver; and
  • stand-alone, passive and active modes of operation - you can choose from three different modes of operation to suit your needs.

3 How do you use it?

equationParser has three modes of operation:

  1. stand-alone - this one works "out of the box" with all OpenFOAM applications. You can only use literal constants in your equations;
  2. passive mode - if you create an equationMaster object, you can give it data sources. This allows you to use variables, and equation substitution; and
  3. active mode - if you also give equationMaster pointers to your output variables, it can automatically update the values at every timestep.