OptFEM3DP1 Toolbox: Opt/StiffElasAssembling3DP1OptV2.m Source File

| OptFEM3DP1 Toolbox 20130614_170440 Matlab/Octave Optimized P1-Lagrange Finite Element Method in 3D

- Main Page
- Related Pages
- Files

- File List
- File Members

All Files Functions Variables Pages
StiffElasAssembling3DP1OptV2.m
Go to the documentation of this file.
1 function K=StiffElasAssembling3DP1OptV2(nq,nme,q,me,volumes,lambda,mu,Num)
2 % function K=StiffElasAssembling3DP1OptV2(nq,nme,q,me,volumes,lambda,mu,Num)
3 % Assembly of the Stiffness Elasticity Matrix by `P_1`-Lagrange finite elements in 3D
4 % using OptV2 version (see report).
5 %
6 % The Stiffness Elasticity Matrix is given by
7 % ``\StiffElas_{m,l}=\int_{\DOMH} \Odv^t(\BasisFuncTwoD_m) \Ocv(\BasisFuncTwoD_l)dT, \ \forall (m,l)\in\ENS{1}{2\,\nq}^2,``
8 % where `\BasisFuncTwoD_m` are `P_1`-Lagrange vector basis functions.
9 % Here `\Ocv=(\Occ_{xx},\Occ_{yy},\Occ_{zz}, \Occ_{xy}, \Occ_{yz}, \Occ_{xz})^t` and
10 % `\Odv=(\Odc_{xx},\Odc_{yy},\Odc_{zz},2\Odc_{xy},2\Odc_{yz},2\Odc_{xz})^t`
11 % are the elastic stress and strain tensors respectively.
12 %
13 % Parameters:
14 % nq: total number of vertices, also denoted by `\nq`.
15 % nme: total number of elements, also denoted by `\nme`.
16 % q: Array of vertices coordinates, `3\times\nq` array. <br/>
17 % `{\q}(\il,j)` is the
18 % `\il`-th coordinate of the `j`-th vertex, `\il\in\{1,2,3\}` and
19 % `j\in\ENS{1}{\nq}`
20 % me: Connectivity array, `4\times\nme` array. <br/>
21 % `\me(\jl,k)` is the storage index of the
22 % `\jl`-th vertex of the `k`-th tetrahedron in the array `\q` of vertices coordinates, `\jl\in\{1,2,3,4\}` and
23 % `k\in{\ENS{1}{\nme}}`.
24 % volumes: Array of volumes, `1\times\nme array`. volumes(k) is the volume
25 % of the k-th tetrahedron.
26 % lambda: the first Lame coefficient in Hooke's law
27 % mu: the second Lame coefficient in Hooke's law
28 % Num:
29 % - 0 global alternate numbering with local alternate numbering (classical method),
30 % - 1 global block numbering with local alternate numbering,
31 % - 2 global alternate numbering with local block numbering,
32 % - 3 global block numbering with local block numbering.
33 %
34 % Return values:
35 % K: `3\nq\times 3\nq` stiffness elasticity sparse matrix
36 %
37 % Example:
38 % @verbatim
39 % Th=CubeMesh(10);
40 % KK=StiffElasAssembling3DP1OptV2(Th.nq,Th.nme,Th.q,Th.me,Th.areas,1.,0.25,0);@endverbatim
41 %
42 % See also:
43 % #BuildIgJgP1VF, #BuildElemStiffElasMatFuncVec
44 % Copyright:
45 % See \ref license
46
47 [Ig,Jg]=BuildIgJgP1VF(Num,me,nq);
48 ElemStiffElasMatVec=BuildElemStiffElasMatFuncVec(Num);
49 [Kg]=ElemStiffElasMatVec(q,me,volumes,lambda,mu);
50
51 K=sparse(Ig(:),Jg(:),Kg(:),3*nq,3*nq);