OptFEM3DP1 Toolbox: Opt/StiffAssembling3DP1OptV0.m Source File

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

- Main Page
- Related Pages
- Files

- File List
- File Members

All Files Functions Variables Pages
StiffAssembling3DP1OptV0.m
Go to the documentation of this file.
1 function M=StiffAssembling3DP1OptV0(nq,nme,q,me,volumes)
2 % function R=StiffAssembling3DP1OptV0(nq,nme,q,me,volumes)
3 % Assembly of the Stiffness Matrix by `P_1`-Lagrange finite elements in 3D
4 % - OptV0 version (see report).
5 %
6 % The Stiffness Matrix `\Stiff` is given by
7 % ``\Stiff_{i,j}=\int_\DOMH \DOT{\GRAD\FoncBase_i(\q)}{\GRAD\FoncBase_j(\q)}d\q,\ \forall (i,j)\in{\ENS{1}{\nq}}^2``
8 % where `\FoncBase_i` are `P_1`-Lagrange 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 % q: Array of vertices coordinates, `3\times\nq` array. <br/>
14 % `{\q}(\il,j)` is the
15 % `\il`-th coordinate of the `j`-th vertex, `\il\in\{1,2,3\}` and
16 % `j\in\ENS{1}{\nq}`
17 % me: Connectivity array, `4\times\nme` array. <br/>
18 % `\me(\jl,k)` is the storage index of the
19 % `\jl`-th vertex of the `k`-th tetrahedron in the array `\q` of vertices coordinates, `\jl\in\{1,2,3,4\}` and
20 % `k\in{\ENS{1}{\nme}}`.
21 % volumes: Array of volumes, `1\times\nme array`. volumes(k) is the volume
22 % of the k-th tetrahedron.
23 %
24 % Return values:
25 % R: Global stiffness matrix, `\nq\times\nq` sparse matrix.
26 %
27 % Example:
28 % @verbatim
29 % Th=CubeMesh(10);
30 % R=StiffAssembling3DP1OptV0(Th.nq,Th.nme,Th.q,Th.me,Th.volumes);
31 % @endverbatim
32 %
33 % See also:
34 % #ElemStiffMat3DP1D0
35 % Copyright:
36 % See \ref license
37 M=sparse(nq,nq);
38 for k=1:nme
39 I=me(:,k);
40 M(I,I)=M(I,I)+ElemStiffMat3DP1D0(q(:,me(:,k)),volumes(k));
41 end