12.07.2015 Views

DOLFIN User Manual - FEniCS Project

DOLFIN User Manual - FEniCS Project

DOLFIN User Manual - FEniCS Project

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>DOLFIN</strong> <strong>User</strong> <strong>Manual</strong>Hoffman, Jansson, Logg, Wellsand the linear form L : ˆV → R is given by∫L(v) = v f dx. (2.6)Ω2.2.1 Setting up the variational problemThe variational problem (2.4) must be given to <strong>DOLFIN</strong> as a pair of bilinearand linear forms (a, L) using the form compiler FFC. This is done byentering the definition of the forms in a text file with extension .form, e.g.Poisson.form, as follows:element = FiniteElement(‘‘Lagrange’’, ‘‘triangle’’, 1)v = BasisFunction(element)U = BasisFunction(element)f = Function(element)a = dot(grad(v), grad(U))*dxL = v*f*dxThe example is given here for piecewise linear finite elements in two dimensions,but other choices are available, including arbitrary order Lagrangeelements in two and three dimensions.To compile the pair of forms (a, L), now call the form compiler on thecommand-line as follows:# ffc Poisson.formThis generates the file Poisson.h which implements the forms in C++ forinclusion in your <strong>DOLFIN</strong> program.17

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!