-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFEMBarComputerIterative.m
More file actions
115 lines (98 loc) · 3.11 KB
/
Copy pathFEMBarComputerIterative.m
File metadata and controls
115 lines (98 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
classdef FEMBarComputerIterative < handle
properties (Access = private)
F
x
Tnod
Td
mat
Tmat
nElem
vR
vL
vF
uL
solverType
solver
KG
end
properties (Access = public)
stress
end
methods (Access = public)
function obj = FEMBarComputerIterative(t)
obj.init(t);
obj.createSolver();
end
function compute(obj)
obj.computeDoFMatrix();
obj.computeStiffnessMatrix();
obj.computeUnknownDisplacements();
obj.computeStress();
end
end
methods (Access = private)
function init(obj,t)
data = load(['Tests/BC',t,'.mat']);
obj.F = data.BC(1).f;
obj.x = data.BC(2).f;
obj.Tnod = data.BC(3).f;
obj.mat = data.BC(4).f;
obj.Tmat = data.BC(5).f;
obj.nElem = 12;
obj.vR = [1 2 9 10];
obj.vL = [3 4 5 6 7 8 11 12 13 14 15 16];
obj.vF = [2 4 6];
obj.solverType = 'Iterat';
end
function computeStiffnessMatrix(obj)
s.nElem = obj.nElem;
s.mat1 = obj.mat(1);
s.mat2 = obj.mat(2);
s.Tnod = obj.Tnod;
s.x = obj.x;
s.Td = obj.Td;
Kcomputed = StiffnessMatrixComputer(s);
Kcomputed.compute();
obj.KG = Kcomputed.K;
end
function computeDoFMatrix(obj)
s.nElem = obj.nElem;
s.Tnod = obj.Tnod;
Tdcomputed = ConnectivityMatrixComputer(s);
Tdcomputed.compute();
obj.Td = Tdcomputed.Td;
end
function createSolver(obj)
s.type = obj.solverType;
obj.solver = SolverFactory.create(s);
end
function solveSystem(obj,s)
obj.solver.solveSystem(s);
obj.uL = obj.solver.u;
end
function computeUnknownDisplacements(obj)
s.K_LL = obj.computeReducedStiffnessMatrix();
s.F_extL = obj.computeReducedExternalForcesVector();
obj.solveSystem(s);
end
function K_LL = computeReducedStiffnessMatrix(obj)
K_LL = obj.KG(obj.vL,obj.vL);
end
function F_extL = computeReducedExternalForcesVector(obj)
F_extL = zeros(obj.nElem,1);
F_extL(obj.vF) = obj.F;
end
function computeStress(obj)
s.nElem = obj.nElem;
s.uL = obj.uL;
s.vL = obj.vL;
s.x = obj.x;
s.Tnod = obj.Tnod;
s.Td = obj.Td;
s.mat1 = obj.mat(1);
stressObject = StressComputer(s);
stressObject.compute();
obj.stress = stressObject.stress;
end
end
end