void BeamEndContact3D::setDomain(Domain *theDomain) { double r; Vector a1(BEC3_NUM_DIM); mEye1.Zero(); mEye1(0,0) = 1.0; mEye1(1,1) = 1.0; mEye1(2,2) = 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_s = theNodes[1]->getCrds(); mDcrd_a = mIcrd_a; mDcrd_s = mIcrd_s; x_b = theDomain->getNode(mBeamNode); mIcrd_b = x_b->getCrds(); // initialize the normal vector mIniNormal = -1*(mIcrd_b - mIcrd_a)/(mIcrd_b - mIcrd_a).Norm(); mNormal = mIniNormal; // determine initial gap mGap = (mDcrd_s - mDcrd_a)^mIniNormal; // determine initial projection mx_p = mDcrd_s - (mGap*mIniNormal); // initialize contact state based on projection r = (mx_p - mIcrd_a).Norm(); in_bounds = (r <= mRadius); inContact = (was_inContact && in_bounds); // call the base class method this->DomainComponent::setDomain(theDomain); }
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); }