19.06.2015 Views

A FEniCS Tutorial - FEniCS Project

A FEniCS Tutorial - FEniCS Project

A FEniCS Tutorial - FEniCS Project

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

The proper statement of our variational problem now goes as follows: Find<br />

u ∈ V such that ∫ ∫<br />

∇u·∇vdx = fvdx ∀v ∈ ˆV. (7)<br />

Ω<br />

The test and trial spaces ˆV and V are in the present problem defined as<br />

ˆV = {v ∈ H 1 (Ω) : v = 0 on ∂Ω},<br />

V = {v ∈ H 1 (Ω) : v = u 0 on ∂Ω}.<br />

In short, H 1 (Ω) is the mathematically well-known Sobolev space containing<br />

functions v such that v 2 and ||∇v|| 2 have finite integrals over Ω. The solution of<br />

the underlying PDE must lie in a function space where also the derivatives are<br />

continuous, but the Sobolev space H 1 (Ω) allows functions with discontinuous<br />

derivatives. Thisweakercontinuityrequirementofuinthevariationalstatement<br />

(7), caused by the integration by parts, has great practical consequences when<br />

it comes to constructing finite elements.<br />

To solve the Poisson equation numerically, we need to transform the continuous<br />

variational problem (7) to a discrete variational problem. This is done by<br />

introducing finite-dimensional test and trial spaces, often denoted as ˆV h ⊂ ˆV<br />

and V h ⊂ V. The discrete variational problem reads: Find u h ∈ V h ⊂ V such<br />

that ∫ ∫<br />

∇u h ·∇vdx = fvdx ∀v ∈ ˆV h ⊂ ˆV . (8)<br />

Ω<br />

Ω<br />

The choice of ˆV h and V h follows directly from the kind of finite elements we<br />

want to apply in our problem. For example, choosing the well-known linear<br />

triangular element with three nodes implies that ˆV h and V h are the spaces of<br />

all piecewise linear functions over a mesh of triangles, where the functions in ˆV h<br />

are zero on the boundary and those in V h equal u 0 on the boundary.<br />

Themathematicsliteratureonvariationalproblemswritesu h forthesolution<br />

of the discrete problem and u for the solution of the continuous problem. To<br />

obtain(almost)aone-to-onerelationshipbetweenthemathematicalformulation<br />

of a problem and the corresponding <strong>FEniCS</strong> program, we shall use u for the<br />

solution of the discrete problem and u e for the exact solution of the continuous<br />

problem, if we need to explicitly distinguish between the two. In most cases,<br />

we will introduce the PDE problem with u as unknown, derive a variational<br />

equation a(u,v) = L(v) with u ∈ V and v ∈ ˆV, and then simply discretize the<br />

problem by saying that we choose finite-dimensional spaces for V and ˆV. This<br />

restriction of V implies that u becomes a discrete finite element function. In<br />

practice, thismeansthatweturnourPDEproblemintoacontinuousvariational<br />

problem, create a mesh and specify an element type, and then let V correspond<br />

to this mesh and element choice. Depending upon whether V is infinite- or<br />

finite-dimensional, u will be the exact or approximate solution.<br />

It turns out to be convenient to introduce the following unified notation for<br />

linear weak forms:<br />

a(u,v) = L(v). (9)<br />

Ω<br />

7

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

Saved successfully!

Ooh no, something went wrong!