ThreePointCurve.cpp

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 1999, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020 
00021 // $Revision: 1.2 $
00022 // $Date: 2006/08/04 18:35:06 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/material/uniaxial/limitState/limitCurve/ThreePointCurve.cpp,v $                                                                        
00024 // Written: KJE
00025 // Created: Aug 2001
00026 // Modified: Jul 2002
00027 
00028 
00029 #include <ThreePointCurve.h>
00030 #include <G3Globals.h>
00031 #include <math.h>
00032 #include <ElementResponse.h>
00033 #include <Element.h>
00034 #include <Node.h>
00035 #include <Domain.h>
00036 #include <Vector.h>
00037 #include <float.h>
00038 
00039 #include <DummyStream.h>
00040 
00041 ThreePointCurve::ThreePointCurve(int tag, int eTag, Domain *theDom, 
00042                         double a1, double b1, double a2, double b2,
00043                         double a3, double b3, double Kd, double Fr,
00044                         int dType, int fType,
00045                         int ni, int nj, int df, int dirn):
00046 LimitCurve(tag, TAG_ThreePointCurve), eleTag(eTag), theDomain(theDom), theElement(0),
00047 Kdeg(Kd), Fres(Fr), defType(dType), forType(fType),
00048 x1(a1), y1(b1), x2(a2), y2(b2), x3(a3), y3(b3),
00049 ndI(ni), ndJ(nj), dof(df), perpDirn(dirn)
00050 {
00051         stateFlag = 0;
00052         count = 0;
00053 //      this->Print(cout); // Commented out by Terje
00054 }
00055 
00056 ThreePointCurve::ThreePointCurve():
00057 LimitCurve(0, TAG_ThreePointCurve), eleTag(0), theDomain(0), theElement(0),
00058 Kdeg(0), Fres(0), defType(0), forType(0),
00059 x1(0), y1(0), x2(0), y2(0), x3(0), y3(0)
00060 {
00061 //VOID//
00062 }
00063 
00064 ThreePointCurve::~ThreePointCurve()
00065 {
00066 //VOID//
00067 }
00068 
00069 
00070 LimitCurve*
00071 ThreePointCurve::getCopy(void)
00072 {
00073         ThreePointCurve *theCopy = new ThreePointCurve(this->getTag(),
00074                 eleTag, theDomain, x1, y1, x2, y2, x3, y3,
00075                 Kdeg, Fres, defType, forType, ndI, ndJ, dof, perpDirn);
00076 
00077         theCopy->stateFlag = stateFlag;
00078 
00079         return theCopy;
00080 }
00081 
00082 
00083 // check if limit state surface has been reached
00084 int
00085 ThreePointCurve::checkElementState(double springForce)
00086 {
00087   DummyStream dummy;
00088         // find associated beam-column elementon first visit
00089         if (theElement == 0)
00090         {
00091                 theElement = theDomain->getElement(eleTag);
00092 
00093                 if (theElement == 0) 
00094 //                      g3ErrorHandler->fatal("WARNING ThreePointCurve - no element with tag %i exists in Domain",eleTag);
00095 
00096                 // find length between nodes if drift is desired
00097                 if (defType == 2)
00098                 {
00099                         Node *nodeI = theDomain->getNode(ndI);
00100                         Node *nodeJ = theDomain->getNode(ndJ);
00101 
00102                         const Vector &crdI = nodeI->getCrds();
00103                         const Vector &crdJ = nodeJ->getCrds();
00104 
00105                         if (crdI(perpDirn) == crdJ(perpDirn)) {
00106 //                              g3ErrorHandler->warning("%s -- Nodal projection has zero component along chosen direction",
00107 //                                              "AxialCurve::AxialCurve");
00108 
00109                                 oneOverL = 0.0;
00110                         }
00111                         else 
00112                                 oneOverL = 1.0/fabs(crdJ(perpDirn) - crdI(perpDirn));
00113                 }
00114         }
00115 
00116         double deform;  // value of deformation parameter from element
00117         double force;   // value of force parameter from element
00118         int result; //junk variable
00119 
00120 
00121         // Based on "defType" and "forType" calculate 
00122         // the desired response parameters "deform" and "force"
00123         if (defType == 1) // maximum chord rotations
00124         {
00125 
00126                 Response *theRotations =0; // integer element returns in setResponse
00127                 //char *r[1] = {"rotation"};
00128                 //char *r[1] = {"plasticRotation"};
00129                 const char *r[1] = {"basicDeformations"};
00130                 Information     *rotInfoObject =0;   // DELETE IF PROBLEMS LATER
00131                 Vector *rotVec; //vector of chord rotations at beam-column ends
00132 
00133                 // set type of beam-column element response desired
00134                 theRotations = theElement->setResponse(r, 1, *rotInfoObject, dummy);
00135 
00136                 // put element response in the vector of "myInfo"
00137                 result = theRotations->getResponse();
00138 
00139                 // access the myInfo vector containing the response (new for Version 1.2)
00140                 Information &theInfo = theRotations->getInformation();
00141                 rotVec = (theInfo.theVector);
00142 
00143                 deform = (fabs((*rotVec)(1)) > fabs((*rotVec)(2))) ? 
00144                         fabs((*rotVec)(1)) : fabs((*rotVec)(2));  //use larger of two end rotations
00145         }
00146         else if (defType == 2) // interstory drift
00147         {
00148                 // find associated nodes 
00149                 Node *nodeI = theDomain->getNode(ndI);
00150                 Node *nodeJ = theDomain->getNode(ndJ);
00151 
00152                 // get displacements
00153                 const Vector &dispI = nodeI->getTrialDisp();
00154                 const Vector &dispJ = nodeJ->getTrialDisp();
00155                 
00156                 // calc drift
00157                 double dx = fabs(dispJ(dof)-dispI(dof));
00158                 deform = dx*oneOverL;
00159         }
00160         else {
00161 //              g3ErrorHandler->fatal("WARNING ThreePointCurve - deformation type flag %i not implemented",defType);
00162         }
00163 
00164                 Response *theForces =0;
00165                 const char *f[1] = {"localForce"};
00166                 Information     *forInfoObject =0;
00167                 Vector *forceVec; //vector of basic forces from beam column
00168 
00169                 // set type of beam-column element response desired
00170                 theForces    = theElement->setResponse(f, 1, *forInfoObject, dummy);
00171 
00172                 // put element response in the vector of "myInfo"
00173                 result += theForces->getResponse();
00174 
00175                 // access the myInfo vector containing the response (new for Version 1.2)
00176                 Information &theInfo = theForces->getInformation();
00177                 forceVec = (theInfo.theVector);
00178 
00179         // Local forces (assuming no element loads)
00180         if (forType == 0)
00181                 force = fabs(springForce); //force in associated hysteretic material
00182         else if (forType == 1) 
00183                 force = fabs((*forceVec)(1)); //shear
00184         else if (forType == 2) //axial
00185                 force = fabs((*forceVec)(0)); 
00186         else {
00187 //              g3ErrorHandler->fatal("WARNING ThreePointCurve - force type flag %i not implemented",forType);
00188         }
00189 
00190         // Determine if (deform,force) is outside limit state surface.
00191         // 
00192         // Use absolute value of deform and force
00193         // In future will include one positive and one negative limit state surfaces
00194         double forceSurface = findLimit(deform); // force on surface at deform
00195 
00196         count += 1;
00197 
00198         if (stateFlag == 0) //prior to failure
00199         {
00200                 if (force >= forceSurface) // on/outside failure surface
00201                 {       
00202                         stateFlag = 1;
00203                         //Pshear = fabs((*forceVec)(0)); // axial load at shear failure (not currently used)
00204 //                      g3ErrorHandler->warning("ThreePointCurve - failure detected at deform = %f", deform);
00205                 }
00206                 else // inside failure surface
00207                 {
00208                         stateFlag = 0;
00209                 }
00210         }
00211         else //after failure
00212         {
00213                 if (force >= forceSurface) // on/outside failure surface
00214                 {       
00215                         stateFlag = 2;
00216 //                      g3ErrorHandler->warning("WARNING ThreePointCurve - response past limit surface after failure at deform=%f", deform);
00217                 }
00218                 else // inside failure surface
00219                 {
00220                         stateFlag = 3;
00221                 }
00222         }
00223 
00224         return stateFlag;
00225 }
00226 
00227 
00228 double
00229 ThreePointCurve::getDegSlope(void)
00230 {
00231         return Kdeg;
00232 }
00233 
00234 
00235 double
00236 ThreePointCurve::getResForce(void)
00237 {
00238         return Fres;  
00239 }
00240 
00241 double
00242 ThreePointCurve::getUnbalanceForce(void)
00243 {
00244         //Do nothing for this class
00245         return 0.0;
00246 }
00247 
00248 int
00249 ThreePointCurve::sendSelf(int commitTag, Channel &theChannel)
00250 {
00251         return -1;
00252 }
00253 
00254 int
00255 ThreePointCurve::recvSelf(int commitTag, Channel &theChannel, 
00256                         FEM_ObjectBroker &theBroker)
00257 {
00258         return -1;
00259 }
00260     
00261 void
00262 ThreePointCurve::Print(OPS_Stream &s, int flag)
00263 {
00264         s << "Three-Point Limit Curve, tag: " << this->getTag() << endln;
00265         s << "x1,y1: " << x1 <<", "<< y1 << endln;
00266         s << "x2,y2: " << x2 <<", "<< y2 << endln;
00267         s << "x3,y3: " << x3 <<", "<< y3 << endln;
00268         s << "eleTag: " << eleTag << endln;
00269         s << "nodeI: " << ndI << endln;
00270         s << "nodeJ: " << ndJ << endln;
00271         s << "deform: " << defType << endln;
00272         s << "force: " << forType << endln;
00273 }
00274 
00275 
00276 
00277 // Private Functions
00278 
00279 double
00280 ThreePointCurve::findLimit(double x)
00281 {
00282         double y = 0.0;
00283 
00284         if (x < x1) {
00285 //              g3ErrorHandler->fatal("Outside limits of ThreePointCurve");
00286         }
00287         else if (x < x2)
00288                 y = y1+(y2-y1)/(x2-x1)*(x-x1);
00289         else if (x < x3)
00290                 y = y2+(y3-y2)/(x3-x2)*(x-x2);
00291         else
00292                 y = y3;
00293         
00294         return y;
00295 }
00296 
00297 
00298 
00299 int ThreePointCurve::revertToStart ()
00300 {
00301         return 0;
00302 }

Generated on Mon Oct 23 15:05:20 2006 for OpenSees by doxygen 1.5.0