forked from claudioperez/GeometricTransformations
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeomTran3dFrm_Push.m
More file actions
218 lines (184 loc) · 5.13 KB
/
Copy pathGeomTran3dFrm_Push.m
File metadata and controls
218 lines (184 loc) · 5.13 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
function [p, k] = GeomTran3dFrm_Push(CoroData, LocalState, ElemState, CoroState, action, ElemType)
% ==========================================================================================
%
% [1] Perez, C.M., and Filippou F. C.. "On Nonlinear Geometric Transformations of Finite
% Elements" Int. J. Numer. Meth. Engrg. 2024 (Expected)
%
% ==========================================================================================
% function by Claudio M. Perez 2023
% ------------------------------------------------------------------------------------------
%
nen = length(LocalState.u)/6;
ndf = 6*nen;
p = LocalState.q;
if strcmp(action, 'stif')
k = LocalState.k;
else
k = zeros(ndf);
end
if strcmp(action, 'forc')
%
% do g loop
%
% (a) Update Rotation Parameters
%---------------------------------------------------------------------------
ath = G3_Push(LocalState, ElemType, p);
p = ath'*p;
% (b) Isometric Transformation
%---------------------------------------------------------------------------
CoroState.u = ExtrReshu(LocalState, 6, nen);
[ar, ap] = G2_Push(CoroState, CoroData, p);
if ~CoroData.Petrov
p = ap'*p;
p = ar'*p;
else
p = ar'*p;
end
% (c) Interpolation Parameters
%---------------------------------------------------------------------------
aa = G1_Push(ElemState, CoroData, p);
p = aa'*p; %%
else
%
% do g loop
%
%% (a) Update Rotation Parameters
%---------------------------------------------------------------------------
[ath, kg] = G3_Push(LocalState, ElemType, p);
p = ath'*p;
k = ath'*k*ath + kg;
%% (b) Isometric Transformation
%---------------------------------------------------------------------------
CoroState.u = ExtrReshu(LocalState, 6, nen);
[ar, ap, kr, kp] = G2_Push(CoroState, CoroData, p);
if ~CoroData.Petrov
p = ap'*p;
k = ap'*k*ap + kp;
p = ar'*p;
k = ar'*k*ar + kr;
elseif false
k = k*ap;
p = ar'*p;
k = ar'*k*ar + kr;
else
% k = k*ap;
p = ar'*p;
k = ar'*k*ar + kr;
end
%% (c) Interpolation Parameters
%---------------------------------------------------------------------------
[aa, kg] = G1_Push(ElemState, CoroData, p);
p = aa'*p; %%
k = aa'*k*aa + kg;
% end g loop
end
end % function GeomTran3dFrm_Push
% (c) Element interpolation
%---------------------------------------------------------------------------
function [ag, kg] = G3_Push(LocalState, ElemType, p)
ndf = length(p);
nen = ndf/6;
ag = eye(ndf);
kg = zeros(ndf);
if strcmp(ElemType.Solve, 'Iter') || ElemType.Petrov
return
end
% if ~strcmp(ElemType.Solve, 'Iter') && ~ElemType.Petrov
% Extract element rotational parameter type
switch ElemType.Solve
case 'Init'
[uloc, ~, ~] = ExtrReshu(LocalState, 6, nen);
case 'Incr'
[~, uloc, ~] = ExtrReshu(LocalState, 6, nen);
end
% Loop over rotational blocks
j = 1;
for i=4:6:ndf
ag(i:i+2, i:i+2) = dLogSO3(uloc(i:i+2));
% ag(i:i+2, i:i+2) = dLogC90(uloc(i:i+2), LocalState.Triad(j).Rmat);
j = j + 1;
end
if nargout > 1
% Loop over rotational blocks
for i=4:6:ndf
kg(i:i+2, i:i+2) = ddExpInvSO3(uloc(i:i+2), p(i:i+2));
end
end
% end
end
%% (b) Isometric projector
function [ar, ap, kr, kp] = G2_Push(CoroState, CoroData, p)
%
% Note: ag = ap*ar
%
ndf = length(p);
nen = ndf/6;
Tr = CoroState.CorotTriad;
%CoroState.u = ExtrReshu(LocalState, 6, nen);
% spin-fitter and spin lever
[W, Lth] = Tran3dFrm_IsoPush(CoroData, CoroState);
% Projector
ap = eye(ndf) - Lth*W;
% Reference coordinate transormation
ari = repmat({Tr'},nen*2,1);
ar = blkdiag(ari{:});
if nargout > 2
% Stiffness kg
if ~CoroData.Petrov
pbar = ap'*p;
Pn = zeros(nen*6,3);
for i=1:nen
Pn(6*(i-1)+1:6*i-3,1:3) = Spin(pbar(6*(i-1)+1:6*i-3));
end
Pnm = Pn;
for i=1:nen
Pnm(6*(i-1)+4:6*i,1:3) = Spin(pbar(6*(i-1)+4:6*i));
end
kp = - W'*Pn'*ap;
kr = - ar'*Pnm*W*ar;
else
kp = zeros(ndf);
kr = zeros(ndf);
end
end
end
%% (a) (re)parameterization of rotation update
function [aa, kg] = G1_Push(ElemState, CoroData, p)
ndf = length(p);
nen = ndf/6;
aa = eye(ndf);
kg = zeros(ndf);
% return
if strcmp(CoroData.RotName, 'Iter')
return
end
switch CoroData.RotName
case 'Init'
[urot, ~, ~] = ExtrReshu(ElemState, 6, nen);
case 'Incr'
[~, urot, ~] = ExtrReshu(ElemState, 6, nen);
end
if CoroData.Quaternion
qI = Qvec2Quat(urot( 4: 6)');
qJ = Qvec2Quat(urot(10:12)');
aa(4:6,4:6) = (ExpSU2(qI) + eye(3))/qI(4);
aa(10:12,10:12)= (ExpSU2(qJ) + eye(3))/qJ(4);
else
% Loop over rotational blocks
for i=4:6:ndf
aa(i:i+2, i:i+2) = dExpSO3(urot(i:i+2));
end
end
if nargout > 1
% Stiffness
if CoroData.Quaternion
kg( 4: 6, 4: 6) = kg( 4: 6, 4: 6) + ddExpSU2(qI, p( 4: 6));
kg(10:12,10:12) = kg(10:12,10:12) + ddExpSU2(qJ, p(10:12));
else
% Loop over rotational blocks
for i=4:6:ndf
kg(i:i+2, i:i+2) = kg(i:i+2, i:i+2) + dTanSO3(urot(i:i+2), p(i:i+2), 'L');
end
end
end
end