Coded fixed value

Properties

  • Wrapper around the fixed condition
  • Provides an interface to prescribe a user-coded condition (C++)
  • Applicable to all variable types

Usage

A simple example showing how to ramp the patch values as a function of time

\[ p = \min (10, 0.1 t) \]

is specified in the field file using:

<patchName>
{
    type            codedFixedValue;
    value           uniform 0;

    // Name of generated boundary condition
    redirectType    rampedFixedValue;

    code
    #{
        const scalar t = this->db().time().value();
        operator==(min(10, 0.1*t));
    #};
}

Only basic functionality is offered by default, e.g. access to the mesh (Foam::fvMesh) and time (Foam::Time) databases. For more complex conditions access to additional classes is enabled via the optional codeInclude and codeOptions entries, e.g.

codeInclude
#{
    #include "fvCFD.H"
#};

codeOptions
#{
    -I$(LIB_SRC)/finiteVolume/lnInclude
#};

This is equivalent to the required entries in the Make/options file when building code libraries.

Further information

Source code:

Related:


Would you like to suggest an improvement to this page? Create an issue

Copyright © 2017 OpenCFD Ltd.

Licensed under the Creative Commons License BY-NC-ND Creative Commons License