/
element.jl
3427 lines (2499 loc) · 119 KB
/
element.jl
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
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# --- Element State Variable Helper Functions --- #
"""
element_loads(x, ielem, icol_elem, force_scaling)
Extract the internal loads (`F`, `M`) for a beam element from the state variable vector.
These loads are expressed in the deformed element frame.
"""
@inline function element_loads(x, ielem, icol_elem, force_scaling)
icol = icol_elem[ielem]
F = SVector(x[icol ], x[icol+1], x[icol+2]) * force_scaling
M = SVector(x[icol+3], x[icol+4], x[icol+5]) * force_scaling
return F, M
end
"""
expanded_element_loads(x, ielem, icol_elem, force_scaling)
Extract the internal loads of a beam element at its endpoints (`F1`, `M1`, `F2`, `M2`)
from the state variable vector for a constant mass matrix system.
"""
@inline function expanded_element_loads(x, ielem, icol_elem, force_scaling)
icol = icol_elem[ielem]
F1 = SVector(x[icol ], x[icol+1], x[icol+2]) * force_scaling
M1 = SVector(x[icol+3], x[icol+4], x[icol+5]) * force_scaling
F2 = SVector(x[icol+6], x[icol+7], x[icol+8]) * force_scaling
M2 = SVector(x[icol+9], x[icol+10], x[icol+11]) * force_scaling
return F1, M1, F2, M2
end
"""
expanded_element_velocities(x, ielem, icol_elem)
Extract the velocities of a beam element from the state variable vector for a constant mass
matrix system.
"""
@inline function expanded_element_velocities(x, ielem, icol_elem)
icol = icol_elem[ielem]
V = SVector(x[icol+12], x[icol+13], x[icol+14])
Ω = SVector(x[icol+15], x[icol+16], x[icol+17])
return V, Ω
end
# --- Element Properties --- #
"""
static_element_properties(x, indices, force_scaling, assembly, ielem,
prescribed_conditions, gravity)
Calculate/extract the element properties needed to construct the residual for a static
analysis
"""
@inline function static_element_properties(x, indices, force_scaling, assembly, ielem,
prescribed_conditions, gravity)
# unpack element parameters
@unpack L, Cab, compliance, mass = assembly.elements[ielem]
# scale compliance and mass matrices by the element length
compliance *= L
mass *= L
# compliance submatrices (in the deformed element frame)
S11 = compliance[SVector{3}(1:3), SVector{3}(1:3)]
S12 = compliance[SVector{3}(1:3), SVector{3}(4:6)]
S21 = compliance[SVector{3}(4:6), SVector{3}(1:3)]
S22 = compliance[SVector{3}(4:6), SVector{3}(4:6)]
# mass submatrices
mass11 = mass[SVector{3}(1:3), SVector{3}(1:3)]
mass12 = mass[SVector{3}(1:3), SVector{3}(4:6)]
mass21 = mass[SVector{3}(4:6), SVector{3}(1:3)]
mass22 = mass[SVector{3}(4:6), SVector{3}(4:6)]
# linear and angular displacement
u1, θ1 = point_displacement(x, assembly.start[ielem], indices.icol_point, prescribed_conditions)
u2, θ2 = point_displacement(x, assembly.stop[ielem], indices.icol_point, prescribed_conditions)
u = (u1 + u2)/2
θ = (θ1 + θ2)/2
# rotation parameter matrices
C = get_C(θ)
CtCab = C'*Cab
Qinv = get_Qinv(θ)
# forces and moments
F, M = element_loads(x, ielem, indices.icol_elem, force_scaling)
# strain and curvature
γ = S11*F + S12*M
κ = S21*F + S22*M
# gravitational loads
gvec = SVector{3}(gravity)
return (; L, C, Cab, CtCab, Qinv, S11, S12, S21, S22, mass11, mass12, mass21, mass22,
u1, u2, θ1, θ2, u, θ, F, M, γ, κ, gvec)
end
"""
steady_element_properties(x, indices, force_scaling, structural_damping,
assembly, ielem, prescribed_conditions, gravity, linear_velocity, angular_velocity,
linear_acceleration=(@SVector zeros(3)), angular_acceleration=(@SVector zeros(3)))
Calculate/extract the element properties needed to construct the residual for a steady
state analysis
"""
@inline function steady_element_properties(x, indices, force_scaling, structural_damping,
assembly, ielem, prescribed_conditions, gravity, linear_velocity, angular_velocity,
linear_acceleration=(@SVector zeros(3)), angular_acceleration=(@SVector zeros(3)))
properties = static_element_properties(x, indices, force_scaling, assembly, ielem,
prescribed_conditions, gravity)
@unpack L, Cab, C, CtCab, Qinv, mass11, mass12, mass21, mass22, u1, u2, θ1, θ2,
u, θ, γ, κ = properties
# rotation parameter matrices
Q = get_Q(θ)
# distance from the rotation center
Δx = assembly.elements[ielem].x
# body frame velocity (use prescribed values)
vb, ωb = SVector{3}(linear_velocity), SVector{3}(angular_velocity)
# body frame acceleration (use prescribed values)
ab, αb = SVector{3}(linear_acceleration), SVector{3}(angular_acceleration)
# linear and angular velocity
V1, Ω1 = point_velocities(x, assembly.start[ielem], indices.icol_point)
V2, Ω2 = point_velocities(x, assembly.stop[ielem], indices.icol_point)
V = (V1 + V2)/2
Ω = (Ω1 + Ω2)/2
# linear and angular momentum
P = CtCab*mass11*CtCab'*V + CtCab*mass12*CtCab'*Ω
H = CtCab*mass21*CtCab'*V + CtCab*mass22*CtCab'*Ω
# linear and angular displacement rates
udot = @SVector zeros(3)
θdot = @SVector zeros(3)
# linear and angular acceleration
Vdot = ab + cross(αb, Δx + u) + cross(ωb, udot)
Ωdot = αb
# linear and angular momentum rates
Pdot = CtCab*mass11*CtCab'*Vdot + CtCab*mass12*CtCab'*Ωdot
Hdot = CtCab*mass21*CtCab'*Vdot + CtCab*mass22*CtCab'*Ωdot
# save properties
properties = (; properties..., Q, Δx, vb, ωb, ab, αb, V1, V2, Ω1, Ω2, V, Ω, P, H,
udot, θdot, Vdot, Ωdot, Pdot, Hdot)
if structural_damping
# damping coefficients
μ = assembly.elements[ielem].mu
# damping submatrices
μ11 = @SMatrix [μ[1] 0 0; 0 μ[2] 0; 0 0 μ[3]]
μ22 = @SMatrix [μ[4] 0 0; 0 μ[5] 0; 0 0 μ[6]]
# rotation parameter matrices
C1 = get_C(θ1)
C2 = get_C(θ2)
Qinv1 = get_Qinv(θ1)
Qinv2 = get_Qinv(θ2)
# distance from the reference location
Δx1 = assembly.points[assembly.start[ielem]]
Δx2 = assembly.points[assembly.stop[ielem]]
# linear displacement rates
udot1 = V1 - vb - cross(ωb, Δx1 + u1)
udot2 = V2 - vb - cross(ωb, Δx2 + u2)
uedot = (udot1 + udot2)/2
# angular displacement rates
θdot1 = Qinv1*C1*(Ω1 - ωb)
θdot2 = Qinv2*C2*(Ω2 - ωb)
θedot = (θdot1 + θdot2)/2
# change in linear and angular displacement
Δu = u2 - u1
Δθ = θ2 - θ1
# change in linear and angular displacement rates
Δudot = udot2 - udot1
Δθdot = θdot2 - θdot1
# ΔQ matrix (see structural damping theory)
ΔQ = get_ΔQ(θ, Δθ, Q)
# strain rates
γdot = -CtCab'*tilde(Ω - ωb)*Δu + CtCab'*Δudot - L*CtCab'*tilde(Ω - ωb)*Cab*e1
κdot = Cab'*Q*Δθdot + Cab'*ΔQ*θedot
# adjust strains to account for strain rates
γ -= μ11*γdot
κ -= μ22*κdot
# save new strains and structural damping properties
properties = (; properties..., γ, κ, γdot, κdot,
μ11, μ22, C1, C2, Qinv1, Qinv2, Δx1, Δx2,
udot1, udot2, uedot, θdot1, θdot2, θedot, Δu, Δθ, Δudot, Δθdot, ΔQ)
end
return properties
end
"""
initial_element_properties(x, indices, rate_vars, force_scaling,
structural_damping, assembly, ielem, prescribed_conditions, gravity,
linear_velocity, angular_velocity, linear_acceleration, angular_acceleration, u0, θ0, V0, Ω0, Vdot0, Ωdot0)
Calculate/extract the element properties needed to construct the residual for a time-domain
analysis initialization
"""
@inline function initial_element_properties(x, indices, rate_vars,
force_scaling, structural_damping, assembly, ielem, prescribed_conditions, gravity,
linear_velocity, angular_velocity, linear_acceleration, angular_acceleration, u0, θ0, V0, Ω0, Vdot0, Ωdot0)
# unpack element parameters
@unpack L, Cab, compliance, mass = assembly.elements[ielem]
# scale compliance and mass matrices by the element length
compliance *= L
mass *= L
# compliance submatrices
S11 = compliance[SVector{3}(1:3), SVector{3}(1:3)]
S12 = compliance[SVector{3}(1:3), SVector{3}(4:6)]
S21 = compliance[SVector{3}(4:6), SVector{3}(1:3)]
S22 = compliance[SVector{3}(4:6), SVector{3}(4:6)]
# mass submatrices
mass11 = mass[SVector{3}(1:3), SVector{3}(1:3)]
mass12 = mass[SVector{3}(1:3), SVector{3}(4:6)]
mass21 = mass[SVector{3}(4:6), SVector{3}(1:3)]
mass22 = mass[SVector{3}(4:6), SVector{3}(4:6)]
# linear and angular displacement
u1, θ1 = initial_point_displacement(x, assembly.start[ielem], indices.icol_point,
prescribed_conditions, u0, θ0, rate_vars)
u2, θ2 = initial_point_displacement(x, assembly.stop[ielem], indices.icol_point,
prescribed_conditions, u0, θ0, rate_vars)
u = (u1 + u2)/2
θ = (θ1 + θ2)/2
# rotation parameter matrices
C = get_C(θ)
CtCab = C'*Cab
Q = get_Q(θ)
Qinv = get_Qinv(θ)
# forces and moments
F, M = element_loads(x, ielem, indices.icol_elem, force_scaling)
# strain and curvature
γ = S11*F + S12*M
κ = S21*F + S22*M
# distance from the rotation center
Δx = assembly.elements[ielem].x
# body frame velocity (use prescribed values)
vb, ωb = SVector{3}(linear_velocity), SVector{3}(angular_velocity)
# body frame acceleration (use prescribed values)
ab, αb = SVector{3}(linear_acceleration), SVector{3}(angular_acceleration)
# gravitational loads
gvec = SVector{3}(gravity)
# relative velocity
V1 = SVector{3}(V0[assembly.start[ielem]])
V2 = SVector{3}(V0[assembly.stop[ielem]])
V = (V1 + V2)/2
Ω1 = SVector{3}(Ω0[assembly.start[ielem]])
Ω2 = SVector{3}(Ω0[assembly.stop[ielem]])
Ω = (Ω1 + Ω2)/2
# inertial velocity
V += vb + cross(ωb, Δx + u)
Ω += ωb
# linear and angular momentum
P = CtCab*mass11*CtCab'*V + CtCab*mass12*CtCab'*Ω
H = CtCab*mass21*CtCab'*V + CtCab*mass22*CtCab'*Ω
# linear and angular displacement rates
u1dot, θ1dot = initial_point_displacement_rates(x, assembly.start[ielem], indices.icol_point)
u2dot, θ2dot = initial_point_displacement_rates(x, assembly.stop[ielem], indices.icol_point)
udot = (u1dot + u2dot)/2
θdot = (θ1dot + θ2dot)/2
# relative acceleration
V1dot, Ω1dot = initial_point_velocity_rates(x, assembly.start[ielem], indices.icol_point,
prescribed_conditions, Vdot0, Ωdot0, rate_vars)
V2dot, Ω2dot = initial_point_velocity_rates(x, assembly.stop[ielem], indices.icol_point,
prescribed_conditions, Vdot0, Ωdot0, rate_vars)
Vdot = (V1dot + V2dot)/2
Ωdot = (Ω1dot + Ω2dot)/2
# inertial acceleration (excluding frame-rotation term)
Vdot += ab + cross(αb, Δx) + cross(αb, u) + cross(ωb, udot)
Ωdot += αb
# linear and angular momentum rates
CtCabdot = tilde(Ω - ωb)*CtCab
Pdot = CtCab*mass11*CtCab'*Vdot + CtCab*mass12*CtCab'*Ωdot +
CtCab*mass11*CtCabdot'*V + CtCab*mass12*CtCabdot'*Ω +
CtCabdot*mass11*CtCab'*V + CtCabdot*mass12*CtCab'*Ω
Hdot = CtCab*mass21*CtCab'*Vdot + CtCab*mass22*CtCab'*Ωdot +
CtCab*mass21*CtCabdot'*V + CtCab*mass22*CtCabdot'*Ω +
CtCabdot*mass21*CtCab'*V + CtCabdot*mass22*CtCab'*Ω
# save properties
properties = (; L, C, Cab, CtCab, Q, Qinv, S11, S12, S21, S22, mass11, mass12, mass21, mass22,
u1, u2, θ1, θ2, u, θ, F, M, γ, κ, gvec, Δx, vb, ωb, ab, αb, V1, V2, Ω1, Ω2, V, Ω, P, H,
u1dot, u2dot, θ1dot, θ2dot, udot, θdot, CtCabdot, Vdot, Ωdot, Pdot, Hdot)
if structural_damping
# damping coefficients
μ = assembly.elements[ielem].mu
# damping submatrices
μ11 = @SMatrix [μ[1] 0 0; 0 μ[2] 0; 0 0 μ[3]]
μ22 = @SMatrix [μ[4] 0 0; 0 μ[5] 0; 0 0 μ[6]]
# change in linear and angular displacement
Δu = u2 - u1
Δθ = θ2 - θ1
# change in linear and angular displacement rates
Δudot = u2dot - u1dot
Δθdot = θ2dot - θ1dot
# ΔQ matrix (see structural damping theory)
ΔQ = get_ΔQ(θ, Δθ, Q)
# strain rates
γdot = -CtCab'*tilde(Ω - ωb)*Δu + CtCab'*Δudot - L*CtCab'*tilde(Ω - ωb)*Cab*e1
κdot = Cab'*Q*Δθdot + Cab'*ΔQ*θdot
# adjust strains to account for strain rates
γ -= μ11*γdot
κ -= μ22*κdot
# add structural damping properties
properties = (; properties..., γ, κ, γdot, κdot,
μ11, μ22, Δu, Δθ, Δudot, Δθdot, ΔQ)
end
return properties
end
"""
newmark_element_properties(x, indices, force_scaling, structural_damping,
assembly, ielem, prescribed_conditions, gravity, linear_velocity, angular_velocity,
Vdot_init, Ωdot_init, dt)
Calculate/extract the element properties needed to construct the residual for a newmark-
scheme time stepping analysis
"""
@inline function newmark_element_properties(x, indices, force_scaling, structural_damping,
assembly, ielem, prescribed_conditions, gravity, linear_velocity, angular_velocity,
Vdot_init, Ωdot_init, dt)
properties = steady_element_properties(x, indices, force_scaling, structural_damping,
assembly, ielem, prescribed_conditions, gravity, linear_velocity, angular_velocity)
@unpack ωb, C, Cab, CtCab, mass11, mass12, mass21, mass22, V1, V2, Ω1, Ω2, V, Ω = properties
# linear and angular acceleration (including body frame motion)
V1dot = 2/dt*V1 - SVector{3}(Vdot_init[assembly.start[ielem]])
Ω1dot = 2/dt*Ω1 - SVector{3}(Ωdot_init[assembly.start[ielem]])
V2dot = 2/dt*V2 - SVector{3}(Vdot_init[assembly.stop[ielem]])
Ω2dot = 2/dt*Ω2 - SVector{3}(Ωdot_init[assembly.stop[ielem]])
Vdot = (V1dot + V2dot)/2
Ωdot = (Ω1dot + Ω2dot)/2
# linear and angular momentum rates (including body frame motion)
CtCabdot = tilde(Ω - ωb)*CtCab
Pdot = CtCab*mass11*CtCab'*Vdot + CtCab*mass12*CtCab'*Ωdot +
CtCab*mass11*CtCabdot'*V + CtCab*mass12*CtCabdot'*Ω +
CtCabdot*mass11*CtCab'*V + CtCabdot*mass12*CtCab'*Ω
Hdot = CtCab*mass21*CtCab'*Vdot + CtCab*mass22*CtCab'*Ωdot +
CtCab*mass21*CtCabdot'*V + CtCab*mass22*CtCabdot'*Ω +
CtCabdot*mass21*CtCab'*V + CtCabdot*mass22*CtCab'*Ω
return (; properties..., CtCabdot, Vdot, Ωdot, Pdot, Hdot)
end
"""
dynamic_element_properties(dx, x, indices, force_scaling, structural_damping,
assembly, ielem, prescribed_conditions, gravity, linear_velocity, angular_velocity)
Calculate/extract the element properties needed to construct the residual for a dynamic
analysis
"""
@inline function dynamic_element_properties(dx, x, indices, force_scaling, structural_damping,
assembly, ielem, prescribed_conditions, gravity, linear_velocity, angular_velocity)
properties = steady_element_properties(x, indices, force_scaling, structural_damping,
assembly, ielem, prescribed_conditions, gravity, linear_velocity, angular_velocity)
@unpack ωb, C, Cab, CtCab, mass11, mass12, mass21, mass22, V1, V2, Ω1, Ω2, V, Ω = properties
# velocity rates
V1dot, Ω1dot = point_velocities(dx, assembly.start[ielem], indices.icol_point)
V2dot, Ω2dot = point_velocities(dx, assembly.stop[ielem], indices.icol_point)
Vdot = (V1dot + V2dot)/2
Ωdot = (Ω1dot + Ω2dot)/2
# linear and angular momentum rates
CtCabdot = tilde(Ω - ωb)*CtCab
Pdot = CtCab*mass11*CtCab'*Vdot + CtCab*mass12*CtCab'*Ωdot +
CtCab*mass11*CtCabdot'*V + CtCab*mass12*CtCabdot'*Ω +
CtCabdot*mass11*CtCab'*V + CtCabdot*mass12*CtCab'*Ω
Hdot = CtCab*mass21*CtCab'*Vdot + CtCab*mass22*CtCab'*Ωdot +
CtCab*mass21*CtCabdot'*V + CtCab*mass22*CtCabdot'*Ω +
CtCabdot*mass21*CtCab'*V + CtCabdot*mass22*CtCab'*Ω
return (; properties..., CtCabdot, Vdot, Ωdot, Pdot, Hdot)
end
"""
expanded_steady_element_properties(x, indices, force_scaling, structural_damping,
assembly, ielem, prescribed_conditions, gravity, linear_velocity, angular_velocity,
linear_acceleration=(@SVector zeros(3)), angular_acceleration=(@SVector zeros(3)))
Calculate/extract the element properties needed to construct the residual for a constant
mass matrix system
"""
@inline function expanded_steady_element_properties(x, indices, force_scaling, structural_damping,
assembly, ielem, prescribed_conditions, gravity, linear_velocity, angular_velocity,
linear_acceleration=(@SVector zeros(3)), angular_acceleration=(@SVector zeros(3)))
# unpack element parameters
@unpack L, Cab, compliance, mass = assembly.elements[ielem]
# scale compliance and mass matrices by the element length
compliance *= L
mass *= L
# compliance submatrices (in the deformed element frame)
S11 = compliance[SVector{3}(1:3), SVector{3}(1:3)]
S12 = compliance[SVector{3}(1:3), SVector{3}(4:6)]
S21 = compliance[SVector{3}(4:6), SVector{3}(1:3)]
S22 = compliance[SVector{3}(4:6), SVector{3}(4:6)]
# mass submatrices
mass11 = mass[SVector{3}(1:3), SVector{3}(1:3)]
mass12 = mass[SVector{3}(1:3), SVector{3}(4:6)]
mass21 = mass[SVector{3}(4:6), SVector{3}(1:3)]
mass22 = mass[SVector{3}(4:6), SVector{3}(4:6)]
# linear and angular displacement
u1, θ1 = point_displacement(x, assembly.start[ielem], indices.icol_point, prescribed_conditions)
u2, θ2 = point_displacement(x, assembly.stop[ielem], indices.icol_point, prescribed_conditions)
u = (u1 + u2)/2
θ = (θ1 + θ2)/2
# rotation parameter matrices
C = get_C(θ)
C1 = get_C(θ1)
C2 = get_C(θ2)
CtCab = C'*Cab
Q = get_Q(θ)
Qinv = get_Qinv(θ)
Qinv1 = get_Qinv(θ1)
Qinv2 = get_Qinv(θ2)
# forces and moments
F1, M1, F2, M2 = expanded_element_loads(x, ielem, indices.icol_elem, force_scaling)
F = (F1 + F2)/2
M = (M1 + M2)/2
# strain and curvature
γ = S11*F + S12*M
κ = S21*F + S22*M
# gravitational loads
gvec = SVector{3}(gravity)
# distance from the rotation center
Δx = assembly.elements[ielem].x
Δx1 = assembly.points[assembly.start[ielem]]
Δx2 = assembly.points[assembly.stop[ielem]]
# body frame linear velocity
vb = linear_velocity
ωb = angular_velocity
# body frame angular acceleration
ab = linear_acceleration
αb = angular_acceleration
# linear and angular velocity
V1, Ω1 = point_velocities(x, assembly.start[ielem], indices.icol_point)
V2, Ω2 = point_velocities(x, assembly.stop[ielem], indices.icol_point)
V, Ω = expanded_element_velocities(x, ielem, indices.icol_elem)
# linear and angular momentum
P = mass11*V + mass12*Ω
H = mass21*V + mass22*Ω
# linear and angular displacement rates
udot1 = C1'*V1 - vb - cross(ωb, Δx1 + u1)
udot2 = C2'*V2 - vb - cross(ωb, Δx2 + u2)
udot = (udot1 + udot2)/2
θdot1 = Qinv1*(Ω1 - C1*ωb)
θdot2 = Qinv2*(Ω2 - C2*ωb)
θdot = (θdot1 + θdot2)/2
# linear and angular velocity rates
Vdot = CtCab'*(ab + cross(αb, Δx) + cross(αb, u))
Ωdot = CtCab'*αb
# linear and angular momentum rates
Pdot = mass11*Vdot + mass12*Ωdot
Hdot = mass21*Vdot + mass22*Ωdot
# save properties
properties = (; L, C, C1, C2, Cab, CtCab, Q, Qinv, Qinv1, Qinv2, S11, S12, S21, S22,
mass11, mass12, mass21, mass22, u1, u2, θ1, θ2, u, θ, F1, F2, M1, M2, F, M, γ, κ, gvec,
Δx, Δx1, Δx2, vb, ωb, ab, αb, V1, V2, Ω1, Ω2, V, Ω, P, H, udot1, udot2, θdot1, θdot2,
udot, θdot, Vdot, Ωdot, Pdot, Hdot)
if structural_damping
# damping coefficients
μ = assembly.elements[ielem].mu
# damping submatrices
μ11 = @SMatrix [μ[1] 0 0; 0 μ[2] 0; 0 0 μ[3]]
μ22 = @SMatrix [μ[4] 0 0; 0 μ[5] 0; 0 0 μ[6]]
# change in linear and angular displacement
Δu = u2 - u1
Δθ = θ2 - θ1
# change in linear and angular displacement rates
Δudot = udot2 - udot1
Δθdot = θdot2 - θdot1
# ΔQ matrix (see structural damping theory)
ΔQ = get_ΔQ(θ, Δθ, Q)
# strain rates
γdot = -CtCab'*tilde(CtCab*Ω - ωb)*Δu + CtCab'*Δudot - L*CtCab'*tilde(CtCab*Ω - ωb)*Cab*e1
κdot = Cab'*Q*Δθdot + Cab'*ΔQ*θdot
# adjust strains to account for strain rates
γ -= μ11*γdot
κ -= μ22*κdot
# add structural damping properties
properties = (; properties..., γ, κ, γdot, κdot, μ11, μ22, Δu, Δθ, Δudot, Δθdot, ΔQ)
end
return properties
end
"""
expanded_dynamic_element_properties(dx, x, indices, force_scaling, structural_damping,
assembly, ielem, prescribed_conditions, gravity, linear_velocity, angular_velocity)
Calculate/extract the element properties needed to construct the residual for a constant
mass matrix system
"""
function expanded_dynamic_element_properties(dx, x, indices, force_scaling, structural_damping,
assembly, ielem, prescribed_conditions, gravity, linear_velocity, angular_velocity)
properties = expanded_steady_element_properties(x, indices, force_scaling,
structural_damping, assembly, ielem, prescribed_conditions, gravity,
linear_velocity, angular_velocity)
@unpack mass11, mass12, mass21, mass22 = properties
# velocity rates
Vdot, Ωdot = expanded_element_velocities(dx, ielem, indices.icol_elem)
# linear and angular momentum rates
Pdot = mass11*Vdot + mass12*Ωdot
Hdot = mass21*Vdot + mass22*Ωdot
return (; properties..., Vdot, Ωdot, Pdot, Hdot)
end
"""
static_element_jacobian_properties(properties, x, indices, force_scaling,
assembly, ielem, prescribed_conditions, gravity)
Calculate/extract the element properties needed to calculate the jacobian entries
corresponding to a beam element for a static analysis
"""
@inline function static_element_jacobian_properties(properties, x, indices, force_scaling,
assembly, ielem, prescribed_conditions, gravity)
@unpack C, θ, S11, S12, S21, S22 = properties
# linear and angular displacement
u1_u1, θ1_θ1 = point_displacement_jacobians(assembly.start[ielem], prescribed_conditions)
u2_u2, θ2_θ2 = point_displacement_jacobians(assembly.stop[ielem], prescribed_conditions)
# rotation parameter matrices
C_θ1, C_θ2, C_θ3 = get_C_θ(C, θ)
Qinv_θ1, Qinv_θ2, Qinv_θ3 = get_Qinv_θ(θ)
# strain and curvature
γ_F, γ_M, κ_F, κ_M = S11, S12, S21, S22
return (; properties..., u1_u1, u2_u2, θ1_θ1, θ2_θ2,
C_θ1, C_θ2, C_θ3, Qinv_θ1, Qinv_θ2, Qinv_θ3, γ_F, γ_M, κ_F, κ_M)
end
"""
steady_element_jacobian_properties(properties, x, indices,
force_scaling, structural_damping, assembly, ielem, prescribed_conditions,
gravity)
Calculate/extract the element properties needed to calculate the jacobian entries
corresponding to a element for a steady state analysis
"""
@inline function steady_element_jacobian_properties(properties, x, indices,
force_scaling, structural_damping, assembly, ielem, prescribed_conditions,
gravity)
properties = static_element_jacobian_properties(properties, x, indices, force_scaling,
assembly, ielem, prescribed_conditions, gravity)
@unpack Δx, αb, L, mass11, mass12, mass21, mass22, C, Cab, CtCab, Q, u, θ, V, Ω, Vdot, Ωdot,
C_θ1, C_θ2, C_θ3 = properties
# rotation parameter matrices
Q_θ1, Q_θ2, Q_θ3 = get_Q_θ(Q, θ)
# linear and angular momentum
P_θ = mul3(C_θ1', C_θ2', C_θ3', Cab*(mass11*CtCab'*V + mass12*CtCab'*Ω)) +
CtCab*mass11*Cab'*mul3(C_θ1, C_θ2, C_θ3, V) +
CtCab*mass12*Cab'*mul3(C_θ1, C_θ2, C_θ3, Ω)
P_V = CtCab*mass11*CtCab'
P_Ω = CtCab*mass12*CtCab'
H_θ = mul3(C_θ1', C_θ2', C_θ3', Cab*(mass21*CtCab'*V + mass22*CtCab'*Ω)) +
CtCab*mass21*Cab'*mul3(C_θ1, C_θ2, C_θ3, V) +
CtCab*mass22*Cab'*mul3(C_θ1, C_θ2, C_θ3, Ω)
H_V = CtCab*mass21*CtCab'
H_Ω = CtCab*mass22*CtCab'
# linear and angular acceleration
Vdot_ab = I3
Vdot_αb = -tilde(Δx + u)
Vdot_u = tilde(αb)
Ωdot_αb = I3
# linear and angular momentum rates
Pdot_Vdot = CtCab*mass11*CtCab'
Pdot_Ωdot = CtCab*mass12*CtCab'
Hdot_Vdot = CtCab*mass21*CtCab'
Hdot_Ωdot = CtCab*mass22*CtCab'
Pdot_ab = Pdot_Vdot*Vdot_ab
Pdot_αb = Pdot_Vdot*Vdot_αb + Pdot_Ωdot*Ωdot_αb
Hdot_ab = Hdot_Vdot*Vdot_ab
Hdot_αb = Hdot_Vdot*Vdot_αb + Hdot_Ωdot*Ωdot_αb
Pdot_u = Pdot_Vdot*Vdot_u
Hdot_u = Hdot_Vdot*Vdot_u
Pdot_θ = mul3(C_θ1', C_θ2', C_θ3', Cab*mass11*CtCab'*Vdot) +
mul3(C_θ1', C_θ2', C_θ3', Cab*mass12*CtCab'*Ωdot) +
CtCab*mass11*Cab'*mul3(C_θ1, C_θ2, C_θ3, Vdot) +
CtCab*mass12*Cab'*mul3(C_θ1, C_θ2, C_θ3, Ωdot)
Hdot_θ = mul3(C_θ1', C_θ2', C_θ3', Cab*mass21*CtCab'*Vdot) +
mul3(C_θ1', C_θ2', C_θ3', Cab*mass22*CtCab'*Ωdot) +
CtCab*mass21*Cab'*mul3(C_θ1, C_θ2, C_θ3, Vdot) +
CtCab*mass22*Cab'*mul3(C_θ1, C_θ2, C_θ3, Ωdot)
Pdot_V = @SMatrix zeros(3,3)
Pdot_Ω = @SMatrix zeros(3,3)
Hdot_V = @SMatrix zeros(3,3)
Hdot_Ω = @SMatrix zeros(3,3)
if structural_damping
@unpack ωb, C1, C2, Qinv1, Qinv2, u1, u2, θ1, θ2, Ω1, Ω2, μ11, μ22,
uedot, θedot, Δx1, Δx2, Δu, Δθ, ΔQ, Δudot, Δθdot = properties
# rotation parameter matrices
C1_θ1, C1_θ2, C1_θ3 = get_C_θ(C1, θ1)
C2_θ1, C2_θ2, C2_θ3 = get_C_θ(C2, θ2)
Qinv1_θ1, Qinv1_θ2, Qinv1_θ3 = get_Qinv_θ(θ1)
Qinv2_θ1, Qinv2_θ2, Qinv2_θ3 = get_Qinv_θ(θ2)
# linear displacement rates
udot1_u1 = -tilde(ωb)
udot2_u2 = -tilde(ωb)
udot1_V1 = I3
udot2_V2 = I3
# angular displacement rates
θdot1_θ1 = mul3(Qinv1_θ1, Qinv1_θ2, Qinv1_θ3, C1*(Ω1 - ωb)) + Qinv1*mul3(C1_θ1, C1_θ2, C1_θ3, Ω1 - ωb)
θdot2_θ2 = mul3(Qinv2_θ1, Qinv2_θ2, Qinv2_θ3, C2*(Ω2 - ωb)) + Qinv2*mul3(C2_θ1, C2_θ2, C2_θ3, Ω2 - ωb)
θdot1_Ω1 = Qinv1*C1
θdot2_Ω2 = Qinv2*C2
θdot_θ1 = θdot1_θ1/2
θdot_θ2 = θdot2_θ2/2
θdot_Ω1 = θdot1_Ω1/2
θdot_Ω2 = θdot2_Ω2/2
# change in linear and angular displacement
Δu_u1 = -I3
Δu_u2 = I3
Δθ_θ1 = -I3
Δθ_θ2 = I3
# change in linear and angular displacement rates
Δudot_u1 = -udot1_u1
Δudot_u2 = udot2_u2
Δudot_V1 = -udot1_V1
Δudot_V2 = udot2_V2
Δθdot_θ1 = -θdot1_θ1
Δθdot_θ2 = θdot2_θ2
Δθdot_Ω1 = -θdot1_Ω1
Δθdot_Ω2 = θdot2_Ω2
# ΔQ matrix (see structural damping theory)
ΔQ_θ1, ΔQ_θ2, ΔQ_θ3 = get_ΔQ_θ(θ, Δθ, Q, Q_θ1, Q_θ2, Q_θ3)
ΔQ_Δθ1 = mul3(Q_θ1, Q_θ2, Q_θ3, e1)
ΔQ_Δθ2 = mul3(Q_θ1, Q_θ2, Q_θ3, e2)
ΔQ_Δθ3 = mul3(Q_θ1, Q_θ2, Q_θ3, e3)
# strain rates
tmp = CtCab'*tilde(Ω - ωb)
γdot_u1 = -tmp*Δu_u1 + CtCab'*Δudot_u1
γdot_u2 = -tmp*Δu_u2 + CtCab'*Δudot_u2
tmp = -Cab'*mul3(C_θ1, C_θ2, C_θ3, tilde(Ω - ωb)*Δu) +
Cab'*mul3(C_θ1, C_θ2, C_θ3, Δudot) -
L*Cab'*mul3(C_θ1, C_θ2, C_θ3, tilde(Ω - ωb)*Cab*e1)
γdot_θ1 = 1/2*tmp
γdot_θ2 = 1/2*tmp
γdot_V1 = CtCab'*Δudot_V1
γdot_V2 = CtCab'*Δudot_V2
tmp = CtCab'*tilde(Δu) + L*CtCab'*tilde(Cab*e1)
γdot_Ω1 = 1/2*tmp
γdot_Ω2 = 1/2*tmp
tmp1 = Cab'*mul3(Q_θ1, Q_θ2, Q_θ3, Δθdot)
tmp2 = Cab'*mul3(ΔQ_θ1, ΔQ_θ2, ΔQ_θ3, θedot)
tmp3 = Cab'*mul3(ΔQ_Δθ1, ΔQ_Δθ2, ΔQ_Δθ3, θedot)
κdot_θ1 = 1/2*tmp1 + 1/2*tmp2 + tmp3*Δθ_θ1 + Cab'*Q*Δθdot_θ1 + Cab'*ΔQ*θdot_θ1
κdot_θ2 = 1/2*tmp1 + 1/2*tmp2 + tmp3*Δθ_θ2 + Cab'*Q*Δθdot_θ2 + Cab'*ΔQ*θdot_θ2
κdot_Ω1 = Cab'*Q*Δθdot_Ω1 + Cab'*ΔQ*θdot_Ω1
κdot_Ω2 = Cab'*Q*Δθdot_Ω2 + Cab'*ΔQ*θdot_Ω2
# adjust strains to account for strain rates
γ_u1 = -μ11*γdot_u1
γ_u2 = -μ11*γdot_u2
γ_θ1 = -μ11*γdot_θ1
γ_θ2 = -μ11*γdot_θ2
γ_V1 = -μ11*γdot_V1
γ_V2 = -μ11*γdot_V2
γ_Ω1 = -μ11*γdot_Ω1
γ_Ω2 = -μ11*γdot_Ω2
κ_θ1 = -μ22*κdot_θ1
κ_θ2 = -μ22*κdot_θ2
κ_Ω1 = -μ22*κdot_Ω1
κ_Ω2 = -μ22*κdot_Ω2
else
γ_u1 = @SMatrix zeros(3,3)
γ_u2 = @SMatrix zeros(3,3)
γ_θ1 = @SMatrix zeros(3,3)
γ_θ2 = @SMatrix zeros(3,3)
γ_V1 = @SMatrix zeros(3,3)
γ_V2 = @SMatrix zeros(3,3)
γ_Ω1 = @SMatrix zeros(3,3)
γ_Ω2 = @SMatrix zeros(3,3)
κ_θ1 = @SMatrix zeros(3,3)
κ_θ2 = @SMatrix zeros(3,3)
κ_Ω1 = @SMatrix zeros(3,3)
κ_Ω2 = @SMatrix zeros(3,3)
end
return (; properties..., γ_u1, γ_u2, γ_θ1, γ_θ2, γ_V1, γ_V2, γ_Ω1, γ_Ω2,
κ_θ1, κ_θ2, κ_Ω1, κ_Ω2, P_θ, P_V, P_Ω, H_θ, H_V, H_Ω,
Pdot_ab, Pdot_αb, Pdot_u, Pdot_θ, Pdot_V, Pdot_Ω,
Hdot_ab, Hdot_αb, Hdot_u, Hdot_θ, Hdot_V, Hdot_Ω)
end
"""
initial_element_jacobian_properties(properties, x, indices, rate_vars,
force_scaling, structural_damping, assembly, ielem, prescribed_conditions, gravity,
u0, θ0, V0, Ω0, Vdot0, Ωdot0)
Calculate/extract the element properties needed to calculate the jacobian entries
corresponding to a element for a Newmark scheme time marching analysis
"""
@inline function initial_element_jacobian_properties(properties, x, indices, rate_vars,
force_scaling, structural_damping, assembly, ielem, prescribed_conditions, gravity,
u0, θ0, V0, Ω0, Vdot0, Ωdot0)
@unpack Δx, ωb, αb, L, C, Cab, CtCab, CtCabdot, Q, S11, S12, S21, S22, mass11, mass12, mass21, mass22,
u, θ, V, Ω, Vdot, Ωdot = properties
# linear and angular displacement
u1_u1, θ1_θ1 = initial_point_displacement_jacobian(assembly.start[ielem], indices.icol_point,
prescribed_conditions, rate_vars)
u2_u2, θ2_θ2 = initial_point_displacement_jacobian(assembly.stop[ielem], indices.icol_point,
prescribed_conditions, rate_vars)
# rotation parameter matrices
C_θ1, C_θ2, C_θ3 = get_C_θ(C, θ)
Q_θ1, Q_θ2, Q_θ3 = get_Q_θ(Q, θ)
Qinv_θ1, Qinv_θ2, Qinv_θ3 = get_Qinv_θ(θ)
# strain and curvature
γ_F, γ_M, κ_F, κ_M = S11, S12, S21, S22
# linear and angular velocity (including body frame motion)
V_u = tilde(ωb)
# linear and angular momentum
P_u = CtCab*mass11*CtCab'*V_u
P_θ = mul3(C_θ1', C_θ2', C_θ3', Cab*(mass11*CtCab'*V + mass12*CtCab'*Ω)) +
CtCab*mass11*Cab'*mul3(C_θ1, C_θ2, C_θ3, V) +
CtCab*mass12*Cab'*mul3(C_θ1, C_θ2, C_θ3, Ω)
H_u = CtCab*mass21*CtCab'*V_u
H_θ = mul3(C_θ1', C_θ2', C_θ3', Cab*(mass21*CtCab'*V + mass22*CtCab'*Ω)) +
CtCab*mass21*Cab'*mul3(C_θ1, C_θ2, C_θ3, V) +
CtCab*mass22*Cab'*mul3(C_θ1, C_θ2, C_θ3, Ω)
# linear and angular acceleration
V1dot_V1dot, Ω1dot_Ω1dot = initial_point_velocity_rate_jacobian(assembly.start[ielem],
indices.icol_point, prescribed_conditions, rate_vars)
V2dot_V2dot, Ω2dot_Ω2dot = initial_point_velocity_rate_jacobian(assembly.stop[ielem],
indices.icol_point, prescribed_conditions, rate_vars)
# linear and angular acceleration (including body frame motion)
Vdot_ab = I3
Vdot_αb = -tilde(Δx + u)
Vdot_u = tilde(αb)
Vdot_udot = tilde(ωb)
Ωdot_αb = I3
# linear and angular momentum rates
Pdot_V = CtCab*mass11*CtCabdot' + CtCabdot*mass11*CtCab'
Pdot_Ω = CtCab*mass12*CtCabdot' + CtCabdot*mass12*CtCab'
Pdot_Vdot = CtCab*mass11*CtCab'
Pdot_Ωdot = CtCab*mass12*CtCab'
Pdot_ab = Pdot_Vdot*Vdot_ab
Pdot_αb = Pdot_Vdot*Vdot_αb + Pdot_Ωdot*Ωdot_αb
Pdot_u = Pdot_V*V_u + Pdot_Vdot*Vdot_u
Pdot_θ = mul3(C_θ1', C_θ2', C_θ3', Cab*mass11*CtCab'*Vdot) +
mul3(C_θ1', C_θ2', C_θ3', Cab*mass12*CtCab'*Ωdot) +
CtCab*mass11*Cab'*mul3(C_θ1, C_θ2, C_θ3, Vdot) +
CtCab*mass12*Cab'*mul3(C_θ1, C_θ2, C_θ3, Ωdot) +
tilde(Ω - ωb)*mul3(C_θ1', C_θ2', C_θ3', Cab*mass11*CtCab'*V) +
tilde(Ω - ωb)*mul3(C_θ1', C_θ2', C_θ3', Cab*mass12*CtCab'*Ω) +
CtCabdot*mass11*Cab'*mul3(C_θ1, C_θ2, C_θ3, V) +
CtCabdot*mass12*Cab'*mul3(C_θ1, C_θ2, C_θ3, Ω) +
mul3(C_θ1', C_θ2', C_θ3', Cab*mass11*CtCabdot'*V) +
mul3(C_θ1', C_θ2', C_θ3', Cab*mass12*CtCabdot'*Ω) +
-CtCab*mass11*Cab'*mul3(C_θ1, C_θ2, C_θ3, tilde(Ω - ωb)*V) +
-CtCab*mass12*Cab'*mul3(C_θ1, C_θ2, C_θ3, tilde(Ω - ωb)*Ω)
Pdot_udot = Pdot_Vdot*Vdot_udot
Hdot_V = CtCab*mass21*CtCabdot' + CtCabdot*mass21*CtCab'
Hdot_Ω = CtCab*mass22*CtCabdot' + CtCabdot*mass22*CtCab'
Hdot_Vdot = CtCab*mass21*CtCab'
Hdot_Ωdot = CtCab*mass22*CtCab'
Hdot_ab = Hdot_Vdot*Vdot_ab
Hdot_αb = Hdot_Vdot*Vdot_αb + Hdot_Ωdot*Ωdot_αb
Hdot_u = Hdot_V*V_u + Hdot_Vdot*Vdot_u
Hdot_θ = mul3(C_θ1', C_θ2', C_θ3', Cab*mass21*CtCab'*Vdot) +
mul3(C_θ1', C_θ2', C_θ3', Cab*mass22*CtCab'*Ωdot) +
CtCab*mass21*Cab'*mul3(C_θ1, C_θ2, C_θ3, Vdot) +
CtCab*mass22*Cab'*mul3(C_θ1, C_θ2, C_θ3, Ωdot) +
tilde(Ω - ωb)*mul3(C_θ1', C_θ2', C_θ3', Cab*mass21*CtCab'*V) +
tilde(Ω - ωb)*mul3(C_θ1', C_θ2', C_θ3', Cab*mass22*CtCab'*Ω) +
CtCabdot*mass21*Cab'*mul3(C_θ1, C_θ2, C_θ3, V) +
CtCabdot*mass22*Cab'*mul3(C_θ1, C_θ2, C_θ3, Ω) +
mul3(C_θ1', C_θ2', C_θ3', Cab*mass21*CtCabdot'*V) +
mul3(C_θ1', C_θ2', C_θ3', Cab*mass22*CtCabdot'*Ω) +
-CtCab*mass21*Cab'*mul3(C_θ1, C_θ2, C_θ3, tilde(Ω - ωb)*V) +
-CtCab*mass22*Cab'*mul3(C_θ1, C_θ2, C_θ3, tilde(Ω - ωb)*Ω)
Hdot_udot = Hdot_Vdot*Vdot_udot
if structural_damping
@unpack μ11, μ22, Δu, Δθ, ΔQ, udot, θdot, Δudot, Δθdot = properties
# linear displacement rates
u1dot_u1dot = I3
u2dot_u2dot = I3
# angular displacement rates
θ1dot_θ1dot = I3
θ2dot_θ2dot = I3
θdot_θ1dot = 1/2*θ1dot_θ1dot
θdot_θ2dot = 1/2*θ2dot_θ2dot
# change in linear displacement
Δu_u1 = -I3
Δu_u2 = I3
# change in linear and angular displacement rates
Δudot_u1dot = -u1dot_u1dot
Δudot_u2dot = u2dot_u2dot
Δθdot_θ1dot = -θ1dot_θ1dot
Δθdot_θ2dot = θ2dot_θ2dot
# ΔQ matrix (see structural damping theory)
ΔQ_θ1, ΔQ_θ2, ΔQ_θ3 = get_ΔQ_θ(θ, Δθ, Q, Q_θ1, Q_θ2, Q_θ3)
ΔQ_Δθ1 = mul3(Q_θ1, Q_θ2, Q_θ3, e1)
ΔQ_Δθ2 = mul3(Q_θ1, Q_θ2, Q_θ3, e2)
ΔQ_Δθ3 = mul3(Q_θ1, Q_θ2, Q_θ3, e3)
# strain rates
tmp = CtCab'*tilde(Ω - ωb)
γdot_u1 = -tmp*Δu_u1
γdot_u2 = -tmp*Δu_u2
γdot_u1dot = CtCab'*Δudot_u1dot
γdot_u2dot = CtCab'*Δudot_u2dot
tmp = -Cab'*mul3(C_θ1, C_θ2, C_θ3, tilde(Ω - ωb)*Δu) +
Cab'*mul3(C_θ1, C_θ2, C_θ3, Δudot) -
L*Cab'*mul3(C_θ1, C_θ2, C_θ3, tilde(Ω - ωb)*Cab*e1)
γdot_θ1 = 1/2*tmp
γdot_θ2 = 1/2*tmp
tmp1 = Cab'*mul3(Q_θ1, Q_θ2, Q_θ3, Δθdot)
tmp2 = Cab'*mul3(ΔQ_θ1, ΔQ_θ2, ΔQ_θ3, θdot)
tmp3 = Cab'*mul3(ΔQ_Δθ1, ΔQ_Δθ2, ΔQ_Δθ3, θdot)
κdot_θ1 = 1/2*tmp1 + 1/2*tmp2 - tmp3
κdot_θ2 = 1/2*tmp1 + 1/2*tmp2 + tmp3
κdot_θ1dot = Cab'*Q*Δθdot_θ1dot + Cab'*ΔQ*θdot_θ1dot
κdot_θ2dot = Cab'*Q*Δθdot_θ2dot + Cab'*ΔQ*θdot_θ2dot
# adjust strains to account for strain rates
γ_u1 = -μ11*γdot_u1
γ_u2 = -μ11*γdot_u2