int BeamContact2Dp::commitState() { // update projection mXi = Project(mXi); // update surface tangent vector, g_xi UpdateBase(mXi); // update vectors Bn and Bs for next step ComputeB(); // update contact state was_inContact = (mGap < 0.0); in_bounds = ((mXi > 0.000) && (mXi < 1.000)); inContact = (was_inContact && in_bounds); int retVal = 0; // call element commitState to do any base class stuff if ((retVal = this->Element::commitState()) != 0) { opserr << "BeamContact2Dp::commitState() - failed in base class"; } retVal = theMaterial->commitState(); return retVal; }
int BeamContact2D::revertToStart() { if (mIniContact == 0) { inContact = true; was_inContact = true; to_be_released = false; should_be_released = false; in_bounds = true; } else { inContact = false; was_inContact = false; to_be_released = false; should_be_released = false; in_bounds = true; } // reset applicable member variables mDcrd_a = mIcrd_a; mDcrd_b = mIcrd_b; mDcrd_s = mIcrd_s; mDisp_a_n.Zero(); mDisp_b_n.Zero(); mLength = (mDcrd_b - mDcrd_a).Norm(); ma_1 = (mDcrd_b - mDcrd_a)/mLength; mb_1 = ma_1; mXi = ((mDcrd_b - mDcrd_s)^(mDcrd_b - mDcrd_a))/mLength; mXi = Project(mXi); in_bounds = ((mXi > 0.000) && (mXi < 1.000)); inContact = (was_inContact && in_bounds); UpdateBase(mXi); ComputeB(); return theMaterial->revertToStart(); }
void BeamContact2Dp::setDomain(Domain *theDomain) { Vector x_c(BC2D_NUM_DIM); mEye1.Zero(); mEye1(0,0) = 1.0; mEye1(1,1) = 1.0; mEyeS.Zero(); mEyeS(0,1) = -1.0; mEyeS(1,0) = 1.0; theNodes[0] = theDomain->getNode(mExternalNodes(0)); theNodes[1] = theDomain->getNode(mExternalNodes(1)); theNodes[2] = theDomain->getNode(mExternalNodes(2)); for (int i = 0; i < 3; i++) { if (theNodes[i] == 0) return; // don't go any further - otherwise segmentation fault } // initialize coordinate vectors mIcrd_a = theNodes[0]->getCrds(); mIcrd_b = theNodes[1]->getCrds(); mIcrd_s = theNodes[2]->getCrds(); mDcrd_a = mIcrd_a; mDcrd_b = mIcrd_b; mDcrd_s = mIcrd_s; mDisp_a_n.Zero(); mDisp_b_n.Zero(); // length of beam element mLength = (mDcrd_b - mDcrd_a).Norm(); // initialize tangent vectors at beam nodes ma_1 = (mDcrd_b - mDcrd_a)/mLength; mb_1 = ma_1; // perform projection of slave node to beam centerline mXi = ((mDcrd_b - mDcrd_s)^(mDcrd_b - mDcrd_a))/mLength; // initial assumption mXi = Project(mXi); // actual location // update contact state based on projection in_bounds = ((mXi > 0.000) && (mXi < 1.000)); inContact = (was_inContact && in_bounds); // centerline projection coordinate x_c = mDcrd_a*mShape(0) + ma_1*mLength*mShape(1) + mDcrd_b*mShape(2) + mb_1*mLength*mShape(3); // update surface tangent vector, g_xi UpdateBase(mXi); // adjust cohesion force theMaterial->ScaleCohesion(mLength); theMaterial->ScaleTensileStrength(mLength); // compute vectors Bn and Bs ComputeB(); // call the base class method this->DomainComponent::setDomain(theDomain); }