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 Loggnumber of points for quadrature elements, <strong>and</strong> let the form compiler choosea quadrature rule. This way the form depends less on the cell in use.WeconsiderhereanonlinearversionofthePoisson’sequationtoillustratethemain point of the "Quadrature" finite element family. The strong equationlooks as follows:−∇·(1+u 2 )∇u = f. (3.23)The linearised bilinear <strong>and</strong> linear forms for this equation,a(v,u;u 0 ) =L(v;u 0 ,f) =∫∫ΩΩ∫(1+u 2 0)∇v ·∇udx+ 2u 0 u∇v ·∇u 0 dx, (3.24)Ω∫vf dx− (1+u 2 0)∇v ·∇u 0 dx, (3.25)can be implemented in a single form file as follows:Ω# NonlinearPoisson.uflelement = FiniteElement("Lagrange", triangle, 1)v = TestFunction(element)u = TrialFunction(element)u0 = Function(element)f = Function(element)a = (1+u0**2)*dot(grad(v), grad(u))*dx \+ 2*u0*u*dot(grad(v), grad(u0))*dxL = v*f*dx - (1+u0**2)*dot(grad(v), grad(u0))*dxHere, u 0 representsthesolutionfromthepreviousNewton-Raphsoniteration.The above form will be denoted REF1 <strong>and</strong> serve as our reference implementationfor linear elements. A similar form (REF2) using quadratic elementswill serve as a reference for quadratic elements.Now, assume that we want to treat the quantities C = (1 + u 2 0) <strong>and</strong> σ 0 =(1+u 2 0)∇u 0 as given functions (to be computed elsewhere). Substituting into71

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

Saved successfully!

Ooh no, something went wrong!