class dolfin.functions.function.Function(*args, **kwargs)

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

This class represents a function \(u_h\) in a finite element function space \(V_h\), given by

\[u_h = \sum_{i=1}^n U_i \phi_i,\]

where \(\{\phi_i\}_{i=1}^n\) is a basis for \(V_h\), and \(U\) is a vector of expansion coefficients for \(u_h\).


There is a maximum of three arguments. The first argument must be a Function or a FunctionSpace.

If instantiated from another Function, the (optional) second argument must be an integer denoting the number of sub functions to extract.

In addition can a name argument be passed overruling the default name


Create a Function:

  • from a FunctionSpace V

    f = Function(V)
  • from cpp.Function f

    Warning: this constructor is intended for internal libray use only. No copying is done - f is only wrapped as Function.

    g = Function(f)
  • from a FunctionSpace V and a GenericVector v

    Warning: this constructor is intended for internal libray use only.

    g = Function(V, v)
  • from a FunctionSpace and a filename containg a GenericVector

    g = Function(V, 'MyVectorValues.xml')

Initialize Function.


Assign either a Function or linear combination of Functions.

rhs (_Function_)
A Function or a linear combination of Functions. If a linear combination is passed all Functions need to be in the same FunctionSpaces.

Extract any sub functions.

A sub function can be extracted from a discrete function that is in a mixed, vector, or tensor FunctionSpace. The sub function resides in the subspace of the mixed space.

Copy sub function vector instead of sharing

Return an informative str representation of itself

sub(i, deepcopy=False)

Return a sub function.

The sub functions are numbered from i = 0..N-1, where N is the total number of sub spaces.

i : int
The number of the sub function
ufl_evaluate(x, component, derivatives)

Function used by ufl to evaluate the Function