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(v, w)(v, w, dm)where v <strong>and</strong> w are expressions of matching rank (so that inner(v, w) makessense), <strong>and</strong> dm is a measure. If the measure is left out, it is assumed that itis dx.The following example illustrates how to express a form containing integralsover subdomains <strong>and</strong> facets:a = (grad(v), grad(u)) + (v, b*grad(u), dx(2))+ (v, u, ds) + (jump(v), jump(u), dS)The following caveats should be noted:• The only operation allowed on a tuple is addition. In particular, tuplesmay not subtracted. Thus, a = (grad(v), grad(u)) - (v, u) mustbe expressed as a = (grad(v), grad(u)) + (-v, u).• Tuple notation may not be mixed with st<strong>and</strong>ard <strong>UFL</strong> integr<strong>and</strong> notation.Thus, a = (grad(v), grad(u)) + inner(v, u)*dx is notvalid.[Advanced] Tuple notation is strictly speaking not a part of the formlanguage, but tuples may be converted to <strong>UFL</strong> forms using the functiontuple2form available from the module ufl.algorithms. This is normallyh<strong>and</strong>led automatically by form compilers, but the tuple2form utility mayuseful when working with <strong>UFL</strong> from a Python script. Automatic conversionis also carried out by <strong>UFL</strong> form operators such as lhs <strong>and</strong> rhs.2.15 Form Files<strong>UFL</strong> forms <strong>and</strong> elements can be collected in a form file with the extension.ufl. Form compilers will typically execute this file with the global <strong>UFL</strong>59

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

Saved successfully!

Ooh no, something went wrong!