-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExactShear3dFrm.m
740 lines (622 loc) · 24.4 KB
/
ExactShear3dFrm.m
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
function ElemResp = DisplShear3dFrm_wCS(action,el_no,xyz,ElemData,ElemState)
% Geometrically exact 3D frame element.
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% When the character variable ACTION has one of the following values,
% the function performs the listed operations and returns the results in ELEMRESP:
% ACTION = 'size': report size of element arrays
% 'chec': check element property data for omissions and assign default values
% 'defo': report function handle for deformed shape
% 'init': initialize element history variables
% 'forc': report element resisting forces
% 'stif': report element stiffness matrix and resisting forces
% 'post': report post-processing information
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% The data structure ELEMRESP stands for the following data object(s) for each ACTION:
% ELEMRESP = ARSZ for action = 'size'
% ELEMRESP = ELEMDATA for action = 'chec'
% ELEMRESP = FunHandle for action = 'defo'
%
% ELEMRESP = ELEMSTATE for action = 'init'
% ELEMRESP = ELEMSTATE for action = 'stif'
% ELEMRESP = ELEMSTATE for action = 'forc'
% ELEMRESP = ELEMPOST for action = 'post'
% ELEMRESP is empty for unsupported keywords
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% ELEMDATA is a data structure with element property information in fields
% Geom = character variable for geometric transformation of node variables
% (linear, PDelta or corotational) (default=linear)
% w = uniform element load ( w(1) = longitudinal, w(2) = transverse )
% JntOff = rigid joint offsets in global X and Y at element ends;
% column 1 for node i, column 2 for node j
% nIP = number of integration points
% IntTyp = function name for element integration
% SecName = function name for section s-e response
% SecData{i} = section property data at integration point i (see function with SecName)
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% ELEMSTATE is a data structure with the current element state; it has the fields
% u = vector of total element displacements in global reference
% Du = vector of element displacement increments from last convergence
% DDu = vector of element displacement increments from last iteration
% ke = element stiffness matrix in global reference;
% updated under ACTION = 'stif'
% p = element resisting force vector in global reference;
% updated under ACTION = 'stif' or 'forc'
% Past = element history variables at last converged state
% Pres = current element history variables
% lamda = row vector of current load factor(s)
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% Limitations
% - Static analysis only, mass is not implemented
% - Does not yet properly handle initially curved geometry. Use of
% interpolation functions assumes nodes are uniformly spaced.
% - No joint offsets
%
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%
% [1] Simo JC (1985) A finite strain beam formulation. The three-dimensional
% dynamic problem. Part I.
% Computer Methods in Applied Mechanics and Engineering, 49(1):55–70.
% https://doi.org/10.1016/0045-7825(85)90050-7
%
% [2] Simo JC, Vu-Quoc L (1986) A three-dimensional finite-strain rod model
% Part II: Computational aspects.
% Computer Methods in Applied Mechanics and Engineering, 58(1):79–116.
% https://doi.org/10/b8wd4z
%
% [3] Perez, C.M., and Filippou F. C.. "On Nonlinear Geometric Transformations of Finite
% Elements" Int. J. Numer. Meth. Engrg. 2024 (Expected)
%
% =========================================================================================
% function by Claudio Perez 2023
% -----------------------------------------------------------------------------------------
%
ElemType.ndm = 3; % Element formulated in 3D
ElemType.ndf = 6; % Number DOF per node
ElemType.nsr = 6; % Number of section resultants
ElemType.isr = 1:6; % Section resultants are [ N Vy Vz T My Mz ]
ElemType.nqv = 12; %
ElemType.iqv = 1:12; % q : [ *change iqv* ]
ElemType.nen = 1:4;
ElemType.Shear = true; %
ElemType.Field = 'Displ'; % Displacement formulation
ndf = 6;
%
switch action
%% Report size of element arrays
case 'size'
ElemResp = ones(size(xyz,2), ElemType.ndf);
return
%% Report element type information
case 'type'
% Delare element type information
ElemResp = ElemType;
ElemResp.Solve = ElemData.Update;
ElemResp.Petrov = ElemData.Petrov;
return
%% Check element data; assign default values, if necessary
case 'chec'
% Validate user input and
ElemResp = Check(el_no, xyz, ElemData, ElemType);
return
case 'init'
LState = Init(xyz, ElemData);
ElemResp = LState;
if nargin > 4 && isfield(ElemState, 'u')
ElemResp.u = ElemState.u;
if ~isfield(ElemState, 'Du')
ElemResp.Du = ElemState.u;
ElemResp.DDu = ElemState.u;
else
ElemResp.Du = ElemState.Du;
ElemResp.DDu = ElemState.DDu;
end
end
return
%% State determination; report element resisting forces and/or stiffness
case {'forc', 'stif'}
ElemResp = BasicUpdate(action, el_no, xyz, ElemData, ElemState);
return
%% Report function handle for deformed shape
case 'defo'
ElemResp = @DeformedShape;
return
%% Report post-processing information
case 'post'
ElemPost.ve = zeros(6,1);
ElemResp = ElemPost;
return
otherwise
warning(['Unknown action in ' mfilename ': "' action '"']);
end % switch
end % function
%%
function ElemData = Check(el_no, xyz, ElemData, ElemType)
% Check element configuration and fill data that is constant
% over element's lifetime.
% =======================================================================
% function by Claudio M. Perez 2023
% -----------------------------------------------------------------------
ElemData.nel = size(xyz,2);
% Uniformly reduced integration by default
if ~isfield(ElemData, 'nIP'), ElemData.nIP = ElemData.nel-1; end
if ~isfield(ElemData, 'IntTyp'), ElemData.IntTyp = 'Gauss'; end
if ~isfield(ElemData, 'Update'), ElemData.Update = 'Iter'; end
if ~isfield(ElemData, 'Petrov'), ElemData.Petrov = false; end
% TODO: Forcing reduced integration
% ElemData.nIP = ElemData.nel - 1;
%
% Pre-compute interpolation functions and Gauss points/weights.
%
[xIP, wIP] = feval(ElemData.IntTyp, ElemData.nIP);
ElemData.xIP = xIP;
ElemData.wIP = wIP;
ElemData = Check3dFrm(el_no, xyz, ElemData, ElemType);
% Create data structure to store shape/Gauss point data
Shape = cell(ElemData.nIP, ElemData.nel);
% Indices to re-order output of "Lagrange" function
idx = [1 3:ElemData.nel 2];
for l = 1:ElemData.nIP
val = Lagrange(ElemData.nel-1, 0, ElemData.xIP(l));
grd = Lagrange(ElemData.nel-1, 1, ElemData.xIP(l));
j = 0;
for i = ElemData.nodix
j = j + 1;
Shape{l,i}.Value = val(idx(j));
Shape{l,i}.Grad = grd(idx(j));
end
end
ElemData.Shape = Shape;
end % function Check
%% ----------------------------------------------------------------------
function [ElemState, ElemData] = Init(xyz, ElemData)
% Initialize ElemState
% =======================================================================
% function by Claudio M. Perez 2023
% -----------------------------------------------------------------------
%
[~, R0] = DefGeom_3dFrm(xyz(:,[1 end]),ElemData);
State.Curvature = zeros(3,ElemData.nIP);
% State.Rotations = repmat(R0 , 1, 1, ElemData.nIP);
for l=1:ElemData.nIP
State.Rotations{l} = R0; % quaternion(R0, 'rotmat', 'point');
end
ElemState.Past = State;
ElemState.Pres = State;
end % function Init
%% ----------------------------------------------------------------------
function Resp = BasicUpdate(action, ~, XYZ, ElemData, ElemState)
% Main element state determination procedure
% =======================================================================
% function by Claudio M. Perez 2023
% -----------------------------------------------------------------------
%
ndm = 3;
ndf = 6;
Petrov = ElemData.Petrov;
% extract element properties
nIP = ElemData.nIP;
wIP = ElemData.wIP;
nel = ElemData.nel;
Shape = ElemData.Shape;
SecHndl = ElemData.SecHndl;
% Permute section resultants
% N Mz Vz T My Vy
% Ps = [ 1 0 0 0 0 0 ; % N
% 0 0 0 0 0 1 ; % Vy
% 0 0 1 0 0 0 ; % Vz
% 0 0 0 1 0 0 ; % T
% 0 0 0 0 1 0 ; % My
% 0 1 0 0 0 0]; % Mz
Ps = eye(6);
% Allocate working arrays
p = zeros(ndf*nel, 1);
kt = zeros(6*nel, 6*nel);
Ba = zeros(6,6,ElemData.nel);
Bb = zeros(6,6,ElemData.nel);
theta = zeros(3, nIP);
dtheta = zeros(3, nIP);
dr = zeros(3, nIP);
%
% Interpolate configuration variables ([2] eqn. 5.1)
%
[u, Du, DDu] = ExtrReshu(ElemState, ndf, nel);
% Compute original element length and Jacobian factor
L = ElmLenOr(XYZ(:,[1 end]));
jac = L/2;
% Compute deformed node positions
xyz = XYZ + u(1:ndm,:);
switch ElemData.Update
case 'Iter'
Past = ElemState.Pres;
% Compute dr, theta, dtheta at Gauss points
for l = 1:nIP
for i = ElemData.nodix
dr(:,l) = dr(:,l) + Shape{l,i}.Grad./jac.*xyz(:,i);
theta(:,l) = theta(:,l) + Shape{l,i}.Value.*DDu(4:6,i);
dtheta(:,l) = dtheta(:,l) + Shape{l,i}.Grad./jac.*DDu(4:6,i);
end
end
otherwise
Past = ElemState.Past;
if strcmp(ElemData.Update, 'Init')
Du = u;
end
% Compute dr, theta, dtheta at Gauss points
for l = 1:nIP
for i = ElemData.nodix
dr(:,l) = dr(:,l) + Shape{l,i}.Grad./jac.*xyz(:,i);
theta(:,l) = theta(:,l) + Shape{l,i}.Value.*Du(4:6,i);
dtheta(:,l) = dtheta(:,l) + Shape{l,i}.Grad./jac.*Du(4:6,i);
end
end
end
%
% Gauss quadrature loop
%
for l = 1:nIP
% Update the configuration
% Q = quaternion(theta(:,l)',"rotvec");
DR = ExpSO3(theta(:,l));
Pres.Rotations{l} = DR*Past.Rotations{l}; % Q*Past.Rotations{l}; %
R = Pres.Rotations{l}; % .rotmat('point');
omega = DR*Past.Curvature(:,l);
% Spatial curvature, kappa
Pres.Curvature(:,l) = omega + dExpSO3(theta(:,l))*dtheta(:,l); % Q.rotmat("point")*Past.Curvature(:,l); %
kappa = Pres.Curvature(:,l);
% Material strain measures
Gamma = R'*dr(:,l) - [1; 0; 0];
Kappa = R'*kappa;
% Section resultants
SecState.e = Ps*[Gamma; Kappa];
SecResp = SecHndl('stif',l,ndm,ElemData.SecData{l},SecState);
Ks = SecResp.ks;
S = SecResp.s;
% Push-forward material resultants
RR = blkdiag(R,R)*Ps; % [2], eqn 4.5c
s = RR*S;
%
% Form response and tangent
%
Ba(:,:,:) = 0.0;
Bb(:,:,:) = 0.0;
for i = ElemData.nodix
if Petrov || strcmp(ElemData.Update, 'Iter')
Ba(:,:,i) = B_nat(Shape{l,i}, dr(:,l), jac);
if ~strcmp(ElemData.Update, 'Iter')
Bb(:,:,i) = B_log(Shape{l,i}, dr(:,l), jac, theta(:,l),dtheta(:,l));
else
Bb(:,:,i) = Ba(:,:,i);
end
else
Ba(:,:,i) = B_log(Shape{l,i}, dr(:,l), jac, theta(:,l),dtheta(:,l));
Bb(:,:,i) = Ba(:,:,i);
end
% (Ba(:,:,i)*RR)'
p(6*(i-1)+1:6*(i)) = p(6*(i-1)+1:6*(i)) + Ba(:,:,i)*s .* wIP(l);
end
if strcmp(action,'stif')
% Material tangent, [2] eqn 5.6
% --------------------------------------------------------------
% Spatial moduli; see [2] in text after eqn 5.6
ks = RR*Ks*RR';
for i = ElemData.nodix
for j = ElemData.nodix
I = 6*(i-1) + 1;
J = 6*(j-1) + 1;
kt(I:I+5, J:J+5) = kt(I:I+5, J:J+5) ...
+ Ba(:,:,i)*ks*Bb(:,:,j)'.*wIP(l);
end
end
% Geometric tangent
% --------------------------------------------------------------
sn = Spin(s(1:3)); % n^ : skew matrix from axial resultants
sm = Spin(s(4:end)); % m^ : skew matrix from moment resultants
kg = zeros(6, 6); % Geometric stiffness
% Pre-compute some frequently used quantities
th = theta(:,l);
T = dExpSO3(theta(:,l));
Tl = T';
smT = sm*T;
snT = sn*T;
for i = ElemData.nodix
% indices for node i
ia = 6*(i-1)+1:6*i;
for j = ElemData.nodix
kg(:,:) = 0.0;
if Petrov || strcmp(ElemData.Update, 'Iter')
kg(1:3,4:end) = -sn .* Shape{l,i}.Grad./jac .* Shape{l,j}.Value;
kg(4:end,1:3) = sn .* Shape{l,j}.Grad./jac .* Shape{l,i}.Value;
kg(4:end,4:end) = ( ...
-sm .* Shape{l,i}.Grad./jac .* Shape{l,j}.Value + ...
Spin(dr(:,l)) * sn .* Shape{l,i}.Value .* Shape{l,j}.Value ...
);
if Petrov
kg = kg*[ eye(3) zeros(3)
zeros(3) T ];
end
else
kg(1:3,4:end) = -snT .* Shape{l,i}.Grad./jac * Shape{l,j}.Value;
kg(4:end,1:3) = Tl*sn .* Shape{l,j}.Grad./jac * Shape{l,i}.Value;
kg(4:end,4:end) = ( ...
(Tl*Spin(dr(:,l))*sn*T)*Shape{l,j}.Value.*Shape{l,i}.Value ...
- Tl*smT.*Shape{l,i}.Grad./jac.*Shape{l,j}.Value ...
...
+ Shape{l,i}.Value.*(dTanSO3(th, sn*dr(:,l), 'L').*Shape{l,j}.Value) ...
+ Shape{l,i}.Grad./jac.*(dTanSO3(th, s(4:6), 'L').*Shape{l,j}.Value) ...
+ Shape{l,i}.Value.*(...
dTanSO3(th, S(4:6), 'R')'.*Shape{l,j}.Grad./jac ...
+ ddTanSO3(th, dtheta(:,l), S(4:6)).*Shape{l,j}.Value ...
) ...
);
end
kt(ia, 6*(j-1)+1:6*j) = kt(ia, 6*(j-1)+1:6*j) + wIP(l) .* kg;
end
end
end % action == 'stif'
end
%
% END OF GAUSS LOOP
%
Resp = ElemState;
if strcmp(action,'stif')
Resp.ke = kt.*jac;
end
Resp.p = p.*jac;
if ~strcmp(ElemData.Update, 'Init')
Resp.Pres = Pres;
end
Resp.ConvFlag = true;
end % function BasicUpdate
%% function B_nat ------------------------------------------------------
function B = B_nat(Shape, dx, jac)
% Natural discrete strain matrix, Simo and Vu-Quoc (1986)
% =======================================================================
% function by Claudio M. Perez 2023
% -----------------------------------------------------------------------
B = eye(6) .* Shape.Grad./jac;
B(4:end,1:3) = -Shape.Value * Spin(dx);
end
%% function B_log ------------------------------------------------------
function B = B_log(Shape, dx, jac, th,dth)
% Logarithmic discrete strain matrix, Ibrahimbegovic (1995)
% =======================================================================
% function by Claudio M. Perez 2023
% -----------------------------------------------------------------------
B = eye(6) .* Shape.Grad./jac;
B(4:end,1:3) = -Shape.Value * Spin(dx);
Tl = dExpSO3(th)';
B(4:end,1:3) = Tl*B(4:end,1:3);
B(4:end,4:end) = Shape.Value*dTanSO3(th, dth, 'L')'*ExpSO3(th)' ... dot{Tl}
+ Shape.Grad/jac*Tl; %
% B(4:end,4:end) = Shape.Value*(dTanSO3(th,dth,'R')' - Tt*Spin(kappa)) + Shape.Grad/jac*Tt; % Helix - 45
% B(4:end,4:end) = Shape.Value*(dTanSO3(th,dth,'L') - Tt*Spin(kappa)) + Shape.Grad/jac*Tt; % Helix - 42
% B(4:end,4:end) = Shape.Value*(ddExpSO3(th,dth)' - Tt*Spin(kappa)) + Shape.Grad/jac*Tt;
end
%% - function B_lft ------------------------------------------------------------------
function B = B_lft(Shape, dx, jac,R, Kappa, th,dth)
if nargin < 6
A = [
Shape.Grad./jac*R' Shape.Value.*Spin(R'*dx);
zeros(3) Shape.Grad./jac.*eye(3) + Shape.Value.*Spin(Kappa)
];
else
Tl = dExpSO3(th)';
A = [
Shape.Grad./jac*R' Shape.Value.*Spin(R'*dx)*Tl;
zeros(3) (Shape.Grad./jac.*Tl + Shape.Value.*(Spin(Kappa)*Tl + dTanSO3(th, dth)'))
... zeros(3) (Shape.Grad./jac.*Tl + Shape.Value.*ExpSO3(th)*dTanSO3(th, dth, 'L'))'
];
end
B = A';
end
%% --- function DeformedShape -------------------------------------------
function XYZd = DeformedShape(XYZ,~,u,~,MagF)
% Compute points along the deformed element shape for rendering.
% =======================================================================
% function by Claudio M. Perez 2023
% -----------------------------------------------------------------------
xyz = XYZ + u(1:3,:);
nn = size(XYZ,2); % number of element nodes
idx = [1 3:nn 2]; % node index map for Lagrange function
nsub = 100; % number of subdivisions
XYZd = zeros(3, nsub); % deformed shape
s = linspace(-1,1,nsub); % Coordinates in element's parent domain
N = Lagrange(nn-1, 0, s); % Shape functions
% Compute the isoparametric mapping
for i=1:3
XYZd(i,:) = N(idx,:)'*xyz(i,:)'*MagF;
end
end
%%
function Resp = LeftUpdate(action, XYZ, ElemData, ElemState)
ndm = 3;
ndf = 6;
Petrov = false;
% extract element properties
nIP = ElemData.nIP;
xIP = ElemData.xIP;
wIP = ElemData.wIP;
nel = ElemData.nel;
Shape = ElemData.Shape;
SecHndl = ElemData.SecHndl;
% TODO: Permute section resultants
% N Mz Vz T My Vy
% Ps = [ 1 0 0 0 0 0 ; % N
% 0 0 0 0 0 1 ; % Vy
% 0 0 1 0 0 0 ; % Vz
% 0 0 0 1 0 0 ; % T
% 0 0 0 0 1 0 ; % My
% 0 1 0 0 0 0]; % Mz
Ps = eye(6);
[u, Du, DDu] = ExtrReshu(ElemState, ndf, nel);
L = ElmLenOr(XYZ(:,[1 end]));
jac = L/2;
p = zeros(ndf*nel, 1);
kt = zeros(6*nel, 6*nel);
Ba = zeros(6,6,ElemData.nel);
Bb = zeros(6,6,ElemData.nel);
%
% Interpolate configuration variables ([2] eqn. 5.1)
%
xyz = XYZ + u(1:ndm,:);
theta = zeros(3, nIP);
dtheta = zeros(3, nIP);
dx = zeros(3, nIP);
[~, R0] = DefGeom_3dFrm(XYZ(:,[1 end]),ElemData);
switch ElemData.Update
case 'Iter'
Past = ElemState.Pres;
for l = 1:nIP
for i = ElemData.nodix
dx(:,l) = dx(:,l) + Shape{l,i}.Grad./jac.*xyz(:,i);
theta(:,l) = theta(:,l) + Shape{l,i}.Value.*DDu(4:6,i);
dtheta(:,l) = dtheta(:,l) + Shape{l,i}.Grad./jac.*DDu(4:6,i);
end
end
otherwise
Past = ElemState.Past;
if strcmp(ElemData.Update, 'Init')
Du = u;
end
for l = 1:nIP
for i = ElemData.nodix
dx(:,l) = dx(:,l) + Shape{l,i}.Grad./jac.*xyz(:,i);
theta(:,l) = theta(:,l) + Shape{l,i}.Value.*Du(4:6,i);
dtheta(:,l) = dtheta(:,l) + Shape{l,i}.Grad./jac.*Du(4:6,i);
end
end
end
for l = 1:nIP
% Update the configuration
DR = ExpSO3(theta(:,l));
Pres.Rotations(:,:,l) = Past.Rotations(:,:,l)*DR;
R = Pres.Rotations(:,:,l);
omega = DR'*Past.Curvature(:,l);
Pres.Curvature(:,l) = omega ...
+ dExpSO3(theta(:,l))'*dtheta(:,l);
% Spatial curvature
kappa = Pres.Rotations(:,:,l)*Pres.Curvature(:,l);
% Material strain measures
Gamma = R'*dx(:,l) - [1; 0; 0];
Kappa = R'*kappa;
% Section resultants
SecState.e = Ps*[Gamma; Kappa];
SecResp = SecHndl('stif',l,ndm,ElemData.SecData{l},SecState);
Ks = SecResp.ks;
S = SecResp.s;
% Push-forward material resultants
RR = blkdiag(R,R)*Ps; % [2], eqn 4.5c
s = RR*S;
%
% Form response and tangent
%
Ba(:,:,:) = 0.0;
Bb(:,:,:) = 0.0;
for i = ElemData.nodix
if Petrov || strcmp(ElemData.Update, 'Iter')
Ba(:,:,i) = B_lft(Shape{l,i}, dx(:,l), jac, R, Kappa);
if ~strcmp(ElemData.Update, 'Iter')
Bb(:,:,i) = B_lft(Shape{l,i}, dx(:,l), jac, R, Kappa, theta(:,l), dtheta(:,l));
else
Bb(:,:,i) = Ba(:,:,i);
end
else
Ba(:,:,i) = B_lft(Shape{l,i}, dx(:,l), jac, R, omega, theta(:,l), dtheta(:,l));
Bb(:,:,i) = Ba(:,:,i);
end
p(6*(i-1)+1:6*(i)) = p(6*(i-1)+1:6*(i)) + Ba(:,:,i)*S .* wIP(l);
end
if strcmp(action,'stif')
% Material tangent, [2] eqn 5.6
% --------------------------------------------------------------
for i = ElemData.nodix
for j = ElemData.nodix
I = 6*(i-1) + 1;
J = 6*(j-1) + 1;
kt(I:I+5, J:J+5) = kt(I:I+5, J:J+5) ...
+ Ba(:,:,i)*Ks*Bb(:,:,j)'.*wIP(l);
end
end
% Geometric tangent
% --------------------------------------------------------------
sn = Spin(s(1:3));
sm = Spin(s(4:end));
sN = Spin(S(1:3));
sM = Spin(S(4:end));
kg = zeros(6, 6);
% incremental matrices
th = theta(:,l);
T = dExpSO3(theta(:,l));
sNT = sN*T';
sMT = sM*T';
Tl = T';
Xi = dTanSO3(theta(:,l), dtheta(:,l), 'R');
for i = ElemData.nodix
aa = [Shape{l,i}.Grad./jac.*eye(3) zeros(3)
zeros(3) Shape{l,i}.Value.*eye(3)
zeros(3) Shape{l,i}.Grad./jac.*eye(3)];
for j = ElemData.nodix
kg(:,:) = 0.0;
if Petrov || strcmp(ElemData.Update, 'Iter')
kg(1:3,4:end) = -R*sN .* Shape{l,i}.Grad./jac * Shape{l,j}.Value;
kg(4:end,1:3) = R*sN .* Shape{l,j}.Grad./jac * Shape{l,i}.Value;
kg(4:end,4:end) = ( ...
-R*sM .* Shape{l,i}.Grad./jac .* Shape{l,j}.Value + ...
Spin(dx(:,l)) * sN .* Shape{l,i}.Value .* Shape{l,j}.Value ...
... ((R'*dx(:,l)) * S(1:3)' -(R'*dx(:,l))'*S(1:3)*eye(3) ...
... + Kappa*S(4:6)' - Kappa'*S(4:6)*eye(3)).* Shape{l,i}.Value .* Shape{l,j}.Value ...
);
elseif false
ab = [Shape{l,j}.Grad./jac.*eye(3) zeros(3)
zeros(3) Shape{l,j}.Value.*eye(3)
zeros(3) Shape{l,j}.Grad./jac.*eye(3)];
k2 = zeros(9);
k2(1:3,4:6) = -R*sN*T';
% k2(1:3,4:6) = -sn*T;
k2(4:6,1:3) = k2(1:3,4:6)';
k2(4:6,4:6) = T*sN*Spin(R'*dx(:,l))*T' + dTanSO3(th,sN*R'*dx(:,l), 'L') ...
... + T*Spin(omega)*sM*T' + ddExpSO3(th,sM*DR'*kappa) + T'*sM*Xi + Xi'*sM*T ...
+ T*sM*Spin(omega)*T' + dTanSO3(th,sM*omega, 'L') + T'*sM*Xi + Xi'*sM*T ...
; % + H(th,dth,s(4:6));
% Pi^T
k2(4:6,7:9) = T*sM*T' + dTanSO3(th, S(4:6), 'L')';
k2(7:9,4:6) = k2(4:6,7:9)';
kg = aa'*k2*ab;
else
kg(1:3,4:end) = -R*sNT .* Shape{l,i}.Grad./jac * Shape{l,j}.Value;
kg(4:end,1:3) = T*sN*R' .* Shape{l,j}.Grad./jac * Shape{l,i}.Value;
kg(4:end,4:end) = ( ...
(T*Spin(R'*dx(:,l))*sNT) .*Shape{l,j}.Value.*Shape{l,i}.Value ...
- T*sMT .*Shape{l,i}.Grad./jac.*Shape{l,j}.Value ...
...
+ Shape{l,i}.Value.*(dTanSO3(th, sN*R'*dx(:,l), 'L').*Shape{l,j}.Value) ...
+ Shape{l,i}.Grad./jac.*(dTanSO3(th, S(4:6), 'L').*Shape{l,j}.Value) ...
+ Shape{l,i}.Value.*(...
dTanSO3(th, S(4:6), 'R')'.*Shape{l,j}.Grad./jac ...
+ ddTanSO3(th, dtheta(:,l), S(4:6)).*Shape{l,j}.Value ...
) ...
);
end % if
kt(6*(i-1)+1:6*i, 6*(j-1)+1:6*j) = kt(6*(i-1)+1:6*i, 6*(j-1)+1:6*j) + wIP(l) .* kg;
end % for j
end % for i
end % action == 'stif'
end
%
% END OF GAUSS LOOP
%
Resp = ElemState;
I = eye(3);
% RR0 = blkdiag(R0,R0,R0,R0)';
RR0 = blkdiag(I,R0,I,R0);
p = RR0*p;
if strcmp(action,'stif')
kt = RR0*kt;
Resp.ke = kt.*jac;
end
Resp.p = p.*jac;
if ~strcmp(ElemData.Update, 'Init')
Resp.Pres = Pres;
end
Resp.ConvFlag = true;
end