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 Logg<strong>and</strong> a linear form 5 can be differentiated to obtain the bilinear form correspondingto its Jacobi matrix:J(v,u;w) = ddw F(v;w).The <strong>UFL</strong> code to express this is (for a simple functional f(w) = ∫ Ω12 w2 dx)f = (w**2)/2 * dxF = derivative(f, w, v)J = derivative(F, w, u)which is equivalent to:f = (w**2)/2 * dxF = w*v*dxJ = u*v*dxAssume in the following examples that:v = TestFunction(element)u = TrialFunction(element)w = Function(element)The stiffness matrix can be computed from the functional ∫ ∇w : ∇wdx,Ωby the linesf = inner(grad(w), grad(w))/2 * dxF = derivative(f, w, v)J = derivative(F, w, u)5 Note that by “linear form” we only mean a form that is linear in its test function, notin the function you differentiate with respect to.54

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

Saved successfully!

Ooh no, something went wrong!