UserDefinedHingeIntegration2d.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.4 $
00022 // $Date: 2003/06/10 00:36:09 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/element/forceBeamColumn/UserDefinedHingeIntegration2d.cpp,v $
00024 
00025 #include <UserDefinedHingeIntegration2d.h>
00026 
00027 #include <Matrix.h>
00028 #include <Vector.h>
00029 #include <Channel.h>
00030 #include <FEM_ObjectBroker.h>
00031 #include <Information.h>
00032 
00033 UserDefinedHingeIntegration2d::UserDefinedHingeIntegration2d(int npL,
00034                                                              const Vector &ptL,
00035                                                              const Vector &wtL,
00036                                                              int npR,
00037                                                              const Vector &ptR,
00038                                                              const Vector &wtR,
00039                                                              double ee,
00040                                                              double aa,
00041                                                              double ii):
00042   BeamIntegration(BEAM_INTEGRATION_TAG_UserHinge2d),
00043   ptsL(npL), wtsL(npL), ptsR(npR), wtsR(npR),
00044   E(ee), A(aa), I(ii)
00045 {
00046   int i;
00047   for (i = 0; i < npL; i++) {
00048     if (ptL(i) < 0.0 || ptL(i) > 1.0)
00049       opserr << "UserDefinedHingeIntegration2d::UserDefinedHingeIntegration2d -- point lies outside [0,1]" << endln;
00050     if (wtL(i) < 0.0 || wtL(i) > 1.0)
00051       opserr << "UserDefinedHingeIntegration2d::UserDefinedHingeIntegration2d -- weight lies outside [0,1]" << endln;
00052     ptsL(i) = ptL(i);
00053     wtsL(i) = wtL(i);
00054   }
00055 
00056   for (i = 0; i < npR; i++) {
00057     if (ptR(i) < 0.0 || ptR(i) > 1.0)
00058       opserr << "UserDefinedHingeIntegration2d::UserDefinedHingeIntegration2d -- point lies outside [0,1]" << endln;
00059     if (wtR(i) < 0.0 || wtR(i) > 1.0)
00060       opserr << "UserDefinedHingeIntegration2d::UserDefinedHingeIntegration2d -- weight lies outside [0,1]" << endln;
00061     ptsR(i) = ptR(i);
00062     wtsR(i) = wtR(i);
00063   }
00064 }
00065 
00066 UserDefinedHingeIntegration2d::UserDefinedHingeIntegration2d():
00067   BeamIntegration(BEAM_INTEGRATION_TAG_UserHinge2d),
00068   E(0.0), A(0.0), I(0.0)
00069 {
00070 
00071 }
00072 
00073 UserDefinedHingeIntegration2d::~UserDefinedHingeIntegration2d()
00074 {
00075   // Nothing to do
00076 }
00077 
00078 void
00079 UserDefinedHingeIntegration2d::getSectionLocations(int numSections,
00080                                                  double L, double *xi)
00081 {
00082   int npL = ptsL.Size();
00083   int npR = ptsR.Size();
00084 
00085   int i, j;
00086   for (i = 0; i < npL; i++)
00087     xi[i] = ptsL(i);
00088   for (j = 0; j < npR; j++, i++)
00089     xi[i] = ptsR(j);
00090   for ( ; i < numSections; i++)
00091     xi[i] = 0.0;
00092 }
00093 
00094 void
00095 UserDefinedHingeIntegration2d::getSectionWeights(int numSections,
00096                                                double L, double *wt)
00097 {
00098   int npL = wtsL.Size();
00099   int npR = wtsR.Size();
00100 
00101   int i, j;
00102   for (i = 0; i < npL; i++)
00103     wt[i] = wtsL(i);
00104   for (j = 0; j < npR; j++, i++)
00105     wt[i] = wtsR(j);
00106   for ( ; i < numSections; i++)
00107     wt[i] = 1.0;
00108 }
00109 
00110 int
00111 UserDefinedHingeIntegration2d::addElasticFlexibility(double L, Matrix &fElastic)
00112 {
00113   int npL = wtsL.Size();
00114   int npR = wtsR.Size();
00115 
00116   double betaI = 0.0;
00117   double betaJ = 0.0;
00118 
00119   int i;
00120   for (i = 0; i < npL; i++)
00121     betaI += wtsL(i);
00122   for (i = 0; i < npR; i++)
00123     betaJ += wtsR(i);
00124 
00125   // Length of elastic interior
00126   double Le = L*(1.0-betaI-betaJ);
00127   double LoverEA  = Le/(E*A);
00128   double Lover3EI = Le/(3*E*I);
00129   double Lover6EI = 0.5*Lover3EI;
00130   
00131   // Elastic flexibility of element interior
00132   static Matrix fe(2,2);
00133   fe(0,0) = fe(1,1) =  Lover3EI;
00134   fe(0,1) = fe(1,0) = -Lover6EI;
00135   
00136   // Equilibrium transformation matrix
00137   static Matrix B(2,2);
00138   B(0,0) = 1.0 - betaI;
00139   B(1,1) = 1.0 - betaJ;
00140   B(0,1) = -betaI;
00141   B(1,0) = -betaJ;
00142   
00143   // Transform the elastic flexibility of the element
00144   // interior to the basic system
00145   static Matrix ftmp(2,2);
00146   ftmp.addMatrixTripleProduct(0.0, B, fe, 1.0);
00147 
00148   fElastic(0,0) += LoverEA;
00149   fElastic(1,1) += ftmp(0,0);
00150   fElastic(1,2) += ftmp(0,1);
00151   fElastic(2,1) += ftmp(1,0);
00152   fElastic(2,2) += ftmp(1,1);
00153 
00154   return -1;
00155 }
00156 
00157 void
00158 UserDefinedHingeIntegration2d::addElasticDeformations(ElementalLoad *theLoad,
00159                                                     double loadFactor,
00160                                                     double L, double *v0)
00161 {
00162   return;
00163 }
00164 
00165 BeamIntegration*
00166 UserDefinedHingeIntegration2d::getCopy(void)
00167 {
00168   int npL = ptsL.Size();
00169   int npR = ptsR.Size();
00170 
00171   return new UserDefinedHingeIntegration2d(npL, ptsL, wtsL,
00172                                          npR, ptsR, wtsR,
00173                                          E, A, I);
00174 }
00175 
00176 int
00177 UserDefinedHingeIntegration2d::sendSelf(int cTag, Channel &theChannel)
00178 {
00179   return -1;
00180 }
00181 
00182 int
00183 UserDefinedHingeIntegration2d::recvSelf(int cTag, Channel &theChannel,
00184                                       FEM_ObjectBroker &theBroker)
00185 {
00186   return -1;
00187 }
00188 
00189 int
00190 UserDefinedHingeIntegration2d::setParameter(const char **argv,
00191                                             int argc, Information &info)
00192 {
00193   if (strcmp(argv[0],"E") == 0) {
00194     info.theType = DoubleType;
00195     return 1;
00196   }
00197   else if (strcmp(argv[0],"A") == 0) {
00198     info.theType = DoubleType;
00199     return 2;
00200   }
00201   else if (strcmp(argv[0],"I") == 0 || strcmp(argv[0],"Iz") == 0) {
00202     info.theType = DoubleType;
00203     return 3;
00204   }
00205   else 
00206     return -1;
00207 }
00208 
00209 int
00210 UserDefinedHingeIntegration2d::updateParameter(int parameterID,
00211                                              Information &info)
00212 {
00213   switch (parameterID) {
00214   case 1:
00215     E = info.theDouble;
00216     return 0;
00217   case 2:
00218     A = info.theDouble;
00219     return 0;
00220   case 3:
00221     I = info.theDouble;
00222     return 0;
00223   default:
00224     return -1;
00225   }
00226 }
00227 
00228 int
00229 UserDefinedHingeIntegration2d::activateParameter(int parameterID)
00230 {
00231   // For Terje to do
00232   return 0;
00233 }
00234 
00235 void
00236 UserDefinedHingeIntegration2d::Print(OPS_Stream &s, int flag)
00237 {
00238   s << "UserHinge2d" << endln;
00239   s << " E = " << E;
00240   s << " A = " << A;
00241   s << " I = " << I << endln;
00242   s << " Points left hinge: " << ptsL;
00243   s << " Weights left hinge: " << wtsL;
00244   s << " Points right hinge: " << ptsR;
00245   s << " Weights right hinge: " << wtsR;
00246 }

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