The exprField function object creates or modifies a field based on an expression.

Usage

The exprField function object is specified using:

exprField1
{
    type            exprField;
    libs            (fieldFunctionObjects);
    ...
    field           <field-name>;

    expression      <expr>; // new and modify actions only

    // Optional entries
    action          <action-type>;
    readFields      <bool>;

    fieldMask       <mask-expr>; // modify action only


    autowrite       <bool>; // default: false;
    store           <bool>; // default: true

    dimensions      <dimensions>;
}

Actions

  • none: no-op
  • new: create a new field - default
  • modify: modify an existing field

Examples

Create a new pTotal field based on an expressions for

\[p_t = p + \frac{1}{2} \rho | \u |^2\]
exprField1
{
    type            exprField;
    libs            (fieldFunctionObjects);
    field           pTotal;
    expression      "p + 0.5*(rho*magSqr(U))";
    dimensions      [ Pa ];
}

Modify the existing pTotal field by setting the static pressure using the p field in the region defined by

\[|\vec{x}| < 0.05\]

and

\[x_y > 0\]
exprField
{
    type            exprField;
    libs            (fieldFunctionObjects);
    field           pTotal;
    action          modify;

    // Static pressure only in these regions
    fieldMask       "(mag(pos()) < 0.05) && (pos().y() > 0)";
    expression      "p";
}

Further information

Source code:

API:

Related: