OptFEM3DP1 Toolbox: Opt/MassVFAssembling3DP1OptV1.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
MassVFAssembling3DP1OptV1.m
Go to the documentation of this file.
1 function M=MassVFAssembling3DP1OptV1(nq,nme,me,volumes,Num)
2 % function M=MassVFAssembling3DP1OptV1(nq,nme,me,volumes,Num)
3 % Assembly of the Mass vectors fields Matrix by `P_1`-Lagrange finite elements in 3D
4 % using OptV1 version (see report).
5 %
6 % The Mass vectors fields is given by
7 % ``\MassVF_{i,j}=\int_\DOMH \DOT{\BasisFuncTwoD_m(\q)}{ \BasisFuncTwoD_l(\q)}d(\q), \ \forall (m,l)\in\ENS{1}{3\,\nq}^2,``
8 % where `\BasisFuncTwoD_m` are `P_1`-Lagrange vector basis functions.
9 %
10 % Parameters:
11 % nq: total number of vertices, also denoted by `\nq`.
12 % nme: total number of elements, also denoted by `\nme`.
13 % me: Connectivity array, `4\times\nme` array. <br/>
14 % `\me(\jl,k)` is the storage index of the
15 % `\jl`-th vertex of the `k`-th tetrahedron in the array `\q` of vertices coordinates, `\jl\in\{1,2,3,4\}` and
16 % `k\in{\ENS{1}{\nme}}`.
17 % volumes: Array of volumes, `1\times\nme array`. volumes(k) is the volume
18 % of the k-th tetrahedron.
19 % Num:
20 % - 0 global alternate numbering with local alternate numbering (classical method),
21 % - 1 global block numbering with local alternate numbering,
22 % - 2 global alternate numbering with local block numbering,
23 % - 3 global block numbering with local block numbering.
24 %
25 % Return values:
26 % M: `3\nq\times 3\nq` Global Mass vectors fields sparse matrix
27 %
28 % Example:
29 % @verbatim
30 % Th=CubeMesh(10);
31 % Mvf=MassVFAssembling3DP1OptV1(Th.nq,Th.nme,Th.me,Th.areas,0);@endverbatim
32 %
33 % See also:
34 % #BuildIkFunc, #BuildElemMassVFMatFunc
35 % Copyright:
36 % See \ref license
37
38 ElemMassVFMat=BuildElemMassVFMatFunc(Num);
39 E=ElemMassVFMat(1);
40 E=E(:);
41 GetI=BuildIkFunc(Num,nq);
42
43 Ig=zeros(144*nme,1);Jg=zeros(144*nme,1);Kg=zeros(144*nme,1);
44 kk=1:144;
45 for k=1:nme
46 I=GetI(me,k);
47 jA=ones(12,1)*I;
48 iA=jA';
49
50 Ig(kk)=iA(:);
51 Jg(kk)=jA(:);
52 Kg(kk)=volumes(k)*E;
53 kk=kk+144;
54 end
55
56 M=sparse(Ig,Jg,Kg,3*nq,3*nq);