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 Loggv = TestFunction(element) # Test functionu1 = TrialFunction(element) # Value at t_nu0 = Function(element) # Value at t_n-1c = Function(element) # Heat conductivityf = Function(element) # Heat sourcek = Constant("triangle") # Time stepa = v*u1*dx + k*c*dot(grad(v), grad(u1))*dxL = v*u0*dx + k*v*f*dxThis example is implemented in the file heat.ufl in the collection of demonstrationforms included with the <strong>UFL</strong> source distribution.3.7 Mixed formulation of StokesTo solve Stokes’ equations,−∆u+∇p = f, (3.13)∇·u = 0, (3.14)we write the variational problem in st<strong>and</strong>ard form a(v,u) = L(v) for all v toobtain the following pair of bilinear <strong>and</strong> linear forms:∫a((v,q),(u,p)) = ∇v : ∇u−(∇·v)p+q(∇·u)dx, (3.15)Ω∫L((v,q);f) = v ·f dx. (3.16)ΩUsing a mixed formulation with Taylor-Hood elements, this can be implementedas follows:cell = triangleP2 = VectorElement("Lagrange", cell, 2)P1 = FiniteElement("Lagrange", cell, 1)TH = P2 * P167

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

Saved successfully!

Ooh no, something went wrong!