OptFEM2DP1 Toolbox  V1.2
Matlab/Octave Optimized P1-Lagrange Finite Element Method in 2D
Opt/StiffElasAssembling2DP1OptV2.m
Go to the documentation of this file.
00001 function [K]=StiffElasAssembling2DP1OptV2(nq,nme,q,me,areas,lambda,mu,Num)
00002 % function K=StiffElasAssembling2DP1OptV2(nq,nme,q,me,areas,lambda,mu,Num)
00003 %   Assembly of the Stiffness Elasticity Matrix by `P_1`-Lagrange finite elements
00004 %   using "OptV2" 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=StiffElasAssembling2DP1OptV2(Th.nq,Th.nme,Th.q,Th.me,Th.areas,lambda,mu,Num);@endverbatim
00041 %  
00042 % See also:
00043 %   #BuildIgJgP1VF, #ElemStiffElasMatBaVec2DP1, #ElemStiffElasMatBbVec2DP1
00044 % Copyright:
00045 %   See \ref license
00046 [Ig,Jg]=BuildIgJgP1VF(Num,me,nq);
00047 switch Num
00048 case {0,1}
00049   Kg=ElemStiffElasMatBaVec2DP1(q,me,areas,lambda,mu);
00050 case {2,3}
00051   Kg=ElemStiffElasMatBbVec2DP1(q,me,areas,lambda,mu);
00052 end
00053 K = sparse(Ig(:),Jg(:),Kg(:),2*nq,2*nq);
 All Files Functions