# Constant¶

class dolfin.functions.constant.Constant(value, cell=None, name=None)

Bases: ufl.coefficient.Coefficient, dolfin.cpp.function.Constant

Create constant-valued function with given value.

Arguments
value
The value may be either a single scalar value, or a tuple/list of values for vector-valued functions, or nested lists or a numpy array for tensor-valued functions.
cell
Optional argument. A Cell which defines the geometrical dimensions the Constant is defined for.
name
Optional argument. A str which overrules the default name of the Constant.

The data type Constant represents a constant value that is unknown at compile-time. Its values can thus be changed without requiring re-generation and re-compilation of C++ code.

Examples of usage

p = Constant(pi/4)              # scalar
C = Constant((0.0, -1.0, 0.0))  # constant vector

cell()