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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>UFL</strong> <strong>Specification</strong> <strong>and</strong> <strong>User</strong> <strong>Manual</strong> <strong>0.3</strong>Martin S. Alnæs, Anders Loggwhich is equivalent to:f = inner(grad(w), grad(w))/2 * dxF = inner(grad(w), grad(v)) * dxJ = inner(grad(u), grad(v)) * dxNotethatherethebasisfunctionsareprovidedexplicitly, whichissometimesnecessary, e.g., if part of the form is linearlized manually like in (TODO: Anexample that makes sense would be nicer, this is just a r<strong>and</strong>om form.)g = Function(element)f = inner(grad(w), grad(w))*dxF = derivative(f, w, v) + dot(w-g,v)*dxJ = derivative(F, w, u)Derivatives can also be computed w.r.t. functions in mixed spaces. Considerthis example, an implementation of the harmonic map equations usingautomatic differentiation.X = VectorElement("Lagrange", cell, 1)Y = FiniteElement("Lagrange", cell, 1)x = Function(X)y = Function(Y)L = inner(grad(x), grad(x))*dx + dot(x,x)*y*dxF = derivative(L, (x,y))J = derivative(F, (x,y))Here L is defined as a functional with two coefficient functions x <strong>and</strong> y fromseparate finite element spaces. However, F <strong>and</strong> J become linear <strong>and</strong> bilinearforms respectively with basis functions defined on the mixed finite element55

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

Saved successfully!

Ooh no, something went wrong!