int BeamEndContact3D::getResponse(int responseID, Information &eleInfo) { // initialize variables Vector slaveForce(3); Vector masterForce(6); if (responseID == 1) { // forces on slave node slaveForce(0) = -mInternalForces(6); slaveForce(1) = -mInternalForces(7); slaveForce(2) = -mInternalForces(8); return eleInfo.setVector(slaveForce); } else if (responseID == 2) { // reactions (forces and moments) on master node for (int i = 0; i < 3; i++) { masterForce(i) = -mInternalForces(i); masterForce(i+3) = -mInternalForces(i+3); } return eleInfo.setVector(masterForce); } else { // otherwise response quantity is unknown for the BeamEndContact3D class opserr << "BeamEndContact3D::getResponse(int responseID = " << responseID << ", Information &eleInfo); " << " unknown request" << endln; return -1; } }
const Vector & BeamContact2D::getResistingForce() // this function computes the resisting force vector for the element { mInternalForces.Zero(); // get contact "stress" vector Vector stress = theMaterial->getStress(); if (inContact) { for (int i = 0; i < BC2D_NUM_DOF - 2; i++) { mInternalForces(i) = -mLambda*mBn(i) + stress(1)*mBs(i); } mInternalForces(BC2D_NUM_DOF - 2) = -mGap; } else { mInternalForces(BC2D_NUM_DOF - 2) = mLambda; } return mInternalForces; }
const Vector & SSPquad::getResistingForce(void) // this function computes the resisting force vector for the element { // get stress from the material mStress = theMaterial->getStress(); // get trial displacement const Vector &mDisp_1 = theNodes[0]->getTrialDisp(); const Vector &mDisp_2 = theNodes[1]->getTrialDisp(); const Vector &mDisp_3 = theNodes[2]->getTrialDisp(); const Vector &mDisp_4 = theNodes[3]->getTrialDisp(); Vector d(8); d(0) = mDisp_1(0); d(1) = mDisp_1(1); d(2) = mDisp_2(0); d(3) = mDisp_2(1); d(4) = mDisp_3(0); d(5) = mDisp_3(1); d(6) = mDisp_4(0); d(7) = mDisp_4(1); // add stabilization force to internal force vector mInternalForces = Kstab*d; // add internal force from the stress -> fint = Kstab*d + 4*t*Jo*Mmem'*stress mInternalForces.addMatrixTransposeVector(1.0, Mmem, mStress, 4.0*mThickness*J0); // subtract body forces from internal force vector double xi[4]; double eta[4]; xi[0] = -1.0; xi[1] = 1.0; xi[2] = 1.0; xi[3] = -1.0; eta[0] = -1.0; eta[1] = -1.0; eta[2] = 1.0; eta[3] = 1.0; if (applyLoad == 0) { for (int i = 0; i < 4; i++) { mInternalForces(2*i) -= b[0]*mThickness*(J0 + J1*xi[i] + J2*eta[i]); mInternalForces(2*i+1) -= b[1]*mThickness*(J0 + J1*xi[i] + J2*eta[i]); } } else { for (int i = 0; i < 4; i++) { mInternalForces(2*i) -= appliedB[0]*mThickness*(J0 + J1*xi[i] + J2*eta[i]); mInternalForces(2*i+1) -= appliedB[1]*mThickness*(J0 + J1*xi[i] + J2*eta[i]); } } // inertial unbalance load mInternalForces.addVector(1.0, Q, -1.0); return mInternalForces; }
int BeamContact2Dp::getResponse(int responseID, Information &eleInfo) { // initialize variables Vector force(2); Vector frictForce(2); Vector slaveForce(2); Vector masterForce(6); // get contact "stress" vector Vector stress = theMaterial->getStress(); if (responseID == 1) { // forces on slave node slaveForce(0) = -mInternalForces(6); slaveForce(1) = -mInternalForces(7); return eleInfo.setVector(slaveForce); } else if (responseID == 2) { // frictional force vector frictForce = stress(1)*mg_xi; return eleInfo.setVector(frictForce); } else if (responseID == 3) { // scalar contact forces force(0) = stress(0); force(1) = stress(1); return eleInfo.setVector(force); } else if (responseID == 4) { // reactions (forces and moments) on master nodes for (int i = 0; i < 3; i++) { masterForce(i) = -mInternalForces(i); masterForce(i+3) = -mInternalForces(i+3); } return eleInfo.setVector(masterForce); } else { // otherwise response quantity is unknown for the BeamContact2Dp class opserr << "BeamContact2Dp::getResponse(int responseID = " << responseID << ", Information &eleInfo); " << " unknown request" << endln; return -1; } }
const Vector & BeamEndContact3Dp::getResistingForce() // this function computes the resisting force vector for the element { mInternalForces.Zero(); if (inContact) { for (int i = 0; i < 3; i++) { mInternalForces(i) = -mLambda*mNormal(i); mInternalForces(i+6) = mLambda*mNormal(i); } } return mInternalForces; }
const Vector & SSPquad::getResistingForceIncInertia() { // get mass density from the material double density = theMaterial->getRho(); // if density is zero only add damping terms if (density == 0.0) { this->getResistingForce(); // add the damping forces if rayleigh damping if (betaK != 0.0 || betaK0 != 0.0 || betaKc != 0.0) { mInternalForces += this->getRayleighDampingForces(); } return mInternalForces; } const Vector &accel1 = theNodes[0]->getTrialAccel(); const Vector &accel2 = theNodes[1]->getTrialAccel(); const Vector &accel3 = theNodes[2]->getTrialAccel(); const Vector &accel4 = theNodes[3]->getTrialAccel(); static double a[8]; a[0] = accel1(0); a[1] = accel1(1); a[2] = accel2(0); a[3] = accel2(1); a[4] = accel3(0); a[5] = accel3(1); a[6] = accel4(0); a[7] = accel4(1); // compute current resisting force this->getResistingForce(); // compute mass matrix this->getMass(); for (int i = 0; i < 8; i++) { mInternalForces(i) += mMass(i,i)*a[i]; } // add the damping forces if rayleigh damping if (alphaM != 0 || betaK != 0.0 || betaK0 != 0.0 || betaKc != 0.0) { mInternalForces += this->getRayleighDampingForces(); } return mInternalForces; }
int PileToe3D::getResponse(int responseID, Information &eleInfo) { Vector mReactions(6); if (responseID == 1) { // full reactions on master nodes for (int ii=0; ii<6; ii++) { mReactions(ii) = -mInternalForces(ii); } return eleInfo.setVector(mReactions); } else opserr << "PileToe3D::getResponse(int responseID=" << responseID << ", Information &eleInfo): " << " unknown request" << endln; return -1; }
const Vector & SSPquadUP::getResistingForce(void) // this function computes the resisting force vector for the element { Vector f1(8); Vector f2(4); Vector mStress(3); // get stress from the material mStress = theMaterial->getStress(); // get trial displacement const Vector &mDisp_1 = theNodes[0]->getTrialDisp(); const Vector &mDisp_2 = theNodes[1]->getTrialDisp(); const Vector &mDisp_3 = theNodes[2]->getTrialDisp(); const Vector &mDisp_4 = theNodes[3]->getTrialDisp(); Vector d(8); d(0) = mDisp_1(0); d(1) = mDisp_1(1); d(2) = mDisp_2(0); d(3) = mDisp_2(1); d(4) = mDisp_3(0); d(5) = mDisp_3(1); d(6) = mDisp_4(0); d(7) = mDisp_4(1); // add stabilization force to internal force vector f1 = Kstab*d; // add internal force from the stress f1.addMatrixTransposeVector(1.0, Mmem, mStress, 4.0*mThickness*J0); // get mass density from the material double density = theMaterial->getRho(); // subtract body forces from internal force vector double xi[4]; double eta[4]; xi[0] = -1.0; xi[1] = 1.0; xi[2] = 1.0; xi[3] = -1.0; eta[0] = -1.0; eta[1] = -1.0; eta[2] = 1.0; eta[3] = 1.0; if (applyLoad == 0) { for (int i = 0; i < 4; i++) { f1(2*i) -= density*b[0]*mThickness*(J0 + J1*xi[i] + J2*eta[i]); f1(2*i+1) -= density*b[1]*mThickness*(J0 + J1*xi[i] + J2*eta[i]); } } else { for (int i = 0; i < 4; i++) { f1(2*i) -= density*appliedB[0]*mThickness*(J0 + J1*xi[i] + J2*eta[i]); f1(2*i+1) -= density*appliedB[1]*mThickness*(J0 + J1*xi[i] + J2*eta[i]); } } // account for fluid body forces Matrix k(2,2); Vector body(2); // permeability tensor k(0,0) = perm[0]; k(1,1) = perm[1]; // body force vector if (applyLoad == 0) { body(0) = b[0]; body(1) = b[1]; } else { body(0) = appliedB[0]; body(1) = appliedB[1]; } f2 = 4.0*J0*mThickness*fDens*dN*k*body; // assemble full internal force vector for the element mInternalForces(0) = f1(0); mInternalForces(1) = f1(1); mInternalForces(2) = f2(0); mInternalForces(3) = f1(2); mInternalForces(4) = f1(3); mInternalForces(5) = f2(1); mInternalForces(6) = f1(4); mInternalForces(7) = f1(5); mInternalForces(8) = f2(2); mInternalForces(9) = f1(6); mInternalForces(10) = f1(7); mInternalForces(11) = f2(3); // inertial unbalance load mInternalForces.addVector(1.0, Q, -1.0); return mInternalForces; }