13.07.2015 Views

Part II Implementation - FEniCS Project

Part II Implementation - FEniCS Project

Part II Implementation - 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 Finite Element MethodLetting the test function v vanish on the Dirichlet boundary Γ D where the solutionu is known, we arrive at the following classical variational problem: Findu ∈ V such that∫∫ ∫∇v · ∇u dx = vf dx − v g ds ∀v ∈ ˆV . (3.3)ΩΩ Γ NThe test space ˆV is defined byˆV = {v ∈ H 1 (Ω) : v = 0 on Γ D },and the trial space V contains members of ˆV shifted by the Dirichlet condition,V = {v ∈ H 1 (Ω) : v = u 0 on Γ D }.We may now discretize Poisson’s equation by restricting the variational problem(3.3) to a pair of discrete spaces: Find u h ∈ V h ⊂ V such that∫∫ ∫∇v · ∇u h dx = vf dx − v g ds ∀v ∈ ˆV h ⊂ ˆV . (3.4)ΩΩ Γ NWenoteherethattheDirichletcondition u = u 0 on Γ D entersintothedefinitionofthe trial space V h (it is an essential boundary condition), whereas the Neumanncondition −∂ n u = g on Γ N enters into the variational problem (it is a naturalboundary condition).To solve the discrete variational problem (3.4), we must construct a suitablepair of discrete test and trial spaces ˆV h and V h . We return to this issue below, butassume for now that we have a basis {ˆφ i } N i=1 for ˆV h and a basis {φ j } N j=1 for V h. Wemay then make an ansatz for u h in termsofthe basis functionsof the trial space,N∑u h = U j φ j ,j=1where U ∈ R N is the vector of degrees of freedom to be computed. Inserting thisinto (3.4) and varying the test function v over the basis functions of the discretetest space ˆV h , we obtainN∑∫∫ ∫U j ∇ˆφ i · ∇φ j dx = ˆφ i f dx − ˆφi g ds, i = 1, 2, . . .,N.ΩΩ Γ Nj=1We may thus compute the finite element solution u h = ∑ Nj=1 U jφ j by solving thelinear systemAU = b,where∫A ij =∫b i =ΩΩ∇ˆφ i · ∇φ j dx,∫ˆφ i f dx − ˆφi g ds.Γ N26

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

Saved successfully!

Ooh no, something went wrong!