The domain for this problem is Ω = { x   |   x ∈ ( 0 , 1 ) } {\displaystyle \Omega =\{x~|~x\in (0,1)\}} and the boundary consists of two points Γ = { 0 , 1 } {\displaystyle \Gamma =\{0,1\}} . Let us use n {\displaystyle n} nodes in the domain so that they divide the domain into n − 1 {\displaystyle n-1} nonoverlapping, two-noded elements. Consider the term K i j {\displaystyle K_{ij}} in equation (22). The integral can be written as a sum of integrals over each element as K i j = ∫ 0 1 ( d N i d x d N j d x + N i N j )   d x (29) = ∫ 0 x 1 ( d N i d x d N j d x + N i N j )   d x + ∫ x 1 x 2 ( d N i d x d N j d x + N i N j )   d x + ⋯ + ∫ x j − 1 x j ( d N i d x d N j d x + N i N j )   d x       + ∫ x j x j + 1 ( d N i d x d N j d x + N i N j )   d x + ⋯ + ∫ x n − 1 x n ( d N i d x d N j d x + N i N j )   d x   . {\displaystyle {\begin{aligned}K_{ij}&=\int _{0}^{1}\left({\cfrac {dN_{i}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{i}N_{j}\right)~dx\\{\text{(29)}}\quad &=\int _{0}^{x_{1}}\left({\cfrac {dN_{i}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{i}N_{j}\right)~dx+\int _{x_{1}}^{x_{2}}\left({\cfrac {dN_{i}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{i}N_{j}\right)~dx+\dots +\int _{x_{j-1}}^{x_{j}}\left({\cfrac {dN_{i}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{i}N_{j}\right)~dx\\&~~~+\int _{x_{j}}^{x_{j+1}}\left({\cfrac {dN_{i}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{i}N_{j}\right)~dx+\dots +\int _{x_{n-1}}^{x_{n}}\left({\cfrac {dN_{i}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{i}N_{j}\right)~dx~.\end{aligned}}} In this equation, i {\displaystyle i} and j {\displaystyle j} are node numbers. Therefore there are n × n {\displaystyle n\times n} possible values of K i j {\displaystyle K_{ij}} . Assume that node i {\displaystyle i} = 2 and node j {\displaystyle j} = 4. Then N i = 1 {\displaystyle N_{i}=1} at node 2 and zero at all the other nodes. Similarly, N j = 1 {\displaystyle N_{j}=1} at node 4 and zero at all other nodes. Also, N i {\displaystyle N_{i}} is non-zero only between nodes 1, 2, and 3 while N j {\displaystyle N_{j}} is nonzero only between nodes 3, 4, and 5. Since the domains of N i {\displaystyle N_{i}} and N j {\displaystyle N_{j}} do not overlap in this case, all the integrals must be zero. In general, if i {\displaystyle i} and j {\displaystyle j} are separated by more than one node, at least one of the basis functions has a zero value within each integral. The same holds for the derivatives of the basis functions. Therefore K i j = 0 {\displaystyle K_{ij}=0} if i {\displaystyle i} and j {\displaystyle j} are separated by more than one node. Therefore, there are three non-trivial cases that need to be looked at i = j {\displaystyle i=j} . i = j − 1 {\displaystyle i=j-1} . i = j + 1 {\displaystyle i=j+1} . For the first case, set i = j {\displaystyle i=j} in equation (29). That means (30) ∫ 0 1 ( d N j d x d N j d x + N j N j )   d x = ∫ x j − 1 x j ( d N j d x d N j d x + N j N j )   d x + ∫ x j x j + 1 ( d N j d x d N j d x + N j N j )   d x   . {\displaystyle {\text{(30)}}\qquad \int _{0}^{1}\left({\cfrac {dN_{j}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{j}N_{j}\right)~dx=\int _{x_{j-1}}^{x_{j}}\left({\cfrac {dN_{j}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{j}N_{j}\right)~dx+\int _{x_{j}}^{x_{j+1}}\left({\cfrac {dN_{j}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{j}N_{j}\right)~dx~.} After substituting the values of the basis functions (25) and their derivatives (26) into equation (30) and integrating, we get K j j = ∫ 0 1 ( d N j d x d N j d x + N j N j )   d x = 1 x j − x j − 1 + 1 x j + 1 − x j + x j + 1 − x j − 1 3   . {\displaystyle {K_{jj}=\int _{0}^{1}\left({\cfrac {dN_{j}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{j}N_{j}\right)~dx={\cfrac {1}{x_{j}-x_{j-1}}}+{\cfrac {1}{x_{j+1}-x_{j}}}+{\cfrac {x_{j+1}-x_{j-1}}{3}}~.}} For the second case, set i = j − 1 {\displaystyle i=j-1} in equation (29). In this case, the only non-zero integrals in equation (29) are the ones between x j − 1 {\displaystyle x_{j-1}} and x j {\displaystyle x_{j}} . Hence (31) ∫ 0 1 ( d N j − 1 d x d N j d x + N j − 1 N j )   d x = ∫ x j − 1 x j ( d N j − 1 d x d N j d x + N j − 1 N j )   d x   . {\displaystyle {\text{(31)}}\qquad \int _{0}^{1}\left({\frac {dN_{j-1}}{dx}}{\frac {dN_{j}}{dx}}+N_{j-1}N_{j}\right)~dx=\int _{x_{j-1}}^{x_{j}}\left({\frac {dN_{j-1}}{dx}}{\frac {dN_{j}}{dx}}+N_{j-1}N_{j}\right)~dx~.} After substituting the basis functions and their derivatives into equation (31) and integrating, we get K ( j − 1 ) j = ∫ 0 1 ( d N j − 1 d x d N j d x + N j − 1 N j )   d x = − 1 x j − x j − 1 + x j − x j − 1 6   . {\displaystyle {K_{(j-1)j}=\int _{0}^{1}\left({\frac {dN_{j-1}}{dx}}{\frac {dN_{j}}{dx}}+N_{j-1}N_{j}\right)~dx=-{\frac {1}{x_{j}-x_{j-1}}}+{\frac {x_{j}-x_{j-1}}{6}}~.}} For the third case, set i = j + 1 {\displaystyle i=j+1} in equation (29). In this case, the only non-zero integrals in equation (29) are the ones between x j {\displaystyle x_{j}} and x j + 1 {\displaystyle x_{j+1}} . Hence (32) ∫ 0 1 ( d N j d x d N j + 1 d x + N j N j + 1 )   d x = ∫ x j x j + 1 ( d N j d x d N j + 1 d x + N j N j + 1 )   d x   . {\displaystyle {\text{(32)}}\qquad \int _{0}^{1}\left({\frac {dN_{j}}{dx}}{\frac {dN_{j+1}}{dx}}+N_{j}N_{j+1}\right)~dx=\int _{x_{j}}^{x_{j+1}}\left({\frac {dN_{j}}{dx}}{\frac {dN_{j+1}}{dx}}+N_{j}N_{j+1}\right)~dx~.} After substituting the basis functions and their derivatives into equation (\ref{eq:Integralij+1}) and integrating, we get K j ( j + 1 ) = ∫ 0 1 ( d N j d x d N j + 1 d x + N j N j + 1 )   d x = − 1 x j + 1 − x j + x j + 1 − x j 6   . {\displaystyle {K_{j(j+1)}=\int _{0}^{1}\left({\frac {dN_{j}}{dx}}{\frac {dN_{j+1}}{dx}}+N_{j}N_{j+1}\right)~dx=-{\frac {1}{x_{j+1}-x_{j}}}+{\frac {x_{j+1}-x_{j}}{6}}~.}} The same process can be followed for the integral f j = ∫ 0 1 x   N j   d x = ∫ x j − 1 x j x   N j   d x + ∫ x j x j + 1 x   N j   d x = 2 x j 3 − 3 x j 2 x j − 1 + x j − 1 3 6 ( x j − x j − 1 ) + 2 x j 3 − 3 x j 2 x j + 1 + x j + 1 3 6 ( x j + 1 − x j )   . {\displaystyle {f_{j}=\int _{0}^{1}x~N_{j}~dx=\int _{x_{j-1}}^{x_{j}}x~N_{j}~dx+\int _{x_{j}}^{x_{j+1}}x~N_{j}~dx={\cfrac {2x_{j}^{3}-3x_{j}^{2}x_{j-1}+x_{j-1}^{3}}{6(x_{j}-x_{j-1})}}+{\cfrac {2x_{j}^{3}-3x_{j}^{2}x_{j+1}+x_{j+1}^{3}}{6(x_{j+1}-x_{j})}}~.}} Now that we know the components K i j {\displaystyle K_{ij}} and f j {\displaystyle f_{j}} , we can solve the system of equations (23) for the unknowns a i {\displaystyle a_{i}} . This gives us our finite element solution for Problem 2. In the above we did not go through the assembly process that you are familiar with from introductory finite elements. We can simplify things if we use just compute the integrals over each element and assemble them to get the final K {\displaystyle \mathbf {K} } and f {\displaystyle \mathbf {f} } matrices. To see how the assembly process works, let us recall equation (21) (33) ∑ i = 1 n a i ∫ 0 1 ( d N i d x d N j d x + N i N j )   d x − ∫ 0 1 x   N j   d x = 0 j = 1 ... n   . {\displaystyle {\text{(33)}}\qquad {\sum _{i=1}^{n}a_{i}\int _{0}^{1}\left({\cfrac {dN_{i}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{i}N_{j}\right)~dx-\int _{0}^{1}x~N_{j}~dx=0\qquad j=1\dots n~.}} We can rewrite this equation as ∑ i = 1 n K j i a i = f j ≡ ∑ i = 1 n K i j a i = f j {\displaystyle \sum _{i=1}^{n}K_{ji}a_{i}=f_{j}\qquad \equiv \qquad \sum _{i=1}^{n}K_{ij}a_{i}=f_{j}} where (34) K i j = a ( N i , N j ) = ∫ 0 1 ( d N i d x d N j d x + N i N j )   d x and f j = ⟨ x , N j ⟩ = ∫ 0 1 x   N j   d x   . {\displaystyle {\text{(34)}}\qquad K_{ij}=a(N_{i},N_{j})=\int _{0}^{1}\left({\cfrac {dN_{i}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{i}N_{j}\right)~dx\qquad {\text{and}}\qquad f_{j}=\langle x,N_{j}\rangle =\int _{0}^{1}x~N_{j}~dx~.} Let us define (35) F ( N i , N j ) := d N i d x d N j d x + N i N j   . {\displaystyle {\text{(35)}}\qquad {\mathcal {F}}(N_{i},N_{j}):={\cfrac {dN_{i}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{i}N_{j}~.} Then the first of the equations in (34) can be written as (36) a ( N i , N j ) = ∫ 0 1 F ( N i , N j )   d x   . {\displaystyle {\text{(36)}}\qquad a(N_{i},N_{j})=\int _{0}^{1}{\mathcal {F}}(N_{i},N_{j})~dx~.} From equation (29) we can see that the integral over the entire domain Ω {\displaystyle \Omega } can be written as a sum of integrals over the elements Ω e {\displaystyle \Omega _{e}} . Therefore, we can write equation (36) as (37) a ( N i , N j ) = ∫ Ω F ( N i , N j )   d x = ∑ e = 1 E ∫ Ω e F ( N i , N j )   d x   . {\displaystyle {\text{(37)}}\qquad a(N_{i},N_{j})=\int _{\Omega }{\mathcal {F}}(N_{i},N_{j})~dx=\sum _{e=1}^{E}\int _{\Omega _{e}}{\mathcal {F}}(N_{i},N_{j})~dx~.} Let N i e {\displaystyle N_{i}^{e}} be the local basis functions in an element. Then equation (37) can be written as a ( N i , N j ) = ∑ e = 1 E ∫ Ω e F ( N i e , N j e )   d x = ∑ e = 1 E a e ( N i e , N j e ) = ∑ e = 1 E K i j e   . {\displaystyle a(N_{i},N_{j})=\sum _{e=1}^{E}\int _{\Omega _{e}}{\mathcal {F}}(N_{i}^{e},N_{j}^{e})~dx=\sum _{e=1}^{E}a^{e}(N_{i}^{e},N_{j}^{e})=\sum _{e=1}^{E}K_{ij}^{e}~.} Similarly, the second equation in (34) can be written as ⟨ x , N j ⟩ = ∑ e = 1 E ⟨ x e , N j e ⟩ = ∑ e = 1 E f j e {\displaystyle \langle x,N_{j}\rangle =\sum _{e=1}^{E}\langle x^{e},N_{j}^{e}\rangle =\sum _{e=1}^{E}f_{j}^{e}} where x e {\displaystyle x^{e}} indicates that the integral is over the element. Therefore, the matrix K {\displaystyle \mathbf {K} } and the vector f {\displaystyle \mathbf {f} } can be expressed as a sum over the elements in the form K = ∑ e = 1 E K e and f = ∑ e = 1 E f e   . {\displaystyle \mathbf {K} =\sum _{e=1}^{E}\mathbf {K} ^{e}\qquad {\text{and}}\qquad \mathbf {f} =\sum _{e=1}^{E}\mathbf {f} ^{e}~.} This is the familiar assembly process. From this process it is clear that if we can find the weak form for one element, then the finite element system of equations for any combination of such elements can be computed by assembly. ← Finite element basis functions Finite elements Linear heat equation →
{'wiki_source': 'wikiversity', 'other_info': "{'content_model': 'wikitext', 'language': 'en', 'title': 'Finite elements/Model finite element approximation', 'type': 'text'}"}