-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmbeddedBeamToe.cpp
More file actions
971 lines (791 loc) · 27.7 KB
/
EmbeddedBeamToe.cpp
File metadata and controls
971 lines (791 loc) · 27.7 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
/* ****************************************************************** **
** 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 EmbeddedBeamToe.
#include <EmbeddedBeamToe.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_EmbeddedBeamToe = 0;
static const double m_Pi = 3.14159265359;
void *
OPS_EmbeddedBeamToe(void)
{
// TODO: The OPS_EmbedBeam() needs to be completed
if (num_EmbeddedBeamToe == 0) {
num_EmbeddedBeamToe++;
opserr << "EmbeddedBeamToe element - Written: A.Ghofrani, D.Turello, P.Arduino, U.Washington\n";
}
Element *theElement = 0;
int numArgs = OPS_GetNumRemainingInputArgs();
if (numArgs < 1) {
opserr << "Want: EmbeddedBeamToe 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 EmbeddedBeamToe" << endln;
return 0;
}
eleTag = iData[0];
theElement = new EmbeddedBeamToe(iData[0]);
if (theElement == 0) {
opserr << "WARNING could not create element of type EmbeddedBeamToe\n";
return 0;
}
return theElement;
}
EmbeddedBeamToe::EmbeddedBeamToe(int tag) : Element(tag, ELE_TAG_EmbeddedBeamToe)
{
}
EmbeddedBeamToe::EmbeddedBeamToe(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, std::vector <double> radius, double beam_radius, double area) : Element(tag, ELE_TAG_EmbeddedBeamToe),
m_beam_radius(beam_radius), m_area(area), theBeamTag(beamTag),
m_Ba_rot_n(3), m_Bb_rot_n(3),
mQa(3, 3), mQb(3, 3), mQc(3, 3), mc1(3),
mBphi(3, 6), mBu(3, 6), mHf(3, 6), m_Ns(8)
{
// get domain to have access to element tags and their nodes (this cannot be done in setDomain because number of nodes and dof's need to be known.)
#ifdef _PARALLEL_PROCESSING
#include <PartitionedDomain.h>
extern PartitionedDomain theDomain;
#else
extern Domain theDomain;
#endif
// initialize information for solids in contact
std::set <int> uniqueNodeTags;
m_numEmbeddedPoints = solidTag.size();
theSolidTag = new int[m_numEmbeddedPoints];
solidNodeTags = new int[8 * m_numEmbeddedPoints];
m_beam_rho = m_beam_r = m_beam_theta = m_solid_xi = m_solid_eta = m_solid_zeta = Vector(m_numEmbeddedPoints);
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];
m_beam_r(ii) = radius[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();
}
}
// update the number of connected nodes and number of dof's and update the connectivity information
m_numSolidNodes = (int)uniqueNodeTags.size();
EBT_numNodes = m_numSolidNodes;
EBT_numDOF = m_numSolidNodes * 3;
externalNodes = ID(EBT_numNodes);
theNodes = new Node*[EBT_numNodes];
int count = 0;
for (std::set <int>::iterator it = uniqueNodeTags.begin(); it != uniqueNodeTags.end(); ++it)
{
m_nodeMap[*it] = count;
externalNodes(count) = *it;
count++;
}
// get the beam element from the domain to get its nodes
theBeam = theDomain.getElement(beamTag);
// get the sp-constraints to apply the displacement to the beam nodes
theConstraints = new SP_Constraint*[6];
// get memory for internal variables
m_InterfaceForces = Vector(EBT_numDOF);
m_InterfaceStiffness = Matrix(EBT_numDOF, EBT_numDOF);
mA = Matrix(3*m_numSolidNodes, 6);
mB = Matrix(6, 6);
mB_inv = Matrix(6, 6);
mKbb = Matrix(6, 6);
// get the coordinate transformation object
crdTransf = OPS_GetCrdTransf(crdTransfTag)->getCopy3d();
}
EmbeddedBeamToe::EmbeddedBeamToe()
: Element(0, ELE_TAG_EmbeddedBeamToe)
{
}
EmbeddedBeamToe::~EmbeddedBeamToe()
{
// TODO: There are some dybnamically allocated objects that need to be removed
}
int
EmbeddedBeamToe::getNumExternalNodes(void) const
{
return EBT_numNodes;
}
const ID&
EmbeddedBeamToe::getExternalNodes(void)
{
return externalNodes;
}
Node **
EmbeddedBeamToe::getNodePtrs(void)
{
return theNodes;
}
int
EmbeddedBeamToe::getNumDOF(void)
{
return EBT_numDOF;
}
int
EmbeddedBeamToe::revertToLastCommit(void)
{
// TODO: Check if something needs to be done
return 0;
}
int
EmbeddedBeamToe::revertToStart(void)
{
// TODO: Check if something needs to be done
return 0;
}
const Matrix&
EmbeddedBeamToe::getTangentStiff(void)
{
return m_InterfaceStiffness;
}
const Matrix&
EmbeddedBeamToe::getInitialStiff(void)
{
return this->getTangentStiff();
}
const Vector&
EmbeddedBeamToe::getResistingForce(void)
{
m_InterfaceForces.Zero();
Vector sDisp(3 * m_numSolidNodes);
Vector bForces(6);
// get the solid node displacements
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);
}
// get the beam external forces
for (int ii = 0; ii < 6; ii++)
bForces(ii) = theBeam->getResistingForce()(ii);
m_InterfaceForces = (m_InterfaceStiffness * sDisp) - (mA * mB_inv * bForces);
return m_InterfaceForces;
}
int
EmbeddedBeamToe::sendSelf(int commitTag, Channel &theChannel)
{
// TODO: needs to be completed
return 0;
}
int
EmbeddedBeamToe::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker
&thEBTroker)
{
// TODO: needs to be completed
return 0;
}
int
EmbeddedBeamToe::displaySelf(Renderer &theViewer, int displayMode, float fact, const char **modes, int numMode)
{
return 0;
}
void
EmbeddedBeamToe::Print(OPS_Stream &s, int flag)
{
// TODO: needs to be completed
return;
}
Response*
EmbeddedBeamToe::setResponse(const char **argv, int argc,
OPS_Stream &s)
{
// TODO: needs to be updated
if (strcmp(argv[0], "locationBeam") == 0 || strcmp(argv[0], "locBeam") == 0) {
return new ElementResponse(this, 1, Vector(3));
}
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));
}
else if (strcmp(argv[0], "c1") == 0 || strcmp(argv[0], "tangent") == 0) {
return new ElementResponse(this, 4, Vector(3));
}
else if (strcmp(argv[0], "c2") == 0 || strcmp(argv[0], "perp2") == 0) {
return new ElementResponse(this, 5, Vector(3));
}
else if (strcmp(argv[0], "c3") == 0 || strcmp(argv[0], "perp3") == 0) {
return new ElementResponse(this, 6, Vector(3));
}
else if (strcmp(argv[0], "force") == 0 || strcmp(argv[0], "globalForce") == 0) {
return new ElementResponse(this, 7, Vector(3));
}
else {
opserr << "EmbeddedBeamToe Recorder, " << argv[0] << "is an unknown recorder request"
<< " Element tag : " << this->getTag() << endln;
return 0;
}
}
int
EmbeddedBeamToe::getResponse(int responseID, Information &eleInformation)
{
// TODO: needs to be updated
if (responseID == 1) { // location
return eleInformation.setVector(Vector(3));
}
else if (responseID == 2) { // location
return eleInformation.setVector(GetInteractionPtDisp());
}
else if (responseID == 3) { // centerline
return eleInformation.setVector(Vector(3));
}
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 if (responseID == 7) { // contact force
Vector temp(3);
return eleInformation.setVector(temp);
}
else {
opserr << "EmbeddedBeamToe, tag = " << this->getTag()
<< " -- unknown request" << endln;
return -1;
}
}
int
EmbeddedBeamToe::setParameter(const char **argv, int argc, Parameter ¶m)
{
return 0;
}
int
EmbeddedBeamToe::updateParameter(int parameterID, Information &info)
{
return 0;
}
void
EmbeddedBeamToe::setDomain(Domain *theDomain)
{
// get pointers to the element nodes
for (int ii = 0; ii < m_numSolidNodes; ii++)
{
theNodes[ii] = theDomain->getNode(externalNodes(ii));
if (theNodes[ii] == 0)
{
opserr << "Could not find node " << externalNodes(ii) << "." << endln;
return;
}
}
// set the sp constraints
for (int ii = 0; ii < 1; ii++)
for (int jj = 0; jj < 6; jj++)
{
// check if an existing SP_COostraint exists for that dof at the node
bool found = false;
SP_ConstraintIter &theExistingSPs = theDomain->getSPs();
SP_Constraint *theExistingSP = 0;
while ((found == false) && ((theExistingSP = theExistingSPs()) != 0))
{
int spNodeTag = theExistingSP->getNodeTag();
int dof = theExistingSP->getDOF_Number();
if (theBeam->getNodePtrs()[ii]->getTag() == spNodeTag && jj == dof)
{
// set the constraint pointer
found = true;
theConstraints[ii * 6 + jj] = theExistingSP;
}
}
if (!found)
{
// create a new sp constraint and add it to the domain
theConstraints[ii * 6 + jj] = new SP_Constraint(theBeam->getNodePtrs()[ii]->getTag(), jj, 1.0, false);
theDomain->addSP_Constraint(theConstraints[ii * 6 + jj]);
}
}
// initialize the transformation
if (crdTransf->initialize(theBeam->getNodePtrs()[0], theBeam->getNodePtrs()[1]))
{
opserr << "EmbeddedBeamToe::setDomain(): Error initializing coordinate transformation";
return;
}
// check if the beam has zero length
m_beam_length = crdTransf->getInitialLength();
if (m_beam_length < 1.0e-12) {
opserr << "FATAL ERROR EmbeddedBeamToe (tag: " << this->getTag() << ") : "
<< "Beam element has zero length." << endln;
return;
}
// update local coordinate systems
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;
Vector c1(3), c2(3), c3(3);
// update local coordinate system
for (int ii = 0; ii < 3; ii++)
{
c1(ii) = mQc(ii, 0);
c2(ii) = mQc(ii, 1);
c3(ii) = mQc(ii, 2);
}
Setc1(c1);
// calculate A and B
mA.Zero();
mB.Zero();
for (int ii = 0; ii < m_numEmbeddedPoints; ii++)
{
// update the interpolation functions for displacements and interaction forces
updateShapeFuncs(m_solid_xi(ii), m_solid_eta(ii), m_solid_zeta(ii), m_beam_rho(ii));
mHf.Zero();
ComputeHf(mHf, m_beam_r(ii), m_beam_theta(ii));
Element * theElement = theDomain->getElement(theSolidTag[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 < 6; 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);
}
}
// update the matrices that define kinematics of the points on the beam surface
Matrix Hb(3, 6);
ComputeBphiAndBu(mBphi, mBu);
Hb = mBu - (m_beam_r(ii)*(cos(m_beam_theta(ii))*ComputeSkew(c2) + sin(m_beam_theta(ii))*ComputeSkew(c3))) * mBphi;
Matrix HbT = Transpose(3, 6, Hb);
mB += HbT * mHf;
}
// update B inverse
mB.Invert(mB_inv);
// get the beam tangent matrix
for (int ii = 0; ii < 6; ii++)
for (int jj = 0; jj < 6; jj++)
mKbb(ii,jj) = theBeam->getTangentStiff()(ii,jj);
m_InterfaceStiffness.Zero();
Matrix ABinv = mA * mB_inv;
Matrix ABinvT(6, 3 * m_numSolidNodes);
ABinvT = Transpose(3 * m_numSolidNodes, 6, ABinv);
// update the element tangent stiffness matrix
m_InterfaceStiffness = ABinv * mKbb * ABinvT;
this->DomainComponent::setDomain(theDomain);
return;
}
int
EmbeddedBeamToe::update(void)
{
// TODO: the coordinate systems and kinematics need to be updated for larger deformations
return 0;
}
int
EmbeddedBeamToe::commitState(void)
{
int retVal = 0;
// use the sp constraints to push the beam displacements to the beam nodes
extern ConstraintHandler *theHandler; // need to get access to the constraint handler
// calculate beam displacements
Vector bDisp(6);
Vector sDisp(3 * m_numSolidNodes);
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);
}
Matrix ABinv = mA * mB_inv;
Matrix ABinvT(6, 3 * m_numSolidNodes);
ABinvT = Transpose(3 * m_numSolidNodes, 6, ABinv);
bDisp = ABinvT * sDisp;
// update the sp constraints
for (int ii = 0; ii < 6; ii++)
theConstraints[ii]->applyConstraint(bDisp(ii));
// need to let the constraint handler know about the update
if (!(theHandler == NULL))
theHandler->applyLoad();
// call element commitState to do any base class stuff
if ((retVal = this->Element::commitState()) != 0) {
opserr << "EmbeddedBeamToe::commitState() - failed in base class";
}
return retVal;
}
int EmbeddedBeamToe::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
EmbeddedBeamToe::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
EmbeddedBeamToe::Geta1(void)
{
Vector a1(3);
int i;
for (i = 0; i<3; i++) {
a1(i) = mQa(i, 0);
}
return a1;
}
Vector
EmbeddedBeamToe::Getb1(void)
{
Vector b1(3);
int i;
for (i = 0; i<3; i++) {
b1(i) = mQb(i, 0);
}
return b1;
}
void
EmbeddedBeamToe::Setc1(Vector c1_vec)
{
mc1 = c1_vec;
return;
}
Vector
EmbeddedBeamToe::Getc1(void) {
return mc1;
}
Vector EmbeddedBeamToe::GetInteractionPtDisp()
{
Vector res(3 * m_numEmbeddedPoints);
Vector c2(3), c3(3);
Vector bDisp(6);
Matrix Hb(3, 6);
Vector ptDisp(3);
// update local coordinate system
for (int ii = 0; ii < 3; ii++)
{
c2(ii) = mQc(ii, 1);
c3(ii) = mQc(ii, 2);
}
for (int ii = 0; ii < 6; ii++)
bDisp(ii) = theBeam->getNodePtrs()[0]->getTrialDisp()(ii);
for (int ii = 0; ii < m_numEmbeddedPoints; ii++)
{
// update the interpolation functions for displacements and interaction forces
updateShapeFuncs(m_solid_xi(ii), m_solid_eta(ii), m_solid_zeta(ii), m_beam_rho(ii));
// update the matrices that define kinematics of the points on the beam surface
ComputeBphiAndBu(mBphi, mBu);
Hb = mBu - (m_beam_r(ii)*(cos(m_beam_theta(ii))*ComputeSkew(c2) + sin(m_beam_theta(ii))*ComputeSkew(c3))) * mBphi;
ptDisp = Hb * bDisp;
for (int jj = 0; jj < 3; jj++)
res(3 * ii + jj) = ptDisp(jj);
}
return res;
}
Vector EmbeddedBeamToe::GetInteractionPtForce()
{
Vector res(3 * m_numEmbeddedPoints);
Vector c2(3), c3(3);
Vector bDisp(6);
Matrix Hb(3, 6);
Vector ptDisp(3);
// update local coordinate system
for (int ii = 0; ii < 3; ii++)
{
c2(ii) = mQc(ii, 1);
c3(ii) = mQc(ii, 2);
}
for (int ii = 0; ii < 6; ii++)
bDisp(ii) = theBeam->getNodePtrs()[0]->getTrialDisp()(ii);
for (int ii = 0; ii < m_numEmbeddedPoints; ii++)
{
// update the interpolation functions for displacements and interaction forces
updateShapeFuncs(m_solid_xi(ii), m_solid_eta(ii), m_solid_zeta(ii), m_beam_rho(ii));
// update the matrices that define kinematics of the points on the beam surface
ComputeBphiAndBu(mBphi, mBu);
Hb = mBu - (m_beam_r(ii)*(cos(m_beam_theta(ii))*ComputeSkew(c2) + sin(m_beam_theta(ii))*ComputeSkew(c3))) * mBphi;
ptDisp = Hb * bDisp;
for (int jj = 0; jj < 3; jj++)
res(3 * ii + jj) = ptDisp(jj);
}
return res;
}
Matrix
EmbeddedBeamToe::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
EmbeddedBeamToe::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
EmbeddedBeamToe::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);
return;
}
void EmbeddedBeamToe::ComputeHf(Matrix & Hf, double radius, double theta)
{
Hf.Zero();
double piR2 = m_Pi * m_beam_radius * m_beam_radius;
double oneOverPiR2 = 1.0 / piR2 * m_area;
double oneOverPiR4 = m_Pi * oneOverPiR2 / piR2;
for (int ii = 0; ii < 3; ii++)
{
for (int jj = 0; jj < 3; jj++)
Hf(ii, jj) = oneOverPiR2 * m_Nb1 * mQa(jj, ii);
Hf(0, ii + 3) = 4.0 * oneOverPiR4 * m_Nb1 * radius * (mQa(ii, 1) * sin(theta) - mQa(ii, 2) * cos(theta));
Hf(1, ii + 3) = -2.0 * oneOverPiR4 * mQa(ii, 0) * m_Nb1 * radius * sin(theta);
Hf(2, ii + 3) = 2.0 * oneOverPiR4 * mQa(ii, 0) * m_Nb1 * radius * cos(theta);
}
Hf = mQc * Hf;
return;
}
void
EmbeddedBeamToe::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
EmbeddedBeamToe::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
EmbeddedBeamToe::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;
}