Dear Community Members,
I am trying to build a 4 nodes joint model, based on BeamColumnJoint2D element.
After creating and loading a frame using the joint created, it looks like the 4 nodes are not connected.
I thought the error comes from setDomain() function but it's not.
Does anyone of you have an idea where my bug could be?
Thank you in advance:
photo: before loading https://www.dropbox.com/s/j4ira0ct6m0ul ... oading.PNG
photo: after loading https://www.dropbox.com/s/z87jywsb71kf7 ... oading.PNG
new Joint element
Moderators: silvia, selimgunay, Moderators
Re: new Joint element
This is the setDomain() method.
The 4 nodes are identified, but somehow the element is created only with 2 node. Any ideas?
void
SPPlastic::setDomain(Domain *theDomain)
{
if (theDomain == 0)
{
opserr << "ERROR : SPPlastic::setDomain -- Domain is null" << endln;
return;
}
// first ensure nodes exist in Domain and set the node pointers
Node *end1Ptr, *end2Ptr, *end3Ptr, *end4Ptr;
int Nd1 = connectedExternalNodes(0);
int Nd2 = connectedExternalNodes(1);
int Nd3 = connectedExternalNodes(2);
int Nd4 = connectedExternalNodes(3);
opserr << "Nd1" << Nd1 << endln;
opserr << "Nd2" << Nd2 << endln;
opserr << "Nd3" << Nd3 << endln;
opserr << "Nd4" << Nd4 << endln;
end1Ptr = theDomain->getNode(Nd1);
end2Ptr = theDomain->getNode(Nd2);
end3Ptr = theDomain->getNode(Nd3);
end4Ptr = theDomain->getNode(Nd4);
if (end1Ptr == 0) {
opserr << "WARNING DoublePanel::setDomain() - at DoublePanel " << this->getTag() << " node " << Nd1 << " does not exist in domain\n";
return; // don't go any further - otherwise segmentation fault
}
if (end2Ptr == 0) {
opserr << "WARNING DoublePanel::setDomain() - at DoublePanel " << this->getTag() << " node " << Nd2 << " does not exist in domain\n";
return; // don't go any further - otherwise segmentation fault
}
if (end3Ptr == 0) {
opserr << "WARNING DoublePanel::setDomain() - at DoublePanel " << this->getTag() << " node " << Nd3 << " does not exist in domain\n";
return; // don't go any further - otherwise segmentation fault
}
if (end4Ptr == 0) {
opserr << "WARNING DoublePanel::setDomain() - at DoublePanel " << this->getTag() << " node " << Nd4 << " does not exist in domain\n";
return; // don't go any further - otherwise segmentation fault
}
nodePtr[0] = end1Ptr;
nodePtr[1] = end2Ptr;
nodePtr[2] = end3Ptr;
nodePtr[3] = end4Ptr;
// call the base class method (DomainComponent class method) THIS IS VERY IMPORTANT
this->DomainComponent::setDomain(theDomain);
// ensure connected nodes have correct number of dof's
int dofNd1 = nodePtr[0]->getNumberDOF();
int dofNd2 = nodePtr[1]->getNumberDOF();
int dofNd3 = nodePtr[2]->getNumberDOF();
int dofNd4 = nodePtr[3]->getNumberDOF();
if ((dofNd1 != 3) || (dofNd2 != 3) || (dofNd3 != 3) || (dofNd4 != 3))
{
opserr << "ERROR : SPPlastic::setDomain -- number of DOF associated with the node incorrect"<< endln;
exit(-1); // donot go any further - otherwise segmentation fault
}
// now determine the area
const Vector &end1Crd = nodePtr[0]->getCrds();
const Vector &end2Crd = nodePtr[1]->getCrds();
const Vector &end3Crd = nodePtr[2]->getCrds();
const Vector &end4Crd = nodePtr[3]->getCrds();
Vector Node1(end1Crd);
Vector Node2(end2Crd);
Vector Node3(end3Crd);
Vector Node4(end4Crd);
// set the height and width of the element and perform check
Node2 = Node2 - Node4;
Node3 = Node3 - Node1;
dc = fabs(Node2.Norm());
db = fabs(Node3.Norm());
opserr << "dc: " << dc << endln;
opserr << "db: " << db << endln;
Aweb = (sqrt(db*db))*(sqrt(dc*dc));
Alpha = atan(fabs(Node3.Norm()) / fabs(Node2.Norm()));
opserr << "Aweb: " << Aweb << endln;
opserr << "Alpha: " << Alpha << endln;
if ((db <= 1e-12) || (dc <= 1e-12))
{
opserr << "ERROR : SPPlastic::setDomain -- length or width not correct, division by zero occurs"<< endln;
exit(-1); // donot go any further - otherwise segmentation fault
}
getBCJoint();
getdg_df();
getdDef_du();
}
The 4 nodes are identified, but somehow the element is created only with 2 node. Any ideas?
void
SPPlastic::setDomain(Domain *theDomain)
{
if (theDomain == 0)
{
opserr << "ERROR : SPPlastic::setDomain -- Domain is null" << endln;
return;
}
// first ensure nodes exist in Domain and set the node pointers
Node *end1Ptr, *end2Ptr, *end3Ptr, *end4Ptr;
int Nd1 = connectedExternalNodes(0);
int Nd2 = connectedExternalNodes(1);
int Nd3 = connectedExternalNodes(2);
int Nd4 = connectedExternalNodes(3);
opserr << "Nd1" << Nd1 << endln;
opserr << "Nd2" << Nd2 << endln;
opserr << "Nd3" << Nd3 << endln;
opserr << "Nd4" << Nd4 << endln;
end1Ptr = theDomain->getNode(Nd1);
end2Ptr = theDomain->getNode(Nd2);
end3Ptr = theDomain->getNode(Nd3);
end4Ptr = theDomain->getNode(Nd4);
if (end1Ptr == 0) {
opserr << "WARNING DoublePanel::setDomain() - at DoublePanel " << this->getTag() << " node " << Nd1 << " does not exist in domain\n";
return; // don't go any further - otherwise segmentation fault
}
if (end2Ptr == 0) {
opserr << "WARNING DoublePanel::setDomain() - at DoublePanel " << this->getTag() << " node " << Nd2 << " does not exist in domain\n";
return; // don't go any further - otherwise segmentation fault
}
if (end3Ptr == 0) {
opserr << "WARNING DoublePanel::setDomain() - at DoublePanel " << this->getTag() << " node " << Nd3 << " does not exist in domain\n";
return; // don't go any further - otherwise segmentation fault
}
if (end4Ptr == 0) {
opserr << "WARNING DoublePanel::setDomain() - at DoublePanel " << this->getTag() << " node " << Nd4 << " does not exist in domain\n";
return; // don't go any further - otherwise segmentation fault
}
nodePtr[0] = end1Ptr;
nodePtr[1] = end2Ptr;
nodePtr[2] = end3Ptr;
nodePtr[3] = end4Ptr;
// call the base class method (DomainComponent class method) THIS IS VERY IMPORTANT
this->DomainComponent::setDomain(theDomain);
// ensure connected nodes have correct number of dof's
int dofNd1 = nodePtr[0]->getNumberDOF();
int dofNd2 = nodePtr[1]->getNumberDOF();
int dofNd3 = nodePtr[2]->getNumberDOF();
int dofNd4 = nodePtr[3]->getNumberDOF();
if ((dofNd1 != 3) || (dofNd2 != 3) || (dofNd3 != 3) || (dofNd4 != 3))
{
opserr << "ERROR : SPPlastic::setDomain -- number of DOF associated with the node incorrect"<< endln;
exit(-1); // donot go any further - otherwise segmentation fault
}
// now determine the area
const Vector &end1Crd = nodePtr[0]->getCrds();
const Vector &end2Crd = nodePtr[1]->getCrds();
const Vector &end3Crd = nodePtr[2]->getCrds();
const Vector &end4Crd = nodePtr[3]->getCrds();
Vector Node1(end1Crd);
Vector Node2(end2Crd);
Vector Node3(end3Crd);
Vector Node4(end4Crd);
// set the height and width of the element and perform check
Node2 = Node2 - Node4;
Node3 = Node3 - Node1;
dc = fabs(Node2.Norm());
db = fabs(Node3.Norm());
opserr << "dc: " << dc << endln;
opserr << "db: " << db << endln;
Aweb = (sqrt(db*db))*(sqrt(dc*dc));
Alpha = atan(fabs(Node3.Norm()) / fabs(Node2.Norm()));
opserr << "Aweb: " << Aweb << endln;
opserr << "Alpha: " << Alpha << endln;
if ((db <= 1e-12) || (dc <= 1e-12))
{
opserr << "ERROR : SPPlastic::setDomain -- length or width not correct, division by zero occurs"<< endln;
exit(-1); // donot go any further - otherwise segmentation fault
}
getBCJoint();
getdg_df();
getdDef_du();
}