Scientific Computing WS 2018/2019 Lecture 15 Jürgen Fuhrmann juergen.fuhrmann@wias-berlin.de Lecture 15 Slide 1
Lecture 15 Slide 2 Problems with strong formulation Writing the PDE with divergence and gradient assumes smoothness of coefficients and at least second derivatives for the solution. δ may not be continuous what is then (δ u)? Approximation of solution u e.g. by piecewise linear functions what does u mean? Spaces of twice, and even once continuously differentiable functions is not well suited: Favorable approximation functions (e.g. piecewise linear ones) are not contained Though they can be equipped with norms ( Banach spaces) they have no scalar product no Hilbert spaces Not complete: Cauchy sequences of functions may not converge to elements in these spaces Lecture 14 Slide 20
Lecture 15 Slide 3 Cauchy sequences of functions Let be a Lipschitz domain, let V be a metric space of functions f : R Regard sequences of functions f n = {f n } n=1 V A Cauchy sequence is a sequence f n of functions where the norm of the difference between two elements can be made arbitrarily small by increasing the element numbers: ε > 0 n 0 N : m, n > n 0, f n f m < ε All convergent sequences of functions are Cauchy sequences A metric space V is complete if all Cauchy sequences f n of its elements have a limit f = lim n f n V within this space Lecture 14 Slide 21
Lecture 15 Slide 4 Completion of a metric space Let V be a metric space. Its completion is the space V consisting of all elements of V and all possible limits of Cauchy sequences of elements of V. This procedure allows to carry over definitions which are applicable only to elements of V to more general ones Example: step function 1, x ɛ ( x ɛ f ɛ (x) = ɛ )2 + 1, 0 x < ɛ ( x+ɛ ɛ )2 1, ɛ x < 0 1, x < ɛ ɛ 0 f (x) = { 1, x 0 1, else Lecture 14 Slide 22
Lecture 15 Slide 5 Riemann integral Lebesgue integral Let be a Lipschitz domain, let C c () be the set of continuous functions f : R with compact support. ( they vanish on ) For these functions, the Riemann integral f (x)dx is well defined, and f L 1 := f (x) dx provides a norm, and induces a metric. Let L 1 () be the completion of C c () with respect to the metric defined by the norm L 1. That means that L 1 () consists of all elements of C c (), and of all limites of Cauchy sequences of elements of C c (). Such functions are called measurable. For any measurable f = lim f n L 1 () with f n C c (), define the n Lebesque integral f (x) dx := lim f n (x) dx n as the limit of a sequence of Riemann integrals of continuous functions Lecture 14 Slide 23
Lecture 15 Slide 6 Examples for Lebesgue integrable (measurable) functions Bounded functions which are continuous except in a finite number of points Step functions Equality of L 1 functions is elusive as they are not necessarily continuous: best what we can say is that they are equal almost everywhere. In particular, L 1 functions whose values differ in a finite number of points are equal almost everywhere. Lecture 14 Slide 24
Lecture 15 Slide 7 Spaces of integrable functions For 1 p, let L p () be the space of measureable functions such that equipped with the norm f (x) p dx < ( f p = f (x) p dx These spaces are Banach spaces, i.e. complete, normed vector spaces. The space L 2 () is a Hilbert space, i.e. a Banach space equipped with a scalar product (, ) whose norm is induced by that scalar product, i.e. u = (u, u). The scalar product in L 2 is ) 1 p (f, g) = f (x)g(x)dx. Lecture 14 Slide 25
Lecture 15 Slide 8 Green s theorem for smooth functions Theorem Let u, v C 1 () (continuously differentiable). Then for n = (n 1... n d ) being the outward normal to, u i v dx = uvn i ds v i u dx Corollaries Let u = (u 1... u d ). Then ( d u i i v) dx = i=1 u v dx = v d (u i n i ) ds i=1 vu n ds v d ( i u i ) dx i=1 v u dx If v = 0 on : u i v dx = v i u dx u v dx = v u dx Lecture 14 Slide 26
Lecture 15 Slide 9 Weak derivative Let L 1 loc () be the set of functions which are Lebesgue integrable on every compact subset K. Let C0 () be the set of functions infinitely differentiable with zero values on the boundary. For u L 1 loc () we define iu by and α u by v i udx = u i vdx v C0 () v α udx = ( 1) α u i vdx v C 0 () if these integrals exist. For smooth functions, weak derivatives coincide with with the usual derivative Lecture 14 Slide 27
Lecture 15 Slide 10 Sobolev spaces For k 0 and 1 p <, the Sobolev space W k,p () is the space functions where all up to the k-th derivatives are in L p : W k,p () = {u L p () : α u L p () α k} with then norm u W k,p () = α u p L p () α k Alternatively, they can be defined as the completion of C in the norm u W k,p () 1 p W k,p 0 () is the completion of C 0 in the norm u W k,p () The Sobolev spaces are Banach spaces. Lecture 14 Slide 28
Lecture 15 Slide 11 Sobolev spaces of square integrable functions H k () = W k,2 () with the scalar product (u, v) H k () = α u α v dx α k is a Hilbert space. k,2 () = W0 () with the scalar product (u, v) H k 0 () = α u α v dx H k 0 α =k is a Hilbert space as well. For this course the most important: L 2 (), scalar product (u, v) L 2 () = (u, v) 0, = uv dx Inequalities: H 1 (), scalar product (u, v) H 1 () = (u, v) 1, = (uv + u v) dx H 1 0 (), scalar product (u, v) H 1 0 () = ( u v) dx (u, v) 2 (u, u)(v, v) u + v u + v Cauchy-Schwarz Triangle inequality Lecture 14 Slide 29
Lecture 15 Slide 12 A trace theorem The notion of function values on the boundary initially is only well defined for continouos functions. So we need an extension of this notion to functions from Sobolev spaces. Theorem: Let be a bounded Lipschitz domain. Then there exists a bounded linear mapping such that tr : H 1 () L 2 ( ) (i) c > 0 such that tr u 0, c u 1, (ii) u C 1 ( ), tr u = u Lecture 14 Slide 30
Lecture 15 Slide 13 Derivation of weak formulation Sobolev space theory provides a convenient framework to formulate existence, uniqueness and approximations of solutions of PDEs. Stationary heat conduction equation with homogeneous Dirichlet boundary conditions: λ u(x) = f (x) in u = 0 on Multiply and integrate with an arbitrary test function v C0 apply Green s theorem using v = 0 on ( λ u)v dx = fv dx λ u v dx = fv dx () and Lecture 14 Slide 31
Lecture 15 Slide 14 Weak formulation of homogeneous Dirichlet problem Search u H0 1 () (here, tr u = 0) such that λ u v dx = fv dx v H0 1 () Then, a(u, v) := λ u v dx is a self-adjoint bilinear form defined on the Hilbert space H0 1(). It is bounded due to Cauchy-Schwarz: a(u, v) = λ u v dx u H 1 0 () v H 1 0 () f (v) = fv dx is a linear functional on H1 0 (). For Hilbert spaces V the dual space V (the space of linear functionals) can be identified with the space itself. Lecture 14 Slide 32
Lecture 15 Slide 15 The Lax-Milgram lemma Theorem: Let V be a Hilbert space. Let a : V V R be a self-adjoint bilinear form, and f a linear functional on V. Assume a is coercive, i.e. α > 0 : u V, a(u, u) α u 2 V. Then the problem: find u V such that a(u, v) = f (v) v V admits one and only one solution with an a priori estimate u V 1 α f V Lecture 14 Slide 33
Lecture 15 Slide 16 Coercivity of weak formulation Theorem: Assume λ > 0. Then the weak formulation of the heat conduction problem: search u H0 1 () such that has an unique solution. Proof: a(u, v) is cocercive: λ u v dx = fv dx v H0 1 () a(u, v) = λ u u dx = λ u 2 H 1 0 () Lecture 14 Slide 34
Lecture 15 Slide 17 Weak formulation of inhomogeneous Dirichlet problem λ u = f in u = g on If g is smooth enough, there exists a lifting u g H 1 () such that u g = g. Then, we can re-formulate: λ (u u g ) = f + λ u g in u u g = 0 on Search u H 1 () such that u = u g + φ λ φ v dx = fv dx + λ u g v v H 1 0 () Here, necessarily, φ H0 1 () and we can apply the theory for the homogeneous Dirichlet problem. Lecture 14 Slide 35
Lecture 15 Slide 18 Weak formulation of Robin problem λ u = f in λ u n + α(u g) = 0 on Multiply and integrate with an arbitrary test function from C c (): ( λ u)v dx = λ u v dx + (λ u n)vds = λ u v dx + αuv ds = fv dx fv dx fv dx + αgv ds Lecture 14 Slide 36
Lecture 15 Slide 19 Weak formulation of Robin problem II Let a R (u, v) := f R (v) := Search u H 1 () such that λ u v dx + αuv ds fv dx + αgv ds a R (u, v) = f R (v) v H 1 () If λ > 0 and α > 0 then a R (u, v) is cocercive. Lecture 14 Slide 37
Lecture 15 Slide 20 Neumann boundary conditions Homogeneous Neumann: λ u n = 0 on Inhomogeneous Neumann: λ u n = g on Weak formulation: Search u H 1 () such that u v dx = gv ds v H 1 () Not coercive due to the fact that we can add an arbitrary constant to u and a(u, u) stays the same! Lecture 14 Slide 38
Lecture 15 Slide 21 Further discussion on boundary conditions Mixed boundary conditions: One can have differerent boundary conditions on different parts of the boundary. In particular, if Dirichlet or Robin boundary conditions are applied on at least a part of the boundary of measure larger than zero, the binlinear form becomes coercive. Natural boundary conditions: Robin, Neumann These are imposed in a natural way in the weak formulation Essential boundary conditions: Dirichlet Explicitely imposed on the function space Coefficients λ, α... can be functions from Sobolev spaces as long as they do not change integrability of terms in the bilinear forms Lecture 14 Slide 39
Lecture 15 Slide 22 The Galerkin method I Weak formulations live in Hilbert spaces which essentially are infinite dimensional For computer representations we need finite dimensional approximations The Galerkin method and its modifications provide a general scheme for the derivation of finite dimensional appoximations Finite dimensional subspaces of Hilbert spaces are the spans of a set of basis functions, and are Hilbert spaces as well e.g. the Lax-Milgram lemma is valid there as well Lecture 14 Slide 42
Lecture 15 Slide 23 The Galerkin method II Let V be a Hilbert space. Let a : V V R be a self-adjoint bilinear form, and f a linear functional on V. Assume a is coercive with coercivity constant α, and continuity constant γ. Continuous problem: search u V such that a(u, v) = f (v) v V Let V h V be a finite dimensional subspace of V Discrete problem Galerkin approximation: Search u h V h such that a(u h, v h ) = f (v h ) v h V h By Lax-Milgram, this problem has a unique solution as well. Lecture 14 Slide 43
Lecture 15 Slide 24 Céa s lemma What is the connection between u and u h? Let v h V h be arbitrary. Then α u u h 2 a(u u h, u u h ) (Coercivity) = a(u u h, u v h ) + a(u u h, v h u h ) = a(u u h, u v h ) (Galerkin Orthogonality) γ u u h u v h (Boundedness) As a result u u h γ α inf v h V h u v h Up to a constant, the error of the Galerkin approximation is the error of the best approximation of the solution in the subspace V h. Lecture 14 Slide 44
Lecture 15 Slide 25 From the Galerkin method to the matrix equation Let φ 1... φ n be a set of basis functions of V h. Then, we have the representation u h = n j=1 u jφ j In order to search u h V h such that it is actually sufficient to require a(u h, v h ) = f (v h ) v h V h a(u h, φ i = f (φ i ) (i = 1... n) ( n ) a u j φ j, φ i = f (φ i ) (i = 1... n) j=1 n a(φ j, φ i )u j = f (φ i ) (i = 1... n) j=1 AU = F with A = (a ij ), a ij = a(φ i, φ j ), F = (f i ), f i = F (φ i ), U = (u i ). Matrix dimension is n n. Matrix sparsity? Lecture 14 Slide 45
Lecture 15 Slide 26 Obtaining a finite dimensional subspace Let = (a, b) R 1 Let a(u, v) = λ(x) u vdx. Analysis I provides a finite dimensional subspace: the space of sin/cos functions up to a certain frequency spectral method Ansatz functions have global support full n n matrix OTOH: rather fast convergence for smooth data Generalization to higher dimensions possible Big problem in irregular domains: we need the eigenfunction basis of some operator... Spectral methods are successful in cases where one has regular geometry structures and smooth/constant coefficients e.g. Spectral Einstein Code Lecture 14 Slide 46
Definition of a Finite Element (Ciarlet) Triplet {K, P, Σ} where K R d : compact, connected Lipschitz domain with non-empty interior P: finite dimensional vector space of functions p : K R Σ = {σ 1... σ s } L(P, R): set of linear forms defined on P called local degrees of freedom such that the mapping Λ Σ : P R s p (σ 1 (p)... σ s (p)) is bijective, i.e. Σ is a basis of L(P, R). Lecture 15 Slide 27
Local shape functions Due to bijectivity of Λ Σ, for any finite element {K, P, Σ}, there exists a basis {θ 1... θ s } P such that σ i (θ j ) = δ ij (1 i, j s) Elements of such a basis are called local shape functions Lecture 15 Slide 28
Unisolvence Bijectivity of Λ Σ is equivalent to the condition (α 1... α s ) R s!p P such that σ i (p) = α i (1 i s) i.e. for any given tuple of values a = (α 1... α s ) there is a unique polynomial p P such that Λ Σ (p) = a. Equivalent to unisolvence: { dim P = Σ = s p P : σ i (p) = 0 (i = 1... s) p = 0 Lecture 15 Slide 29
Lagrange finite elements A finite element {K, P, Σ} is called Lagrange finite element (or nodal finite element) if there exist a set of points {a 1... a s } K such that σ i (p) = p(a i ) 1 i s {a 1... a s }: nodes of the finite element nodal basis: {θ 1... θ s } P such that θ j (a i ) = δ ij (1 i, j s) Lecture 15 Slide 30
Local interpolation operator Let {K, P, Σ} be a finite element with shape function bases {θ 1... θ s }. Let V (K) be a normed vector space of functions v : K R such that P V (K) The linear forms in Σ can be extended to be defined on V (K) local interpolation operator I K : V (K) P s v σ i (v)θ i P is invariant under the action of I K, i.e. p P, I K (p) = p: s Let p = αjθj Then, j=1 i=1 I K (p) = = s s s σ i(p)θ i = α jσ i(θ j)θ i i=1 s i=1 s α jδ ijθ i = j=1 i=1 j=1 j=1 s α jθ j Lecture 15 Slide 31
Local Lagrange interpolation operator Let V (K) = (C 0 (K)) I K : V (K) P v I K v = s v(a i )θ i i=1 Lecture 15 Slide 32
Simplices Let {a 0... a d } R d such that the d vectors a 1 a 0... a d a 0 are linearly independent. Then the convex hull K of a 0... a d is called simplex, and a 0... a d are called vertices of the simplex. Unit simplex: a 0 = (0...0), a 1 = (0, 1... 0)... a d = (0... 0, 1). K = { x R d : x i 0 (i = 1... d) and } d x i 1 i=1 A general simplex can be defined as an image of the unit simplex under some affine transformation F i : face of K opposite to a i n i : outward normal to F i Lecture 15 Slide 33
Barycentric coordinates Let K be a simplex. Functions λ i (i = 0... d): λ i : R d R x λ i (x) = 1 (x a i) n i (a j a i ) n i where a j is any vertex of K situated in F i. For x K, one has 1 (x a i) n i = (a j a i ) n i (x a i ) n i (a j a i ) n i (a j a i ) n i = (a j x) n i = dist(x, F i) (a j a i ) n i dist(a i, F i ) = dist(x, F i) F i /d dist(a i, F i ) F i /d = dist(x, F i) F i K i.e. λ i (x) is the ratio of the volume of the simplex K i (x) made up of x and the vertices of F i to the volume of K. Lecture 15 Slide 34
Barycentric coordinates II λ i (a j ) = δ ij λ i (x) = 0 x F i d i=0 λ i(x) = 1 x R d (just sum up the volumes) d i=0 λ i(x)(x a i ) = 0 x R d (due to λ i (x)x = x and λ i a i = x as the vector of linear coordinate functions) Unit simplex: λ0(x) = 1 d i=1 xi λi(x) = x i for 1 i d Lecture 15 Slide 35
Polynomial space P k Space of polynomials in x 1... x d of total degree k with real coefficients α i1...i d : Dimension: P k = p(x) = 0 i 1...i d k i 1+ +i d k α i1...i d x i1 1... x i d d dim P k = ( ) d + k = k k + 1, d = 1 1 2 (k + 1)(k + 2), d = 2 (k + 1)(k + 2)(k + 3), d = 3 1 6 dim P 1 = d + 1 3, d = 1 dim P 2 = 6, d = 2 10, d = 3 Lecture 15 Slide 36
P k simplex finite elements K: simplex spanned by a 0... a d in R d P = P k, such that s = dim P k For 0 i 0... i d k, i 0 + + i d = k, let the set of nodes be defined by the points a i1...i d ;k with barycentric coordinates ( i0 k... i d k ). Define Σ by σ i1...i d ;k(p) = p(a i1...i d ;k). Lecture 15 Slide 37
P 1 simplex finite elements K: simplex spanned by a 0... a d in R d P = P 1, such that s = d + 1 Nodes vertices Basis functions barycentric coordinates Lecture 15 Slide 38
P 2 simplex finite elements K: simplex spanned by a 0... a d in R d P = P 2, Nodes vertices + edge midpoints Basis functions: λ i (2λ i 1),(0 i d); 4λ i λ j, (0 i < j d) ( edge bubbles ) Lecture 15 Slide 39
General finite elements Simplicial finite elements can be defined on triangulations of polygonal domains. During the course we will stick to this case. For vector PDEs, one can define finite elements for vector valued functions A curved domain may be approximated by a polygonal domain h which is then triangulated. During the course, we will ignore this difference. As we have seen, more general elements are possible: cuboids, but also prismatic elements etc. Curved geometries are possible. Isoparametric finite elements use the polynomial space to define a mapping of some polyghedral reference element to an element with curved boundary Lecture 15 Slide 40
Conformal triangulations Let T h be a subdivision of the polygonal domain R d into non-intersecting compact simplices K m, m = 1... n e : = n e m=1 Each simplex can be seen as the image of a affine transformation of a reference (e.g. unit) simplex K: K m K m = T m ( K) We assume that it is conformal, i.e. if K m, K n have a d 1 dimensional intersection F = K m K n, then there is a face F of K and renumberings of the vertices of K n, K m such that F = T m ( F ) = T n ( F ) and T m F = T n F Lecture 15 Slide 41
Conformal triangulations II d = 1 : Each intersection F = K m K n is either empty or a common vertex d = 2 : Each intersection F = K m K n is either empty or a common vertex or a common edge d = 3 : Each intersection F = K m K n is either empty or a common vertex or a common edge or a common face Delaunay triangulations are conformal Lecture 15 Slide 42
Global interpolation operator I h Let {K, P K, Σ K } K Th be a triangulation of. Domain: D(I h ) = {v (L 1 ()) such that K T h, v K V (K)} For all v D(I h ), define I h v via s I h v K = I K (v K ) = σ K,i (v K )θ K,i K T h, i=1 Assuming θ K,i = 0 outside of K, one can write I h v = s σ K,i (v K )θ K,i, K T h i=1 mapping D(I h ) to the approximation space W h = {v h (L 1 ()) such that K T h, v h K P K } Lecture 15 Slide 43
H 1 -Conformal approximation using Lagrangian finite elemenents Conformal subspace of W h with zero jumps at element faces: V h = {v h W h : n, m, K m K n 0 (v h Km ) Km K n = (v h Kn ) Km K n } Then: V h H 1 (). Lecture 15 Slide 44
Zero jump at interfaces with Lagrangian finite elements Assume geometrically conformal mesh Assume all faces of K have the same number of nodes s For any face F = K 1 K 2 there are renumberings of the nodes of K 1 and K 2 such that for i = 1... s, a K1,i = a K2,i Then, v h K1 and v h K2 match at the interface K 1 K 2 if and only if they match at the common nodes v h K1 (a K1,i) = v h K2 (a K2,i) (i = 1... s ) Lecture 15 Slide 45
Global degrees of freedom Let {a 1... a N } = {a K,1... a K,s } K T h Degree of freedom map j : T h {1... s} {1... N} (K, m) j(k, m) the global degree of freedom number Global shape functions φ 1,..., φ N W h defined by φ i K (a K,m ) = { δ mn if n {1... s} : j(k, n) = i 0 otherwise Global degrees of freedom γ 1,..., γ N : V h R defined by γ i (v h ) = v h (a i ) Lecture 15 Slide 46
Lagrange finite element basis {φ 1,..., φ N } is a basis of V h, and γ 1... γ N is a basis of L(V h, R). Proof: {φ 1,..., φ N } are linearly independent: if N j=1 α jφ j = 0 then evaluation at a 1... a N yields that α 1... α N = 0. Let v h V h. It is single valued in a 1... a N. Let w h = N j=1 v h(a j )φ j. Then for all K T h, v h K and w h K coincide in the local nodes a K,1... a K,2, and by unisolvence, v h K = w h K. Lecture 15 Slide 47
Finite element approximation space P k c,h = Pk h = {v h C 0 ( h ) : K T h, v k T K P k } c for continuity across mesh interfaces. There are also discontinuous FEM spaces which we do not consider here. d k N = dim P k h 1 1 N v 1 2 N v + N el 1 3 N v + 2N el 2 1 N v 2 2 N v + N ed 2 3 N v + 2N ed + N el 3 1 N v 3 2 N v + N ed 3 3 N v + 2N ed + N f Lecture 15 Slide 48
P 1 global shape functions Lecture 15 Slide 49
P 2 global shape functions Node based Edge based Lecture 15 Slide 50
Global Lagrange interpolation operator Let V h = P k h I h : C 0 ( h ) V h N v v(a i )φ i i=1 Lecture 15 Slide 51
Quadrature rules Quadrature rule: K g(x) dx K l q l=1 ω l g(ξ l ) ξ l : nodes, Gauss points ω l : weights The largest number k such that the quadrature is exact for polynomials of order k is called order k q of the quadrature rule, i.e. k k q, p P k Error estimate: φ C kq+1 (K), 1 K K K p(x) dx = K φ(x) dx l q l=1 ch kq+1 K l q l=1 ω l g(ξ l ) ω l p(ξ l ) sup x K, α =k q+1 α φ(x) Lecture 15 Slide 52
Some common quadrature rules Nodes are characterized by the barycentric coordinates d k q l q Nodes Weights 1 1 1 ( 1, 1 ) 1 2 2 1 1 2 (1, 0), (0, 1), 1 2 2 3 2 ( 1 + 3, 1 3 ), ( 1 3, 1 + 2 6 2 6 2 3 ) 1, 1 6 2 6 2 2 5 3 ( 1, ), ( 1 + 3, 1 3 ), ( 1 3, 1 + 3 ) 8, 5, 5 2 2 20 2 20 2 20 2 20 18 18 18 2 1 1 ( 1, 1, 1 ) 1 3 3 3 1 1 3 (1, 0, 0), (0, 1, 0), (0, 0, 1), 1, 1 3 3 3 2 3 ( 1, 1, 0), ( 1, 0, 1 ), (0, 1, 1 ) 1, 1, 1 2 2 2 2 2 2 3 3 3 3 4 ( 1, 1, 1 ), ( 1, 1, 3 ), ( 1, 3, 1 ), ( 3, 1, 1 ), 9, 25, 25, 25 3 3 3 5 5 5 5 5 5 5 5 5 16 48 48 48 3 1 1 ( 1, 1, 1, 1 ) 1 4 4 4 4 1 4 (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) 2 4 ( 5 5, 5 5, 5 5, 5+3 5 )... 20 20 20 20 1, 1, 1, 1 4 4 4 4 1, 1, 1, 1 4 4 4 4 Lecture 15 Slide 53
Weak formulation of homogeneous Dirichlet problem Search u V = H0 1 () such that κ u v dx = fv dx v H0 1 () Then, a(u, v) := κ u v dx is a self-adjoint bilinear form defined on the Hilbert space H 1 0 (). Lecture 15 Slide 54
Galerkin ansatz Let V h V be a finite dimensional subspace of V Discrete problem Galerkin approximation: Search u h V h such that a(u h, v h ) = f (v h ) v h V h E.g. V h is the space of P1 Lagrange finite element approximations Lecture 15 Slide 55
Stiffness matrix for Laplace operator for P1 FEM Element-wise calculation: a ij = a(φ i, φ j ) = φ i φ j dx = Standard assembly loop: for i, j = 1... N do set a ij = 0 end for K T h do for m,n=0... d do s mn = λ m λ n dx end end K a jdof (K,m),j dof (K,n) = a jdof (K,m),j dof (K,n) + s mn K T h φ i K φ j K dx Local stiffness matrix: S K = (s K;m,n ) = λ m λ n dx K Lecture 15 Slide 56