13.07.2015 Views

UFL Specification and User Manual 0.3 - FEniCS Project

UFL Specification and User Manual 0.3 - FEniCS Project

UFL Specification and User Manual 0.3 - FEniCS Project

SHOW MORE
SHOW LESS
  • No tags were found...

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

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

<strong>UFL</strong> <strong>Specification</strong> <strong>and</strong> <strong>User</strong> <strong>Manual</strong> <strong>0.3</strong>Martin S. Alnæs, Anders Logga = v*u*dxThis example is implemented in the file mass.ufl in the collection of demonstrationforms included with the <strong>UFL</strong> source distribution.3.2 Poisson’s equationThe bilinear <strong>and</strong> linear forms form for Poisson’s equation,∫a(v,u) = ∇v ·∇udx, (3.2)∫ΩL(v;f) = vf dx, (3.3)can be implemented as follows:Ωelement = FiniteElement("Lagrange", triangle, 1)v = TestFunction(element)u = TrialFunction(element)f = Function(element)a = dot(grad(v), grad(u))*dxL = v*f*dxAlternatively, index notation can be used to express the scalar product likethis:a = Dx(v, i)*Dx(u, i)*dxor like this:62

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

Saved successfully!

Ooh no, something went wrong!