RCSectionIntegration.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.1 $
00022 // $Date: 2006/08/11 18:32:56 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/material/section/integration/RCSectionIntegration.cpp,v $
00024 
00025 #include <RCSectionIntegration.h>
00026 #include <Matrix.h>
00027 #include <Vector.h>
00028 #include <Channel.h>
00029 #include <FEM_ObjectBroker.h>
00030 #include <Information.h>
00031 #include <Parameter.h>
00032 
00033 RCSectionIntegration::RCSectionIntegration(double D,
00034                                            double B,
00035                                            double AM,
00036                                            double AS,
00037                                            double COV,
00038                                            int NFCORE,
00039                                            int NFCOVER,
00040                                            int NFS):
00041   SectionIntegration(SECTION_INTEGRATION_TAG_RC),
00042   d(D), b(B), Amain(AM), Aside(AS), cover(COV),
00043   Nfcore(NFCORE), Nfcover(NFCOVER), Nfs(NFS), parameterID(0)
00044 {
00045   if (Nfcore < 1)
00046     Nfcore = 1;
00047 
00048   if (Nfcover < 1)
00049     Nfcover = 1;
00050 
00051   if (Nfs < 2)
00052     Nfs = 2;
00053 }
00054 
00055 RCSectionIntegration::RCSectionIntegration():
00056   SectionIntegration(SECTION_INTEGRATION_TAG_RC),
00057   d(0.0), b(0.0), Amain(0.0), Aside(0.0), cover(0.0),
00058   Nfcore(1), Nfcover(1), Nfs(2), parameterID(0)
00059 {
00060   
00061 }
00062 
00063 RCSectionIntegration::~RCSectionIntegration()
00064 {
00065   
00066 }
00067 
00068 int
00069 RCSectionIntegration::getNumFibers(void)
00070 {
00071   return 2*(Nfcore+Nfcover) + Nfs;
00072 }
00073 
00074 int
00075 RCSectionIntegration::arrangeFibers(UniaxialMaterial **theMaterials,
00076                                     UniaxialMaterial *theCore,
00077                                     UniaxialMaterial *theCover,
00078                                     UniaxialMaterial *theSteel)
00079 {
00080   int numFibers = this->getNumFibers();
00081 
00082   int i;
00083   for (i = 0; i < Nfcore; i++)
00084     theMaterials[i] = theCore;
00085   for ( ; i < numFibers-Nfs; i++)
00086     theMaterials[i] = theCover;
00087   for ( ; i < numFibers; i++)
00088     theMaterials[i] = theSteel;
00089 
00090   return 0;
00091 }
00092 
00093 void
00094 RCSectionIntegration::getFiberLocations(int nFibers, double *xi)
00095 {
00096   int loc;
00097   int i;
00098 
00099   double yIncr  = (d-2*cover)/Nfcore;
00100   double yStart = 0.5 * ((d-2*cover)-yIncr);
00101   
00102   for (loc = 0; loc < Nfcore; loc++) {
00103     xi[loc] = yStart - yIncr*loc;
00104     xi[loc+Nfcore] = xi[loc];
00105   }
00106 
00107   loc += Nfcore;
00108   
00109   yIncr = cover/Nfcover;
00110   yStart = 0.5 * (d-yIncr);
00111 
00112   for (i = 0; i < Nfcover; i++, loc++) {
00113     xi[loc] = yStart - yIncr*i;
00114     xi[loc+Nfcover] = -xi[loc];
00115   }
00116 
00117   loc += Nfcover;
00118 
00119   xi[loc++] =  0.5*d-cover;
00120   xi[loc++] = -0.5*d+cover;
00121 
00122   if (Nfs > 2) {
00123     double spacing = (d-2*cover)/(Nfs-1);
00124     for (int i = 1; i <= Nfs-2; i++)
00125       xi[loc++] = (-0.5*d+cover) + spacing*i;
00126   }
00127 
00128   return;
00129 }
00130 
00131 void
00132 RCSectionIntegration::getFiberWeights(int nFibers, double *wt)
00133 {
00134   int loc;
00135   int i;
00136 
00137   double Acore  = (b-2*cover)*(d-2*cover)/Nfcore;
00138   double Acover = (2*cover)*(d-2*cover)/Nfcore;
00139     
00140   for (loc = 0; loc < Nfcore; loc++)
00141     wt[loc] = Acore;
00142 
00143   for (i = 0; i < Nfcore; i++, loc++)
00144     wt[loc] = Acover;
00145 
00146   Acover = (cover*b)/Nfcover;
00147 
00148   for (i = 0; i < 2*Nfcover; i++, loc++)
00149     wt[loc] = Acover;
00150   
00151   wt[loc++] = Nfs*Amain;
00152   wt[loc++] = Nfs*Amain;
00153 
00154   for ( ; loc < nFibers; loc++)
00155     wt[loc] = 2*Aside;
00156 
00157   return;
00158 }
00159 
00160 SectionIntegration*
00161 RCSectionIntegration::getCopy(void)
00162 {
00163   return new RCSectionIntegration(d, b, Amain, Aside, cover,
00164                                   Nfcore, Nfcover, Nfs);
00165 }
00166 
00167 int
00168 RCSectionIntegration::setParameter(const char **argv, int argc,
00169                                    Parameter &param)
00170 {
00171   if (argc < 1)
00172     return -1;
00173 
00174   if (strcmp(argv[0],"d") == 0)
00175     return param.addObject(1, this);
00176 
00177   if (strcmp(argv[0],"b") == 0)
00178     return param.addObject(2, this);
00179 
00180   if (strcmp(argv[0],"Amain") == 0)
00181     return param.addObject(3, this);
00182 
00183   if (strcmp(argv[0],"Aside") == 0)
00184     return param.addObject(4, this);
00185 
00186   if (strcmp(argv[0],"As") == 0)
00187     return param.addObject(5, this);
00188 
00189   if (strcmp(argv[0],"cover") == 0)
00190     return param.addObject(6, this);
00191 
00192   return -1;
00193 }
00194 
00195 int
00196 RCSectionIntegration::updateParameter(int parameterID,
00197                                       Information &info)
00198 {
00199   switch (parameterID) {
00200   case 1:
00201     d = info.theDouble;
00202     return 0;
00203   case 2:
00204     b = info.theDouble;
00205     return 0;
00206   case 3:
00207     Amain = info.theDouble;
00208     return 0;
00209   case 4:
00210     Aside = info.theDouble;
00211     return 0;
00212   case 5:
00213     Amain = Aside = info.theDouble;
00214     return 0;
00215   case 6:
00216     cover = info.theDouble;
00217     return 0;
00218   default:
00219     return -1;
00220   }
00221 }
00222 
00223 int
00224 RCSectionIntegration::activateParameter(int paramID)
00225 {
00226   parameterID = paramID;
00227 
00228   return 0;
00229 }
00230 
00231 void
00232 RCSectionIntegration::getLocationsDeriv(int nFibers, double *dptsdh)
00233 {
00234   double dddh  = 0.0;
00235   double dcoverdh = 0.0;
00236   
00237   if (parameterID == 1) // d
00238     dddh  = 1.0;
00239   if (parameterID == 6) // cover
00240     dcoverdh =  1.0;
00241 
00242   int loc;
00243   int i;
00244 
00245   double dyIncrdh  = (dddh-2*dcoverdh)/Nfcore;
00246   double dyStartdh = 0.5 * ((dddh-2*dcoverdh)-dyIncrdh);
00247   
00248   for (loc = 0; loc < Nfcore; loc++) {
00249     dptsdh[loc] = dyStartdh - dyIncrdh*loc;
00250     dptsdh[loc+Nfcore] = dptsdh[loc];
00251   }
00252 
00253   loc += Nfcore;
00254   
00255   dyIncrdh = dcoverdh/Nfcover;
00256   dyStartdh = 0.5 * (dddh-dyIncrdh);
00257 
00258   for (i = 0; i < Nfcover; i++, loc++) {
00259     dptsdh[loc] = dyStartdh - dyIncrdh*i;
00260     dptsdh[loc+Nfcover] = -dptsdh[loc];
00261   }
00262 
00263   loc += Nfcover;
00264 
00265   dptsdh[loc++] =  0.5*dddh-dcoverdh;
00266   dptsdh[loc++] = -0.5*dddh+dcoverdh;
00267 
00268   if (Nfs > 2) {
00269     double dspacingdh = (dddh-2*dcoverdh)/(Nfs-1);
00270     for (int i = 1; i <= Nfs-2; i++)
00271       dptsdh[loc++] = (-0.5*dddh+dcoverdh) + dspacingdh*i;
00272   }
00273 
00274   //for (int i = 0; i < nFibers; i++)
00275   //  opserr << dptsdh[i] << ' ';
00276   //opserr << endln;
00277 
00278   return;
00279 }
00280 
00281 void
00282 RCSectionIntegration::getWeightsDeriv(int nFibers, double *dwtsdh)
00283 {
00284   double dddh  = 0.0;
00285   double dbdh = 0.0;
00286   double dAmaindh = 0.0;
00287   double dAsidedh = 0.0;
00288   double dcoverdh = 0.0;
00289   
00290   if (parameterID == 1) // d
00291     dddh  = 1.0;
00292   if (parameterID == 2) // b
00293     dbdh = 1.0;
00294   if (parameterID == 3) // Amain
00295     dAmaindh = 1.0;
00296   if (parameterID == 4) // Aside
00297     dAsidedh = 1.0;
00298   if (parameterID == 5) // Amain and Aside
00299     dAmaindh = dAsidedh = 1.0;
00300   if (parameterID == 6) // cover
00301     dcoverdh =  1.0;
00302     
00303   int loc;
00304   int i;
00305 
00306   double dAcoredh = ((b-2*cover)*(dddh-2*dcoverdh) +
00307                      (dbdh-2*dcoverdh)*(d-2*cover)) / Nfcore;
00308   double dAcoverdh = ((2*cover)*(dddh-2*dcoverdh) + 
00309                       (2*dcoverdh)*(d-2*cover)) / Nfcore;
00310     
00311   for (loc = 0; loc < Nfcore; loc++)
00312     dwtsdh[loc] = dAcoredh;
00313 
00314   for (i = 0; i < Nfcore; i++, loc++)
00315     dwtsdh[loc] = dAcoverdh;
00316 
00317   dAcoverdh = (cover*dbdh+dcoverdh*b)/Nfcover;
00318 
00319   for (i = 0; i < 2*Nfcover; i++, loc++)
00320     dwtsdh[loc] = dAcoverdh;
00321   
00322   dwtsdh[loc++] = Nfs*dAmaindh;
00323   dwtsdh[loc++] = Nfs*dAmaindh;
00324 
00325   for ( ; loc < nFibers; loc++)
00326     dwtsdh[loc] = 2*dAsidedh;
00327 
00328   return;
00329 
00330   //for (int i = 0; i < nFibers; i++)
00331   //  opserr << dwtsdh[i] << ' ';
00332   //opserr << endln;
00333 
00334   return;
00335 }
00336 
00337 void
00338 RCSectionIntegration::Print(OPS_Stream &s, int flag)
00339 {
00340   s << "RC" << endln;
00341   s << " d = "  << d;
00342   s << " b = " << b; 
00343   s << " Amain = " << Amain;
00344   s << " Amain = " << Aside;
00345   s << " cover = " << cover << endln;
00346   s << " Nfcore = " << Nfcore;
00347   s << " Nfcover = " << Nfcover;
00348   s << " Nfs = " << Nfs << endln;
00349 
00350   return;
00351 }
00352 
00353 int
00354 RCSectionIntegration::sendSelf(int cTag, Channel &theChannel)
00355 {
00356   static Vector data(8);
00357 
00358   data(0) = d;
00359   data(1) = b;
00360   data(2) = Amain;
00361   data(3) = Aside;
00362   data(4) = cover;
00363   data(5) = Nfcore;
00364   data(6) = Nfcover;
00365   data(7) = Nfs;
00366 
00367   int dbTag = this->getDbTag();
00368 
00369   if (theChannel.sendVector(dbTag, cTag, data) < 0) {
00370     opserr << "RCSectionIntegration::sendSelf() - failed to send Vector data\n";
00371     return -1;
00372   }    
00373 
00374   return 0;
00375 }
00376 
00377 int
00378 RCSectionIntegration::recvSelf(int cTag, Channel &theChannel,
00379                                FEM_ObjectBroker &theBroker)
00380 {
00381   static Vector data(8);
00382 
00383   int dbTag = this->getDbTag();
00384 
00385   if (theChannel.recvVector(dbTag, cTag, data) < 0)  {
00386     opserr << "RCSectionIntegration::recvSelf() - failed to receive Vector data\n";
00387     return -1;
00388   }
00389   
00390   d       = data(0);
00391   b       = data(1);
00392   Amain   = data(2);
00393   Aside   = data(3);
00394   cover   = data(4);
00395   Nfcore  = (int)data(5);
00396   Nfcover = (int)data(6);
00397   Nfs     = (int)data(7);
00398 
00399   return 0;
00400 }

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