-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmbeddedBeamInterfaceP.cpp
More file actions
1048 lines (872 loc) · 31.6 KB
/
EmbeddedBeamInterfaceP.cpp
File metadata and controls
1048 lines (872 loc) · 31.6 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
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
/* ****************************************************************** **
** OpenSees - Open System for Earthquake Engineering Simulation **
** Pacific Earthquake Engineering Research Center **
** **
** **
** (C) Copyright 1999, The Regents of the University of California **
** All Rights Reserved. **
** **
** Commercial use of this program without express permission of the **
** University of California, Berkeley, is strictly prohibited. See **
** file 'COPYRIGHT' in main directory for information on usage and **
** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. **
** **
** Developed by: **
** Frank McKenna (fmckenna@ce.berkeley.edu) **
** Gregory L. Fenves (fenves@ce.berkeley.edu) **
** Filip C. Filippou (filippou@ce.berkeley.edu) **
** **
** ****************************************************************** */
// Written: Alborz Ghofrani, Diego Turello, Pedro Arduino, U.Washington
// Created: May 2017
// Description: This file contains the class definition for EmbeddedBeamInterfaceP.
#include <EmbeddedBeamInterfaceP.h>
#include <Node.h>
#include <Matrix.h>
#include <Vector.h>
#include <ID.h>
#include <Renderer.h>
#include <Domain.h>
#include <string.h>
#include <Information.h>
#include <Parameter.h>
#include <Channel.h>
#include <FEM_ObjectBroker.h>
#include <ElementResponse.h>
#include <CrdTransf.h>
#include <elementAPI.h>
#include <cmath>
#include <NodeIter.h>
static int num_EmbeddedBeamInterfaceP = 0;
static const double m_Pi = 3.14159265359;
void *
OPS_EmbeddedBeamInterfaceP(void)
{
if (num_EmbeddedBeamInterfaceP == 0) {
num_EmbeddedBeamInterfaceP++;
opserr << "EmbeddedBeamInterfaceP element - Written: A.Ghofrani, D.Turello, P.Arduino, U.Washington\n";
}
Element *theElement = 0;
int numArgs = OPS_GetNumRemainingInputArgs();
if (numArgs < 1) {
opserr << "Want: EmbeddedBeamInterfaceP tag? \n";
return 0;
}
int iData[1];
int eleTag = 0;
int numData = 1;
if (OPS_GetIntInput(&numData, iData) != 0) {
opserr << "WARNING invalid integer data: element EmbeddedBeamInterfaceP" << endln;
return 0;
}
eleTag = iData[0];
theElement = new EmbeddedBeamInterfaceP(iData[0]);
if (theElement == 0) {
opserr << "WARNING could not create element of type EmbeddedBeamInterfaceP\n";
return 0;
}
return theElement;
}
EmbeddedBeamInterfaceP::EmbeddedBeamInterfaceP(int tag) : Element(tag, ELE_TAG_EmbeddedBeamInterfaceP)
{
}
EmbeddedBeamInterfaceP::EmbeddedBeamInterfaceP(int tag, int beamTag, std::vector <int> solidTag, int crdTransfTag,
std::vector <double> beamRho, std::vector <double> beamTheta, std::vector <double> solidXi, std::vector <double> solidEta,
std::vector <double> solidZeta, double radius, double area): Element(tag, ELE_TAG_EmbeddedBeamInterfaceP),
m_beam_radius(radius), m_area(area), m_ep(1.0e13), m_Lambda(12),
m_Ba_rot_n(3), m_Bb_rot_n(3),
m_Ba_disp_n(3), m_Bb_disp_n(3),
m_Ba1(3), m_Bb1(3),
m_Bcl_pos(3), m_Bcl_pos_n(3), m_pos(3),
m_B_loc(3), m_S_disp(3),
mQa(3, 3), mQb(3, 3), mQc(3, 3), mc1(3),
mBphi(3, 12), mBu(3, 12), mHf(3, 12), m_Ns(8)
{
// get domain to access element tags and their nodes
#ifdef _PARALLEL_PROCESSING
#include <PartitionedDomain.h>
extern PartitionedDomain theDomain;
#else
extern Domain theDomain;
#endif
m_numEmbeddedPoints = solidTag.size();
theSolidTag = new int[m_numEmbeddedPoints];
solidNodeTags = new int[8 * m_numEmbeddedPoints];
m_beam_rho = m_beam_theta = m_solid_xi = m_solid_eta = m_solid_zeta = Vector(m_numEmbeddedPoints);
std::set <int> uniqueNodeTags;
Element *theElement;
for (int ii = 0; ii < m_numEmbeddedPoints; ii++)
{
theSolidTag[ii] = solidTag[ii];
m_solid_xi(ii) = solidXi[ii];
m_solid_eta(ii) = solidEta[ii];
m_solid_zeta(ii) = solidZeta[ii];
m_beam_rho(ii) = beamRho[ii];
m_beam_theta(ii) = beamTheta[ii];
theElement = theDomain.getElement(solidTag[ii]);
// opserr << "Point " << ii +1 << " : element " << solidTag[ii] << " at (" << solidXi[ii] << "," << solidEta[ii] << "," << solidZeta[ii] << ") , beam: " << beamTag << " at (" << beamRho[ii] << "," << beamTheta[ii] << ")" << endln;
for (int jj = 0; jj < 8; jj++)
{
uniqueNodeTags.insert(theElement->getNodePtrs()[jj]->getTag());
solidNodeTags[ii * 8 + jj] = theElement->getNodePtrs()[jj]->getTag();
}
}
// opserr << m_beam_rho << m_beam_theta;
// for(int ii = 0 ; ii < 8*m_numEmbeddedPoints; ii++)
// opserr << *(solidNodeTags+ii) << " ";
// opserr << endln;
m_numSolidNodes = (int)uniqueNodeTags.size();
EBIP_numNodes = m_numSolidNodes + 2;
EBIP_numDOF = m_numSolidNodes * 3 + 12;
// opserr << m_numSolidNodes << endln;
externalNodes = ID(EBIP_numNodes);
theNodes = new Node*[EBIP_numNodes];
int count = 0;
for (std::set <int>::iterator it = uniqueNodeTags.begin(); it != uniqueNodeTags.end(); ++it)
{
m_nodeMap[*it] = count;
externalNodes(count) = *it;
count++;
}
theElement = theDomain.getElement(beamTag);
for (int ii = 0; ii < 2; ii++)
{
externalNodes(count) = theElement->getNodePtrs()[ii]->getTag();
count++;
}
m_InterfaceForces = Vector(EBIP_numDOF);
m_InterfaceStiffness = Matrix(EBIP_numDOF, EBIP_numDOF);
mA = Matrix(3 * m_numSolidNodes, 12);
mB = Matrix(12, 12);
mAt = Matrix(12, 3 * m_numSolidNodes);
mBt = Matrix(12, 12);
mAAt = Matrix(3 * m_numSolidNodes, 3 * m_numSolidNodes);
mBBt = Matrix(12, 12);
mABt = Matrix(3 * m_numSolidNodes, 12);
// get the coordinate transformation object
crdTransf = OPS_GetCrdTransf(crdTransfTag)->getCopy3d();
}
EmbeddedBeamInterfaceP::EmbeddedBeamInterfaceP()
: Element(0, ELE_TAG_EmbeddedBeamInterfaceP)
{
}
EmbeddedBeamInterfaceP::~EmbeddedBeamInterfaceP()
{
}
int
EmbeddedBeamInterfaceP::getNumExternalNodes(void) const
{
return EBIP_numNodes;
}
const ID&
EmbeddedBeamInterfaceP::getExternalNodes(void)
{
return externalNodes;
}
Node **
EmbeddedBeamInterfaceP::getNodePtrs(void)
{
return theNodes;
}
int
EmbeddedBeamInterfaceP::getNumDOF(void)
{
return EBIP_numDOF;
}
int
EmbeddedBeamInterfaceP::revertToLastCommit(void)
{
return 0;
}
int
EmbeddedBeamInterfaceP::revertToStart(void)
{
return 0;
}
const Matrix&
EmbeddedBeamInterfaceP::getTangentStiff(void)
{
m_InterfaceStiffness.Zero();
for (int ii = 0; ii < 3 * m_numSolidNodes; ii++)
for (int jj = 0; jj < 3 * m_numSolidNodes; jj++)
m_InterfaceStiffness(ii, jj) = mAAt(ii, jj);
for (int ii = 0; ii < 3 * m_numSolidNodes; ii++)
for (int jj = 0; jj < 12; jj++)
{
m_InterfaceStiffness(ii, 3 * m_numSolidNodes + jj) = -1.0 * mABt(ii, jj);
m_InterfaceStiffness(3 * m_numSolidNodes + jj, ii) = -1.0 * mABt(ii, jj);
}
for (int ii = 0; ii < 12; ii++)
for (int jj = 0; jj < 12; jj++)
m_InterfaceStiffness(3 * m_numSolidNodes + ii, 3 * m_numSolidNodes + jj) = mBBt(ii, jj);
m_InterfaceStiffness *= m_ep;
return m_InterfaceStiffness;
}
const Matrix&
EmbeddedBeamInterfaceP::getInitialStiff(void)
{
return this->getTangentStiff();
}
const Vector&
EmbeddedBeamInterfaceP::getResistingForce(void)
{
m_InterfaceForces.Zero();
Vector temp2(12), temp(3 * m_numSolidNodes);
temp = mA * m_Lambda;
temp2 = -1.0 * mB * m_Lambda;
for (int ii = 0; ii < 3 * m_numSolidNodes; ii++)
m_InterfaceForces(ii) = temp(ii);
for (int ii = 0; ii < 12; ii++)
m_InterfaceForces(3 * m_numSolidNodes + ii) = temp2(ii);
return m_InterfaceForces;
}
int
EmbeddedBeamInterfaceP::sendSelf(int commitTag, Channel &theChannel)
{
return 0;
}
int
EmbeddedBeamInterfaceP::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker
&theBroker)
{
return 0;
}
int
EmbeddedBeamInterfaceP::displaySelf(Renderer &theViewer, int displayMode, float fact, const char **modes, int numMode)
{
return 0;
}
void
EmbeddedBeamInterfaceP::Print(OPS_Stream &s, int flag)
{
return;
}
Response*
EmbeddedBeamInterfaceP::setResponse(const char **argv, int argc,
OPS_Stream &s)
{
if (strcmp(argv[0], "force") == 0 || strcmp(argv[0], "globalForce") == 0) {
return new ElementResponse(this, 1, Vector(3 * m_numEmbeddedPoints));
}
else if (strcmp(argv[0], "displacement") == 0 || strcmp(argv[0], "disp") == 0)
{
return new ElementResponse(this, 2, Vector(3 * m_numEmbeddedPoints));
}
else if (strcmp(argv[0], "beamCL") == 0 || strcmp(argv[0], "beamCenterLine") == 0) {
return new ElementResponse(this, 3, Vector(3 * m_numEmbeddedPoints));
}
else if (strcmp(argv[0], "c1") == 0 || strcmp(argv[0], "tangent") == 0) {
return new ElementResponse(this, 4, Vector(3 * m_numEmbeddedPoints));
}
else if (strcmp(argv[0], "c2") == 0 || strcmp(argv[0], "perp2") == 0) {
return new ElementResponse(this, 5, Vector(3 * m_numEmbeddedPoints));
}
else if (strcmp(argv[0], "c3") == 0 || strcmp(argv[0], "perp3") == 0) {
return new ElementResponse(this, 6, Vector(3 * m_numEmbeddedPoints));
}
else {
opserr << "EmbeddedBeamInterfaceP Recorder, " << argv[0] << "is an unknown recorder request"
<< " Element tag : " << this->getTag() << endln;
return 0;
}
}
int
EmbeddedBeamInterfaceP::getResponse(int responseID, Information &eleInformation)
{
// TODO: Needs to be updated
if (responseID == 1) // force
return eleInformation.setVector(GetInteractionPtForce());
else if (responseID == 2) // displacement
return eleInformation.setVector(GetInteractionPtDisp());
else if (responseID == 3) // centerline
return eleInformation.setVector(m_Bcl_pos);
else if (responseID == 4) // c1
{
Vector temp(3);
for (int ii = 0; ii < 3; ii++)
temp(ii) = mQc(ii, 0);
return eleInformation.setVector(temp);
}
else if (responseID == 5) // c2
{
Vector temp(3);
for (int ii = 0; ii < 3; ii++)
temp(ii) = mQc(ii, 1);
return eleInformation.setVector(temp);
}
else if (responseID == 6) // c3
{
Vector temp(3);
for (int ii = 0; ii < 3; ii++)
temp(ii) = mQc(ii, 2);
return eleInformation.setVector(temp);
}
else {
opserr << "EmbeddedBeamInterfaceP, tag = " << this->getTag()
<< " -- unknown request" << endln;
return -1;
}
}
int
EmbeddedBeamInterfaceP::setParameter(const char **argv, int argc, Parameter ¶m)
{
return 0;
}
int
EmbeddedBeamInterfaceP::updateParameter(int parameterID, Information &info)
{
return 0;
}
void
EmbeddedBeamInterfaceP::setDomain(Domain *theDomain)
{
for (int ii = 0; ii < m_numSolidNodes + 2; ii++)
{
theNodes[ii] = theDomain->getNode(externalNodes(ii));
if (theNodes[ii] == 0)
{
opserr << "Could not find node " << externalNodes(ii) << "." << endln;
return;
}
if ((theNodes[ii]->getNumberDOF() != 3) && (ii < m_numSolidNodes))
{
opserr << "Solid node " << externalNodes(ii) << " has to have 3 degrees of freedom." << endln;
return;
}
if ((theNodes[ii]->getNumberDOF() != 6) && (ii > m_numSolidNodes - 1))
{
opserr << "Beam node " << externalNodes(ii) << " has to have 6 degrees of freedom." << endln;
return;
}
}
// initialize the transformation
if (crdTransf->initialize(theNodes[m_numSolidNodes], theNodes[m_numSolidNodes + 1]))
{
opserr << "EmbeddedBeamInterfaceAL2::setDomain(): Error initializing coordinate transformation";
return;
}
m_beam_length = crdTransf->getInitialLength();
if (m_beam_length < 1.0e-12)
{
opserr << "FATAL ERROR EmbeddedBeamInterfaceAL2 (tag: " << this->getTag() << ") : "
<< "Beam element has zero length." << endln;
return;
}
Vector initXAxis(3);
Vector initYAxis(3);
Vector initZAxis(3);
crdTransf->getLocalAxes(initXAxis, initYAxis, initZAxis);
// fill mQa
for (int i = 0; i < 3; i++)
{
mQa(i, 0) = initXAxis(i);
mQa(i, 1) = initYAxis(i);
mQa(i, 2) = initZAxis(i);
}
// set mQb = mQa : beam column element requires zero initial twist
// if mQa = mQb -> mchi = 0
mQc = mQb = mQa;
mchi = 0;
// calculate A and B
mA.Zero();
mB.Zero();
Matrix mC = mA;
Matrix mD = mB;
for (int ii = 0; ii < m_numEmbeddedPoints; ii++)
{
updateShapeFuncs(m_solid_xi(ii), m_solid_eta(ii), m_solid_zeta(ii), m_beam_rho(ii));
mHf.Zero();
ComputeHf(mHf, m_beam_theta(ii));
Element * theElement = theDomain->getElement(theSolidTag[ii]);
double oneOver2PiR = 0.5 / m_Pi / m_beam_radius * m_area;
double oneOver2PiR2 = oneOver2PiR / m_beam_radius;
/*for (int jj = 0; jj < 8; jj++)
{
int nodeInA = m_nodeMap[theElement->getNodePtrs()[jj]->getTag()];
mA(3 * nodeInA, 0) += oneOver2PiR * m_Ns(jj)*m_Nb1;
mA(3 * nodeInA, 6) += oneOver2PiR * m_Ns(jj)*m_Nb2;
mA(3 * nodeInA + 1, 1) += oneOver2PiR * m_Ns(jj)*m_Nb1;
mA(3 * nodeInA + 1, 7) += oneOver2PiR * m_Ns(jj)*m_Nb2;
mA(3 * nodeInA + 2, 2) += oneOver2PiR * m_Ns(jj)*m_Nb1;
mA(3 * nodeInA + 2, 8) += oneOver2PiR * m_Ns(jj)*m_Nb2;
mA(3 * nodeInA, 5) += -oneOver2PiR2 * m_Ns(jj) * m_Nb1 * sin(m_beam_theta(ii));
mA(3 * nodeInA + 1, 5) += oneOver2PiR2 * m_Ns(jj) * m_Nb1 * cos(m_beam_theta(ii));
mA(3 * nodeInA + 2, 3) += 2.0 * oneOver2PiR2 * m_Ns(jj) * m_Nb1 * sin(m_beam_theta(ii));
mA(3 * nodeInA + 2, 4) += -2.0 * oneOver2PiR2 * m_Ns(jj) * m_Nb1 * cos(m_beam_theta(ii));
mA(3 * nodeInA, 11) += -oneOver2PiR2 * m_Ns(jj) * m_Nb2 * sin(m_beam_theta(ii));
mA(3 * nodeInA + 1, 11) += oneOver2PiR2 * m_Ns(jj) * m_Nb2 * cos(m_beam_theta(ii));
mA(3 * nodeInA + 2, 9) += 2.0 * oneOver2PiR2 * m_Ns(jj) * m_Nb2 * sin(m_beam_theta(ii));
mA(3 * nodeInA + 2, 10) += -2.0 * oneOver2PiR2 * m_Ns(jj) * m_Nb2 * cos(m_beam_theta(ii));
}*/
for (int jj = 0; jj < 8; jj++)
{
int nodeInA = m_nodeMap[theElement->getNodePtrs()[jj]->getTag()];
// opserr << "Element " << theSolidTag[ii] << " - Node " << theElement->getNodePtrs()[jj]->getTag() << " which is " << nodeInA << " in the local Mat." << endln;
for (int kk = 0; kk < 12; kk++)
{
mA(3 * nodeInA, kk) += m_Ns(jj) * mHf(0, kk);
mA(3 * nodeInA + 1, kk) += m_Ns(jj) * mHf(1, kk);
mA(3 * nodeInA + 2, kk) += m_Ns(jj) * mHf(2, kk);
}
}
//opserr << mA << mC;
ComputeBphiAndBu(mBphi, mBu);
// I need to update Qc as well!
Vector c2(3), c3(3);
for (int ii = 0; ii < 3; ii++)
{
c2(ii) = mQc(ii, 1);
c3(ii) = mQc(ii, 2);
}
Matrix Hb(3, 12);
Hb = mBu - (m_beam_radius*(cos(m_beam_theta(ii))*ComputeSkew(c2) + sin(m_beam_theta(ii))*ComputeSkew(c3))) * mBphi;
// opserr << Hb;
// Hb.Zero();
// Hb(0, 0) = m_Hb1;
// Hb(0, 4) = m_Hb2;
// Hb(0, 5) = -m_Nb1 * m_beam_radius * sin(m_beam_theta(ii));
// Hb(1, 1) = m_Hb1;
// Hb(1, 3) = m_Hb2;
// Hb(1, 5) = m_Nb1 * m_beam_radius * cos(m_beam_theta(ii));
// Hb(2, 0) = -m_beam_radius * m_dH1 * cos(m_beam_theta(ii));
// Hb(2, 1) = -m_beam_radius * m_dH1 * sin(m_beam_theta(ii));
// Hb(2, 2) = m_Nb1;
// Hb(2, 3) = -m_beam_radius * m_dH2 * sin(m_beam_theta(ii));
// Hb(2, 4) = -m_beam_radius * m_dH2 * cos(m_beam_theta(ii));
//
// Hb(0, 6) = m_Hb3;
// Hb(0, 10) = m_Hb4;
// Hb(0, 11) = -m_Nb2 * m_beam_radius * sin(m_beam_theta(ii));
// Hb(1, 7) = m_Hb3;
// Hb(1, 9) = m_Hb4;
// Hb(1, 11) = m_Nb2 * m_beam_radius * cos(m_beam_theta(ii));
// Hb(2, 6) = -m_beam_radius * m_dH3 * cos(m_beam_theta(ii));
// Hb(2, 7) = -m_beam_radius * m_dH3 * sin(m_beam_theta(ii));
// Hb(2, 8) = m_Nb2;
// Hb(2, 9) = -m_beam_radius * m_dH4 * sin(m_beam_theta(ii));
// Hb(2, 10) = -m_beam_radius * m_dH4 * cos(m_beam_theta(ii));
// opserr << Hb;
// for (int jj = 0; jj < 12; jj++)
// {
// for (int kk = 0; kk < 3; kk++)
// {
// mB(jj , kk) += oneOver2PiR * m_Nb1 * Hb(kk, jj);
// mB(jj + 6, kk) += oneOver2PiR * m_Nb2 * Hb(kk, jj);
// }
//
// mB(jj, 3) += 2.0 * oneOver2PiR2 * m_Nb1 * sin(m_beam_theta(ii)) * Hb(2, jj);
// mB(jj, 9) += 2.0 * oneOver2PiR2 * m_Nb2 * sin(m_beam_theta(ii)) * Hb(2, jj);
// mB(jj, 4) += -2.0 * oneOver2PiR2 * m_Nb1 * cos(m_beam_theta(ii)) * Hb(2, jj);
// mB(jj, 10) += -2.0 * oneOver2PiR2 * m_Nb2 * cos(m_beam_theta(ii)) * Hb(2, jj);
// mB(jj, 5) += oneOver2PiR2 * m_Nb1 * (Hb(1, jj) * cos(m_beam_theta(ii)) - Hb(0, jj) * sin(m_beam_theta(ii)));
// mB(jj, 11) += oneOver2PiR2 * m_Nb2 * (Hb(1, jj) * cos(m_beam_theta(ii)) - Hb(0, jj) * sin(m_beam_theta(ii)));
// }
Matrix HbT = Transpose(3, 12, Hb);
mB += HbT * mHf;
// mD += HbT * mHf;
// opserr << mB << mD;
}
mA *= m_area;
mB *= m_area;
mAt = Transpose(3 * m_numSolidNodes, 12, mA);
mBt = Transpose(12, 12, mB);
mAAt = mA * mAt;
mBBt = mB * mBt;
mABt = mA * mBt;
// opserr << "mA = " << mA;
// opserr << "mB = " << mB;
this->DomainComponent::setDomain(theDomain);
return;
}
int
EmbeddedBeamInterfaceP::update(void)
{
Vector sDisp(3 * m_numSolidNodes), bDisp(12);
for (int ii = 0; ii < m_numSolidNodes; ii++)
{
sDisp(3 * ii) = theNodes[ii]->getTrialDisp()(0);
sDisp(3 * ii + 1) = theNodes[ii]->getTrialDisp()(1);
sDisp(3 * ii + 2) = theNodes[ii]->getTrialDisp()(2);
}
for (int jj = 0; jj < 6; jj++)
{
bDisp(jj) = theNodes[m_numSolidNodes]->getTrialDisp()(jj);
bDisp(jj + 6) = theNodes[m_numSolidNodes + 1]->getTrialDisp()(jj);
}
m_Lambda = m_ep * (mAt * sDisp - mBt * bDisp);
return 0;
}
int
EmbeddedBeamInterfaceP::commitState(void)
{
int retVal = 0;
// call element commitState to do any base class stuff
if ((retVal = this->Element::commitState()) != 0) {
opserr << "EmbeddedBeamInterfaceP::commitState() - failed in base class";
}
return retVal;
}
int EmbeddedBeamInterfaceP::updateShapeFuncs(double xi, double eta, double zeta, double rho)
{
if ((xi < -1.0) || (xi > 1.0) || (eta < -1.0) || (eta > 1.0) || (zeta < -1.0) || (zeta > 1.0))
{
opserr << "Error in shape function." << endln;
return -1;
}
if ((rho < -1.0) || (rho > 1.0))
{
opserr << "Error in shape function." << endln;
return -1;
}
double rho2 = rho * rho;
double rho3 = rho * rho2;
m_Ns(0) = -0.125 * (xi - 1) * (eta - 1) * (zeta - 1);
m_Ns(1) = 0.125 * (xi + 1) * (eta - 1) * (zeta - 1);
m_Ns(2) = -0.125 * (xi + 1) * (eta + 1) * (zeta - 1);
m_Ns(3) = 0.125 * (xi - 1) * (eta + 1) * (zeta - 1);
m_Ns(4) = 0.125 * (xi - 1) * (eta - 1) * (zeta + 1);
m_Ns(5) = -0.125 * (xi + 1) * (eta - 1) * (zeta + 1);
m_Ns(6) = 0.125 * (xi + 1) * (eta + 1) * (zeta + 1);
m_Ns(7) = -0.125 * (xi - 1) * (eta + 1) * (zeta + 1);
m_Hb1 = 0.125 * (4.0 - 6.0 * rho + 2.0 * rho3);
m_Hb3 = 0.125 * (4.0 + 6.0 * rho - 2.0 * rho3);
m_Hb2 = 0.125 * m_beam_length * (1.0 - rho - rho2 + rho3);
m_Hb4 = 0.125 * m_beam_length * (-1.0 - rho + rho2 + rho3);
m_Nb1 = 0.5 * (1 - rho);
m_Nb2 = 0.5 * (1 + rho);
m_dH1 = 0.75 * (-1.0 + rho2);
m_dH3 = 0.75 * (1.0 - rho2);
m_dH2 = 0.125 * m_beam_length * (-1.0 - 2.0 * rho + 3.0 * rho2);
m_dH4 = 0.125 * m_beam_length * (-1.0 + 2.0 * rho + 3.0 * rho2);
return 0;
}
Vector
EmbeddedBeamInterfaceP::CrossProduct(const Vector &V1, const Vector &V2)
{
Vector V3(3);
V3(0) = V1(1)*V2(2) - V1(2)*V2(1);
V3(1) = V1(2)*V2(0) - V1(0)*V2(2);
V3(2) = V1(0)*V2(1) - V1(1)*V2(0);
return V3;
}
Vector
EmbeddedBeamInterfaceP::Geta1(void)
{
Vector a1(3);
int i;
for (i = 0; i<3; i++) {
a1(i) = mQa(i, 0);
}
return a1;
}
Vector
EmbeddedBeamInterfaceP::Getb1(void)
{
Vector b1(3);
int i;
for (i = 0; i<3; i++) {
b1(i) = mQb(i, 0);
}
return b1;
}
void
EmbeddedBeamInterfaceP::Setc1(Vector c1_vec)
{
mc1 = c1_vec;
return;
}
Vector
EmbeddedBeamInterfaceP::Getc1(void) {
return mc1;
}
Matrix
EmbeddedBeamInterfaceP::Transpose(int dim1, int dim2, const Matrix &M)
{
// copied from transpose function in Brick.cpp
Matrix Mtran(dim2, dim1);
for (int i = 0; i < dim1; i++)
for (int j = 0; j < dim2; j++)
Mtran(j, i) = M(i, j);
return Mtran;
}
Matrix
EmbeddedBeamInterfaceP::ComputeSkew(Vector th)
{
Matrix skew_th(3, 3);
skew_th(0, 0) = 0.0;
skew_th(0, 1) = -th(2);
skew_th(0, 2) = th(1);
skew_th(1, 0) = th(2);
skew_th(1, 1) = 0.0;
skew_th(1, 2) = -th(0);
skew_th(2, 0) = -th(1);
skew_th(2, 1) = th(0);
skew_th(2, 2) = 0.0;
return skew_th;
}
void
EmbeddedBeamInterfaceP::ComputeBphiAndBu(Matrix &Bphi, Matrix &Bu)
{
int i, j;
Matrix dummy1(3, 3);
Matrix dummy2(3, 3);
Matrix dummy3(3, 3);
Matrix dummy4(3, 3);
double L = m_beam_length / 2.0;
Bphi.Zero();
Bu.Zero();
// Compute Bphi(0:2, 3:5)
dummy1.Zero();
dummy2.Zero();
dummy3.Zero();
dummy4.Zero();
// dummy1 = N1 * Qc*(E1 dyadic E1)
dummy1(0, 0) = m_Nb1*mQc(0, 0);
dummy1(1, 0) = m_Nb1*mQc(1, 0);
dummy1(2, 0) = m_Nb1*mQc(2, 0);
// dummy1 += dH2 * Qc*P1
dummy1(0, 1) = m_dH2*mQc(0, 1)/L; // dH2 * mQc(0:2,1:2)
dummy1(1, 1) = m_dH2*mQc(1, 1)/L;
dummy1(2, 1) = m_dH2*mQc(2, 1)/L;
dummy1(0, 2) = m_dH2*mQc(0, 2)/L;
dummy1(1, 2) = m_dH2*mQc(1, 2)/L;
dummy1(2, 2) = m_dH2*mQc(2, 2)/L;
// dummy2 = Qa^T
dummy2 = Transpose(3, 3, mQa);
// dummy3 = Qc * (N1*(E1 dyadic E1)+ dH2 * P1) * Qa^T
dummy3 = dummy1*dummy2;
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
Bphi(i, 3 + j) = dummy3(i, j);
// Reuse parts of dummy1 and dummy2 to calculate Bu(0:2,0:2)
// dummy1 += H1 * Qc*P1
dummy1(0, 1) = m_Hb1*mQc(0, 1); // H1 * mQc(0:2,1:2)
dummy1(1, 1) = m_Hb1*mQc(1, 1);
dummy1(2, 1) = m_Hb1*mQc(2, 1);
dummy1(0, 2) = m_Hb1*mQc(0, 2);
dummy1(1, 2) = m_Hb1*mQc(1, 2);
dummy1(2, 2) = m_Hb1*mQc(2, 2);
// dummy3 = Qc * (N1*(E1 dyadic E1)+ H1 * P1) * Qa^T
dummy3 = dummy1*dummy2;
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
Bu(i, j) = dummy3(i, j);
// Reuse dummy2 and Compute Bphi(0:2, 0:2) and Bu(0:2, 3:5)
dummy1.Zero();
dummy3.Zero();
// dummy1 = Qc*E^R*P1 (E^R is the skew symmetric meatrix for E1 cross product => E1 x a = [E^R].a)
dummy1(0, 1) = mQc(0, 2);
dummy1(0, 2) = -mQc(0, 1);
dummy1(1, 1) = mQc(1, 2);
dummy1(1, 2) = -mQc(1, 1);
dummy1(2, 1) = mQc(2, 2);
dummy1(2, 2) = -mQc(2, 1);
// dummy3 = Qc*E^R*P1*Qa^T
dummy3 = dummy1*dummy2;
// Compute Bphi(0:2, 0:2)
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
Bphi(i, j) = m_dH1 / L * dummy3(i, j);
// Compute Bu(0:2, 3:5)
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
Bu(i, 3 + j) = -m_Hb2 * dummy3(i, j);
// Reuse dummy1 and Compute Bphi(0:2, 6:8) and Bu(0:2, 9:11)
dummy2.Zero();
dummy3.Zero();
// dummy2 = Qb^T
dummy2 = Transpose(3, 3, mQb);
// dummy3 = Qc*E^R*P1*Qb^T
dummy3 = dummy1*dummy2;
// Compute Bphi(0:2, 6 : 8)
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
Bphi(i, 6 + j) = m_dH3 / L * dummy3(i, j);
// Compute Bu(0:2, 9:11)
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
Bu(i, 9 + j) = -m_Hb4 * dummy3(i, j);
// Reuse dummy2 and Compute Bphi(0:2, 9:11)
dummy1.Zero();
dummy3.Zero();
// dummy1 = N2 * Qc*(E1 dyadic E1)
dummy1(0, 0) = m_Nb2*mQc(0, 0); // N2 * mQc(0:2,0)
dummy1(1, 0) = m_Nb2*mQc(1, 0);
dummy1(2, 0) = m_Nb2*mQc(2, 0);
// dummy1 += dH4 * Qc*P1
dummy1(0, 1) = m_dH4*mQc(0, 1)/L; // dH4 * mQc(0:2,1:2)
dummy1(1, 1) = m_dH4*mQc(1, 1)/L;
dummy1(2, 1) = m_dH4*mQc(2, 1)/L;
dummy1(0, 2) = m_dH4*mQc(0, 2)/L;
dummy1(1, 2) = m_dH4*mQc(1, 2)/L;
dummy1(2, 2) = m_dH4*mQc(2, 2)/L;
// dummy3 = Qc * (N2*(E1 dyadic E1)+ dH4 * P1) * Qb^T
dummy3 = dummy1*dummy2;
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
Bphi(i, 9 + j) = dummy3(i, j);
// Reuse parts of dummy1 and dummy2 to calculate Bu(0:2,6:8)
// dummy1 += dH4 * Qc*P1
dummy1(0, 1) = m_Hb3*mQc(0, 1); // H3 * mQc(0:2,1:2)
dummy1(1, 1) = m_Hb3*mQc(1, 1);
dummy1(2, 1) = m_Hb3*mQc(2, 1);
dummy1(0, 2) = m_Hb3*mQc(0, 2);
dummy1(1, 2) = m_Hb3*mQc(1, 2);
dummy1(2, 2) = m_Hb3*mQc(2, 2);
// dummy3 = Qc * (N2*(E1 dyadic E1)+ H3 * P1) * Qb^T
dummy3 = dummy1*dummy2;
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
Bu(i, 6 + j) = dummy3(i, j);
return;
}
void EmbeddedBeamInterfaceP::ComputeHf(Matrix & Hf, double theta)
{
Hf.Zero();
double oneOver2PiR = 0.5 / m_Pi / m_beam_radius * m_area;
double oneOver2PiR2 = oneOver2PiR / m_beam_radius;
for (int ii = 0; ii < 3; ii++)
{
for (int jj = 0; jj < 3; jj++)
{
Hf(ii, jj) = oneOver2PiR * m_Nb1 * mQa(jj, ii);
Hf(ii, jj + 6) = oneOver2PiR * m_Nb2 * mQb(jj, ii);
}
Hf(0, ii + 3) = 2.0 * oneOver2PiR2 * m_Nb1 * (mQa(ii, 1) * sin(theta) - mQa(ii, 2) * cos(theta));
Hf(1, ii + 3) = -oneOver2PiR2 * mQa(ii, 0) * m_Nb1 * sin(theta);
Hf(2, ii + 3) = oneOver2PiR2 * mQa(ii, 0) * m_Nb1 * cos(theta);
Hf(0, ii + 9) = 2.0 * oneOver2PiR2 * m_Nb2 * (mQb(ii, 1) * sin(theta) - mQb(ii, 2) * cos(theta));
Hf(1, ii + 9) = -oneOver2PiR2 * mQb(ii, 0) * m_Nb2 * sin(theta);
Hf(2, ii + 9) = oneOver2PiR2 * mQb(ii, 0) * m_Nb2 * cos(theta);
}
Hf = mQc * Hf;
return;
}
void
EmbeddedBeamInterfaceP::UpdateTransforms(void)
{
Vector temp_a(6); // trial disp/rot vector at a(total disp/rot)
Vector temp_b(6); // trial disp/rot vector at a(total disp/rot)
Vector rot_a(3); // incr. rot vector at a (from n->n+1)
Vector rot_b(3); // incr. rot vector at a (from n->n+1)
Matrix Omega(3, 3); // Matrix used for Exponential Map
// Recalculate incremental rotations from step n to n+1
temp_a = theNodes[m_numSolidNodes]->getTrialDisp();
temp_b = theNodes[m_numSolidNodes + 1]->getTrialDisp();
for (int ii = 0; ii < 3; ii++) {
rot_a(ii) = temp_a(ii + 3) - m_Ba_rot_n(ii);
rot_b(ii) = temp_b(ii + 3) - m_Bb_rot_n(ii);
}
// Perform exponential update of Qa
// calculate exponential map of current incremental rotations
Omega = ExponentialMap(rot_a);
// calculate new Qa
mQa = Omega*mQa;
// Perform exponential update of Qb
// calculate exponential map of current incremental rotations
Omega = ExponentialMap(rot_b);
// calculate new Qb
mQb = Omega*mQb;
return;
}
void
EmbeddedBeamInterfaceP::ComputeQc()
{
Vector c1(3); // tangent vector at projection point, c
Vector a1(3); // tangent vector at a
Vector b1(3); // tangent vector at b
Vector temp(3); // dummy vector for use in calcs
Matrix Qc_df(3, 3); // Drill free transformation matrix for c
Matrix Qc_chi(3, 3); // Twist transformation matrix for c
Matrix Qb_df(3, 3); // Drill free transf. matrix from a to b
// Fill tangent vectors
a1 = Geta1();
b1 = Getb1();
c1 = Getc1();
temp.Zero();
// Calculate the drill free transformation from a to c, Qc_df
temp = CrossProduct(a1, c1);
Qc_df = ExponentialMap(temp);
// Calculate the drill free transformation from a to b, Qb_df
// for determination of twist angle mchi
temp = CrossProduct(a1, b1);
Qb_df = ExponentialMap(temp);
Qb_df = Qb_df * mQa;
// mchi = arcsin( b3 dot b2_df) = arcsin(mQb(:,2) dot Qb_df(:,1))
// WATCH SIGN!!!!
mchi = mQb(0, 2)*Qb_df(0, 1) + mQb(1, 2)*Qb_df(1, 1) + mQb(2, 2)*Qb_df(2, 1);
mchi = -asin(mchi);
// Calculate twist transformation from a to c, Qc_df
// based upon linear scaling of twist angle: mxi * mchi * c1
temp = m_Nb2*mchi*c1;
Qc_chi = ExponentialMap(temp);
mQc = (Qc_chi * Qc_df) * mQa;
return;
}
Matrix
EmbeddedBeamInterfaceP::ExponentialMap(Vector th)
{
double theta = th.Norm(); // vector norm
Matrix sk_theta(3,3); // skew of vector
if (theta > 1.0e-10)
sk_theta = ComputeSkew(th / theta);
else
sk_theta.Zero();
Matrix sk_theta2 = sk_theta * sk_theta; // dyadic product of vector
Matrix Q(3, 3); // Exonential Map Vector
Q.Zero();
Matrix meye1(3, 3);
meye1(0, 0) = 1.0;
meye1(1, 1) = 1.0;
meye1(2, 2) = 1.0;
Q = meye1 + sin(theta) * sk_theta + (1 - cos(theta)) * sk_theta2;
return Q;
}
Vector EmbeddedBeamInterfaceP::GetInteractionPtDisp()
{
Vector res(3 * m_numEmbeddedPoints);
Vector c2(3), c3(3);
Vector bDisp(12);
Matrix Hb(3, 12);
Vector ptDisp(3);
// update local coordinate system
for (int ii = 0; ii < 3; ii++)
{
c2(ii) = mQc(ii, 1);
c3(ii) = mQc(ii, 2);
}