Navigation

Operators and Keywords

Function List:

C++ API

Function File: ufl [command] line

Writes the given line to a ufl file. Optional commands are:

  • start: opens an ufl file. It is possible to specify a name for it, otherwise "default.ufl" will be used.
  • end: closes the ufl file and compiles it. It is possible to specify its content, otherwise a complete problem is assumed. Possible options are: BilinearForm, Functional, FunctionSpace, LinearForm and Problem.
ufl start linform
ufl element = FiniteElement ("Lagrange", triangle, 1)
ufl v = TestFunction (element)
ufl f = Coefficient (element)
ufl L = f*v*dx
ufl end LinearForm

This way you can write a ufl file and compile it obtaining a LinearForm.

Be aware that a ufl line starting with brackets will result in a syntax error. To avoid this, it is necessary to enclose them and their content in quotes or apices:

ufl "(sigma, u)" = TrialFunctions(W)

See also: import_ufl_Problem, import_ufl_BilinearForm, import_ufl_Functional, import_ufl_FunctionSpace, import_ufl_LinearForm.

Package: fem-fenics