int XC::DriftRecorder::record(int commitTag, double timeStamp) { if(!theDomain || !ndI || !ndJ) { return 0; } if(!theHandler) { std::cerr << "XC::DriftRecorder::record() - no DataOutputHandler has been set\n"; return -1; } if(initializationDone != true) if(this->initialize() != 0) { std::cerr << "XC::DriftRecorder::record() - failed in initialize()\n"; return -1; } if(numNodes == 0 || data.isEmpty()) return 0; int timeOffset = 0; if(echoTimeFlag == true) { data(0) = theDomain->getTimeTracker().getCurrentTime(); timeOffset = 1; } for(int i=0; i<numNodes; i++) { Node *nodeI = theNodes[2*i]; Node *nodeJ = theNodes[2*i+1]; if(oneOverL(i) != 0.0) { const Vector &dispI= nodeI->getTrialDisp(); const Vector &dispJ= nodeJ->getTrialDisp(); const double dx= dispJ(dof)-dispI(dof); data(i+timeOffset)= dx* oneOverL(i); } else data(i+timeOffset) = 0.0; } theHandler->write(data); return 0; }
int RotationShearCurve::checkElementState(double springForce) { double shearForce = fabs(springForce); getElemForces(); const Vector &dispI = theNodeI->getTrialDisp(); const Vector &dispJ = theNodeJ->getTrialDisp(); double rotDef = fabs(dispJ(rotAxis-1) - dispI(rotAxis-1)); if (stateFlag == 0) { if (Vn == 0.0) { double ShearForceLimit = findCritLimit(shearForce, M); if(shearForce >= ShearForceLimit) { stateFlag = 1; setDegSlope(shearForce); } } else if (Vn > 0.0) { if (shearForce >= Vn) { stateFlag = 1; setDegSlope(shearForce); } } if (defType == 0) { if (rotDef >= rotLim) { stateFlag = 1; setDegSlope(shearForce); } } else { double shearRotLimit = findLimit(shearForce); if ((rotDef >= shearRotLimit) && (rotDef >= thetaMin)) { stateFlag = 1; setDegSlope(shearForce); } } } else { stateFlag = 2; } return stateFlag; }
// check if limit state surface has been reached int ShearCurve::checkElementState(double springForce) { DummyStream dummy; // find associated beam-column elementon first visit if (theElement == 0) { theElement = theDomain->getElement(eleTag); if (theElement == 0) { // g3ErrorHandler->fatal("WARNING ShearCurve - no element with tag %i exists in Domain",eleTag); } // find length between nodes if drift is desired if (defType == 2) { Node *nodeI = theDomain->getNode(ndI); Node *nodeJ = theDomain->getNode(ndJ); const Vector &crdI = nodeI->getCrds(); const Vector &crdJ = nodeJ->getCrds(); if (crdI(perpDirn) == crdJ(perpDirn)) { // g3ErrorHandler->warning("%s -- Nodal projection has zero component along chosen direction", // "AxialCurve::AxialCurve"); oneOverL = 0.0; } else oneOverL = 1.0/fabs(crdJ(perpDirn) - crdI(perpDirn)); } } double deform; // value of deformation parameter from element double force; // value of force parameter from element int result; //junk variable // Based on "defType" and "forType" calculate // the desired response parameters "deform" and "force" if (defType == 1) // maximum chord rotations { Response *theRotations =0; // integer element returns in setResponse const char *r[1] = {"basicDeformations"}; // must be implemented in element Vector *rotVec; //vector of chord rotations at beam-column ends // set type of beam-column element response desired theRotations = theElement->setResponse(r, 1, dummy); // put element response in the vector of "myInfo" result = theRotations->getResponse(); // access the myInfo vector containing the response (new for Version 1.2) Information &theInfo = theRotations->getInformation(); rotVec = (theInfo.theVector); deform = (fabs((*rotVec)(1)) > fabs((*rotVec)(2))) ? fabs((*rotVec)(1)) : fabs((*rotVec)(2)); //use larger of two end rotations } else if (defType == 2) // interstory drift { // find associated nodes Node *nodeI = theDomain->getNode(ndI); Node *nodeJ = theDomain->getNode(ndJ); // get displacements const Vector &dispI = nodeI->getTrialDisp(); const Vector &dispJ = nodeJ->getTrialDisp(); //opserr << "Drift ndI: " << dispI(dof) << endln; //opserr << "Drift ndJ: " << dispJ(dof) << endln; // calc drift double dx = fabs(dispJ(dof)-dispI(dof)); deform = dx*oneOverL; } else { // g3ErrorHandler->fatal("WARNING ShearCurve - deformation type flag %i not implemented",defType); } Response *theForces =0; const char *f[1] = {"localForce"}; // does not include influence of P-delta // for P-delta use forType = 0 Vector *forceVec; //vector of basic forces from beam column // set type of beam-column element response desired theForces = theElement->setResponse(f, 1, dummy); // put element response in the vector of "myInfo" result += theForces->getResponse(); // access the myInfo vector containing the response (new for Version 1.2) Information &theInfo = theForces->getInformation(); forceVec = (theInfo.theVector); // Local forces (assuming no element loads) if (forType == 0) force = fabs(springForce); // force in associated LimitState material else if (forType == 1) force = fabs((*forceVec)(1)); // shear else if (forType == 2) force = fabs((*forceVec)(0)); // axial else { // g3ErrorHandler->fatal("WARNING ShearCurve - force type flag %i not implemented",forType); } P = fabs((*forceVec)(0)); // Determine if (deform,force) is outside limit state surface. // // Use absolute value of deform and force double forceSurface = findLimit(deform); // force on surface at deform // double deformSurface = findLimit(force); // deform on surface at force SDK //opserr << "The shear force in the element is: " << force << endln; //opserr << "State flag............................:" << stateFlag << endln; //opserr << "Shear force in the column.........: " << force << endln; //opserr << "forceSurface: " << forceSurface << endln; if (stateFlag == 0) //prior to failure { if (force >= forceSurface) // on/outside failure surface // if (deform >= deformSurface) // on/outside failure surface SDK { stateFlag = 1; setDegSlope(force, deform); // g3ErrorHandler->warning("ShearCurve - failure detected at deform = %f (Kdeg = %f) ", deform, Kdeg); //opserr << "*********************" << endln; opserr << "ShearCurve - failure detected....."<< endln;//SDK // opserr << "deformSurface: " << deformSurface << endln; //SDK //opserr << "Capacity: " << forceSurface << endln; //opserr << "*********************" << endln; } else // inside failure surface { stateFlag = 0; } } else //after failure { if (force >= forceSurface) // on/outside failure surface // if (deform >= deformSurface) // on/outside failure surface SDK { stateFlag = 2; } else // inside failure surface { stateFlag = 3; } } return stateFlag; }