19.06.2015 Views

A FEniCS Tutorial - FEniCS Project

A FEniCS Tutorial - FEniCS Project

A FEniCS Tutorial - FEniCS Project

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Figure 8: Hollow cylinder generated by mapping a rectangular mesh, stretched<br />

toward the left side.<br />

5.1 Working with Two Subdomains<br />

Suppose we want to solve<br />

∇·[k(x,y)∇u(x,y)] = 0, (88)<br />

in a domain Ω consisting of two subdomains where k takes on a different value<br />

in each subdomain. For simplicity, yet without loss of generality, we choose for<br />

the current implementation the domain Ω = [0,1]×[0,1] and divide it into two<br />

equal subdomains, as depicted in Figure 5.1,<br />

Ω 0 = [0,1]×[0,1/2], Ω 1 = [0,1]×(1/2,1].<br />

We define k(x,y) = k 0 in Ω 0 and k(x,y) = k 1 in Ω 1 , where k 0 > 0 and k 1 > 0<br />

are given constants. As boundary conditions, we choose u = 0 at y = 0, u = 1<br />

at y = 1, and ∂u/∂n = 0 at x = 0 and x = 1. One can show that the exact<br />

solution is now given by<br />

u(x,y) =<br />

{ 2yk1<br />

k 0+k 1<br />

, y ≤ 1/2<br />

(2y−1)k 0+k 1<br />

k 0+k 1<br />

, y ≥ 1/2<br />

(89)<br />

As long as the element boundaries coincide with the internal boundary y = 1/2,<br />

this piecewise linear solution should be exactly recovered by Lagrange elements<br />

of any degree. We use this property to verify the implementation.<br />

Physically, the present problem may correspond to heat conduction, where<br />

the heat conduction in Ω 1 is ten times more efficient than in Ω 0 . An alternative<br />

74

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

Saved successfully!

Ooh no, something went wrong!