9.0
general documentation
Loading...
Searching...
No Matches
GUI user law editor

A formula interpreter is embedded in code_saturne, which can be used through the GUI.In order to call the formula editor of the GUI, click on the button: GUI formula button.

This will call a popup window similar to the following one

Definition of a user law for the density

The formula editor is a window with three tabs:

  • User expression

    This tab is the formula editor. At the opening of the window only the required symbols are displayed. The syntax colorization shows to the user symbols which are required symbols, functions, or user variables. Each expression uses a C-like syntax and must be closed by a semicolon (;). Compared to a true C syntax, the type of local variables does not need to be defined, as they are assumed to de real-valued.

    Required symbols must be present in the final user law. A syntax checker is used when the user clicks on the OK button.

  • Predefined symbols

    There are three types of symbols

    Useful functions

    cos: cosine
    sin: sine
    tan: tangent
    exp: exponential
    sqrt: square root
    log: Napierian logarithm
    acos: arc cosine
    asin: arc sine
    atan(x): arc tangent (arc tangent of x in radians; the return value is in the range [-π/2, π/2])
    atan2(y,x): arc tangent (arc tangent of y/x in radians; the return value is in the range [-π, π])
    cosh: hyperbolic cosine
    sinh: hyperbolic sine
    tanh: hyperbolic tangent
    abs: absolute value
    mod: modulo
    int: floor
    min: minimum
    max: maximum

    Useful constants

    pi = 3.14159265358979323846
    e = 2.718281828459045235

    Operators and statements

    + - * / ^ ! < > <= >= == != && || while if else

  • Examples

    This tab displays examples, which can be copied, pasted, and adapted.