Coded fixed value


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


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:

    type            codedFixedValue;
    value           uniform 0;

    // Name of generated boundary condition
    redirectType    rampedFixedValue;

        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.

    #include "fvCFD.H"


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

Further information

Source code:


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