![]() |
OptFEM2DP1 Toolbox
V1.2
Matlab/Octave Optimized P1-Lagrange Finite Element Method in 2D
|
00001 function K=StiffElasAssembling2DP1base(nq,nme,q,me,areas,lambda,mu,Num) 00002 % function K=StiffElasAssembling2DP1base(nq,nme,q,me,areas,lambda,mu,Num) 00003 % Assembly of the Stiffness Elasticity Matrix by `P_1`-Lagrange finite elements 00004 % using basic version (see report). 00005 % 00006 % The Stiffness Elasticity Matrix is given by 00007 % ``\StiffElas_{m,l}=\int_{\DOMH} \Odv^t(\BasisFuncTwoD_m) \Ocv(\BasisFuncTwoD_l)dT, \ \forall (m,l)\in\ENS{1}{2\,\nq}^2,`` 00008 % where `\BasisFuncTwoD_m` are `P_1`-Lagrange vector basis functions. 00009 % Here `\Ocv=(\Occ_{xx},\Occ_{yy},\Occ_{xy})^t` and `\Odv=(\Odc_{xx},\Odc_{yy},2\Odc_{xy})^t` 00010 % are the elastic stress and strain tensors respectively. 00011 % 00012 % Parameters: 00013 % nq: total number of nodes in the mesh, also denoted by `\nq`. 00014 % nme: total number of triangles, also denoted by `\nme`. 00015 % q: Array of vertices coordinates, `2\times\nq` array. <br/> 00016 % `{\q}(\il,j)` is the 00017 % `\il`-th coordinate of the `j`-th vertex, `\il\in\{1,2\}` and 00018 % `j\in\ENS{1}{\nq}` 00019 % me: Connectivity array, `3\times\nme` array. <br/> 00020 % `\me(\jl,k)` is the storage index of the 00021 % `\jl`-th vertex of the `k`-th triangle in the array `\q`, `\jl\in\{1,2,3\}` and 00022 % `k\in{\ENS{1}{\nme}}`. 00023 % areas: Array of areas, `1\times\nme` array. areas(k) is the area of the `k`-th triangle. 00024 % lambda: the first Lame coefficient in Hooke's law 00025 % mu: the second Lame coefficient in Hooke's law 00026 % Num: 00027 % - 0 global alternate numbering with local alternate numbering (classical method), 00028 % - 1 global block numbering with local alternate numbering, 00029 % - 2 global alternate numbering with local block numbering, 00030 % - 3 global block numbering with local block numbering. 00031 % 00032 % Return values: 00033 % K: `2\nq\times 2\nq` stiffness elasticity sparse matrix 00034 % 00035 % Example: 00036 % @verbatim 00037 % Th=SquareMesh(10); 00038 % lambda=1.; mu=1.; 00039 % Num=0; 00040 % KK=StiffElasAssembling2DP1base(Th.nq,Th.nme,Th.q,Th.me,Th.areas,lambda,mu,Num);@endverbatim 00041 % 00042 % See also: 00043 % #BuildIkFunc, #BuildElemStiffElasMatFunc 00044 % Copyright: 00045 % See \ref license 00046 K=sparse(2*nq,2*nq); 00047 GetI=BuildIkFunc(Num,nq); 00048 ElemStiffElasMat=BuildElemStiffElasMatFunc(Num); 00049 C=[lambda+2*mu,lambda,0;lambda,lambda+2*mu,0;0,0,mu]; 00050 for k=1:nme 00051 MatElem=ElemStiffElasMat(q(:,me(:,k)),areas(k),C); 00052 I=GetI(me,k); 00053 for il=1:6 00054 for jl=1:6 00055 K(I(il),I(jl))=K(I(il),I(jl))+MatElem(il,jl); 00056 end 00057 end 00058 end 00059