Debian Codegraph @

demo/documented/auto-adaptive-poisson/cpp/AdaptivePoisson.ufl.rst

raw
1 UFL input for the auto adaptive Poisson problem
2 ===============================================
3
4 UFL code::
5
6 from ufl_legacy import (Coefficient, dot, ds, dx, FiniteElement, grad,
7 TestFunction, TrialFunction, triangle)
8
9 element = FiniteElement("CG", triangle, 1)
10 u = TrialFunction(element)
11 v = TestFunction(element)
12
13 f = Coefficient(element)
14 g = Coefficient(element)
15
16 a = dot(grad(u), grad(v))*dx()
17 L = f*v*dx() + g*v*ds()
18 M = u*dx()
19
20 Before the form file can be used in the C++ program, it must be
21 compiled using FFC by running (on the command-line):
22
23 .. code-block:: sh
24
25 ffc -l dolfin -e AdaptivePoisson.ufl
26
27 Parameter ``-e`` ensures that a code for forms used for error control
28 is generated.