const XC::Matrix &XC::MFreedom_Joint2D::getConstraint(void) const { if(constraintMatrix.isEmpty()) { std::cerr << getClassName() << "::" << __FUNCTION__ << "; no matrix was set\n"; exit(-1); } // Length correction // to correct the trial displacement if(LargeDisplacement == 2 ) { // get the coordinates of the two nodes - check dimensions are the same FOR THE MOMENT const Vector &crdR = RetainedNode->getCrds(); const Vector &crdC = ConstrainedNode->getCrds(); // get committed displacements of nodes to get updated coordinates const Vector &dispR = RetainedNode->getTrialDisp(); const Vector &dispC = ConstrainedNode->getTrialDisp(); double deltaX = dispC(0) + crdC(0) - dispR(0) - crdR(0); double deltaY = dispC(1) + crdC(1) - dispR(1) - crdR(1); Vector Direction(2); Direction(0) = deltaX; Direction(1) = deltaY; double NewLength = Direction.Norm(); if(NewLength < 1e-12) std::cerr << "XC::MFreedom_Joint2D::applyConstraint : length of rigid link is too small or zero"; Direction = Direction * (Length0/NewLength); // correct the length // find new displacements of the constrainted node Vector NewLocation(3); NewLocation(0) = Direction(0) + dispR(0) + crdR(0) - crdC(0); NewLocation(1) = Direction(1) + dispR(1) + crdR(1) - crdC(1); NewLocation(2) = dispC(2); ConstrainedNode->setTrialDisp(NewLocation); } // end of length correction procedure // return the constraint matrix Ccr return constraintMatrix; }
const Matrix &MP_Joint2D::getConstraint(void) { if (constraint == 0) { opserr << "MP_Joint2D::getConstraint - no Matrix was set\n"; exit(-1); } // Length correction // to correct the trial displacement if ( LargeDisplacement == 2 ) { // get the coordinates of the two nodes - check dimensions are the same FOR THE MOMENT const Vector &crdR = RetainedNode->getCrds(); const Vector &crdC = ConstrainedNode->getCrds(); // get commited displacements of nodes to get updated coordinates const Vector &dispR = RetainedNode->getTrialDisp(); const Vector &dispC = ConstrainedNode->getTrialDisp(); double deltaX = dispC(0) + crdC(0) - dispR(0) - crdR(0); double deltaY = dispC(1) + crdC(1) - dispR(1) - crdR(1); Vector Direction(2); Direction(0) = deltaX; Direction(1) = deltaY; double NewLength = Direction.Norm(); if ( NewLength < 1e-12 ) opserr << "MP_Joint2D::applyConstraint : length of rigid link is too small or zero"; Direction = Direction * (Length0/NewLength); // correct the length // find new displacements of the constrainted node Vector NewLocation(3); NewLocation(0) = Direction(0) + dispR(0) + crdR(0) - crdC(0); NewLocation(1) = Direction(1) + dispR(1) + crdR(1) - crdC(1); NewLocation(2) = dispC(2); int dummy = ConstrainedNode->setTrialDisp( NewLocation ); } // end of length correction procedure // return the constraint matrix Ccr return (*constraint); }
int MP_Joint2D::applyConstraint(double timeStamp) { if ( LargeDisplacement != 0 ) { // calculate the constraint at this moment // get the coordinates of the two nodes - check dimensions are the same FOR THE MOMENT const Vector &crdR = RetainedNode->getCrds(); const Vector &crdC = ConstrainedNode->getCrds(); // get commited displacements of nodes to get updated coordinates const Vector &dispR = RetainedNode->getDisp(); const Vector &dispC = ConstrainedNode->getDisp(); double deltaX = dispC(0) + crdC(0) - dispR(0) - crdR(0); double deltaY = dispC(1) + crdC(1) - dispR(1) - crdR(1); constraint->Zero(); if ( FixedEnd == 0 ) { // the end is released (*constraint) (0,0) = 1.0 ; (*constraint) (0,2) = -deltaY ; (*constraint) (1,1) = 1.0 ; (*constraint) (1,2) = deltaX ; } else { // the end is fixed (*constraint) (0,0) = 1.0 ; (*constraint) (0,MainDOF) = -deltaY ; (*constraint) (1,1) = 1.0 ; (*constraint) (1,MainDOF) = deltaX ; (*constraint) (2,AuxDOF) = 1.0 ; } } return 0; }