00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <ElasticShearSection3d.h>
00026 #include <Matrix.h>
00027 #include <Vector.h>
00028 #include <Channel.h>
00029 #include <FEM_ObjectBroker.h>
00030 #include <MatrixUtil.h>
00031 #include <Parameter.h>
00032 #include <stdlib.h>
00033
00034 #include <classTags.h>
00035
00036 Vector ElasticShearSection3d::s(6);
00037 Matrix ElasticShearSection3d::ks(6,6);
00038 ID ElasticShearSection3d::code(6);
00039
00040 ElasticShearSection3d::ElasticShearSection3d(void)
00041 :SectionForceDeformation(0, SEC_TAG_Elastic3d),
00042 E(0.0), A(0.0), Iz(0.0), Iy(0.0), G(0.0), J(0.0), alpha(0.0),
00043 e(6), eCommit(6)
00044 {
00045 if (code(0) != SECTION_RESPONSE_P) {
00046 code(0) = SECTION_RESPONSE_P;
00047 code(1) = SECTION_RESPONSE_MZ;
00048 code(2) = SECTION_RESPONSE_VY;
00049 code(3) = SECTION_RESPONSE_MY;
00050 code(4) = SECTION_RESPONSE_VZ;
00051 code(5) = SECTION_RESPONSE_T;
00052 }
00053 }
00054
00055 ElasticShearSection3d::ElasticShearSection3d
00056 (int tag, double E_in, double A_in, double Iz_in, double Iy_in,
00057 double G_in, double J_in, double alpha_in)
00058 :SectionForceDeformation(tag, SEC_TAG_Elastic3d),
00059 E(E_in), A(A_in), Iz(Iz_in), Iy(Iy_in), G(G_in), J(J_in), alpha(alpha_in),
00060 e(6), eCommit(6)
00061 {
00062 if (E <= 0.0) {
00063 opserr << "ElasticShearSection3d::ElasticShearSection3d -- Input E <= 0.0 ... setting E to 1.0\n";
00064 E = 1.0;
00065 }
00066
00067 if (A <= 0.0) {
00068 opserr << "ElasticShearSection3d::ElasticShearSection3d -- Input A <= 0.0 ... setting A to 1.0\n";
00069 A = 1.0;
00070 }
00071
00072 if (Iz <= 0.0) {
00073 opserr << "ElasticShearSection3d::ElasticShearSection3d -- Input Iz <= 0.0 ... setting Iz to 1.0\n";
00074 Iz = 1.0;
00075 }
00076
00077 if (Iy <= 0.0) {
00078 opserr << "ElasticShearSection3d::ElasticShearSection3d -- Input Iy <= 0.0 ... setting Iy to 1.0\n";
00079 Iy = 1.0;
00080 }
00081
00082 if (G <= 0.0) {
00083 opserr << "ElasticShearSection3d::ElasticShearSection3d -- Input G <= 0.0 ... setting G to 1.0\n";
00084 G = 1.0;
00085 }
00086
00087 if (J <= 0.0) {
00088 opserr << "ElasticShearSection3d::ElasticShearSection3d -- Input J <= 0.0 ... setting J to 1.0\n";
00089 J = 1.0;
00090 }
00091
00092 if (code(0) != SECTION_RESPONSE_P) {
00093 code(0) = SECTION_RESPONSE_P;
00094 code(1) = SECTION_RESPONSE_MZ;
00095 code(2) = SECTION_RESPONSE_VY;
00096 code(3) = SECTION_RESPONSE_MY;
00097 code(4) = SECTION_RESPONSE_VZ;
00098 code(5) = SECTION_RESPONSE_T;
00099 }
00100 }
00101
00102 ElasticShearSection3d::~ElasticShearSection3d(void)
00103 {
00104
00105 }
00106
00107 int
00108 ElasticShearSection3d::commitState(void)
00109 {
00110 eCommit = e;
00111
00112 return 0;
00113 }
00114
00115 int
00116 ElasticShearSection3d::revertToLastCommit(void)
00117 {
00118 e = eCommit;
00119
00120 return 0;
00121 }
00122
00123 int
00124 ElasticShearSection3d::revertToStart(void)
00125 {
00126 eCommit.Zero();
00127
00128 return 0;
00129 }
00130
00131 int
00132 ElasticShearSection3d::setTrialSectionDeformation (const Vector &def)
00133 {
00134 e = def;
00135
00136 return 0;
00137 }
00138
00139 const Vector &
00140 ElasticShearSection3d::getSectionDeformation (void)
00141 {
00142 return e;
00143 }
00144
00145 const Vector &
00146 ElasticShearSection3d::getStressResultant (void)
00147 {
00148 s(0) = E*A*e(0);
00149 s(1) = E*Iz*e(1);
00150 s(3) = E*Iy*e(3);
00151 s(5) = G*J*e(5);
00152
00153 double GA = G*A*alpha;
00154 s(2) = GA*e(2);
00155 s(4) = GA*e(4);
00156
00157 return s;
00158 }
00159
00160 const Matrix &
00161 ElasticShearSection3d::getSectionTangent(void)
00162 {
00163 ks(0,0) = E*A;
00164 ks(1,1) = E*Iz;
00165 ks(3,3) = E*Iy;
00166 ks(5,5) = G*J;
00167
00168 double GA = G*A*alpha;
00169 ks(2,2) = GA;
00170 ks(4,4) = GA;
00171
00172 return ks;
00173 }
00174
00175 const Matrix &
00176 ElasticShearSection3d::getInitialTangent(void)
00177 {
00178 ks(0,0) = E*A;
00179 ks(1,1) = E*Iz;
00180 ks(3,3) = E*Iy;
00181 ks(5,5) = G*J;
00182
00183 double GA = G*A*alpha;
00184 ks(2,2) = GA;
00185 ks(4,4) = GA;
00186
00187 return ks;
00188 }
00189
00190 const Matrix &
00191 ElasticShearSection3d::getSectionFlexibility (void)
00192 {
00193 ks(0,0) = 1.0/(E*A);
00194 ks(1,1) = 1.0/(E*Iz);
00195 ks(3,3) = 1.0/(E*Iy);
00196 ks(5,5) = 1.0/(G*J);
00197
00198 double GA = 1.0/(G*A*alpha);
00199 ks(2,2) = GA;
00200 ks(4,4) = GA;
00201
00202 return ks;
00203 }
00204
00205 const Matrix &
00206 ElasticShearSection3d::getInitialFlexibility (void)
00207 {
00208 ks(0,0) = 1.0/(E*A);
00209 ks(1,1) = 1.0/(E*Iz);
00210 ks(3,3) = 1.0/(E*Iy);
00211 ks(5,5) = 1.0/(G*J);
00212
00213 double GA = 1.0/(G*A*alpha);
00214 ks(2,2) = GA;
00215 ks(4,4) = GA;
00216
00217 return ks;
00218 }
00219
00220 SectionForceDeformation*
00221 ElasticShearSection3d::getCopy ()
00222 {
00223
00224 ElasticShearSection3d *theCopy =
00225 new ElasticShearSection3d (this->getTag(), E, A, Iz, Iy, G, J, alpha);
00226
00227 theCopy->eCommit = eCommit;
00228
00229 return theCopy;
00230 }
00231
00232 const ID&
00233 ElasticShearSection3d::getType ()
00234 {
00235 return code;
00236 }
00237
00238 int
00239 ElasticShearSection3d::getOrder () const
00240 {
00241 return 6;
00242 }
00243
00244 int
00245 ElasticShearSection3d::sendSelf(int commitTag, Channel &theChannel)
00246 {
00247 int res = 0;
00248
00249 static Vector data(14);
00250
00251 int dataTag = this->getDbTag();
00252
00253 data(0) = this->getTag();
00254 data(1) = E;
00255 data(2) = A;
00256 data(3) = Iz;
00257 data(4) = Iy;
00258 data(5) = G;
00259 data(6) = J;
00260 data(7) = alpha;
00261 data(8) = eCommit(0);
00262 data(9) = eCommit(1);
00263 data(10) = eCommit(2);
00264 data(11) = eCommit(3);
00265 data(12) = eCommit(4);
00266 data(13) = eCommit(5);
00267
00268 res += theChannel.sendVector(dataTag, commitTag, data);
00269 if(res < 0) {
00270 opserr << "ElasticShearSection3d::sendSelf -- failed to send data\n";
00271 return res;
00272 }
00273
00274 return res;
00275 }
00276
00277 int
00278 ElasticShearSection3d::recvSelf(int commitTag, Channel &theChannel,
00279 FEM_ObjectBroker &theBroker)
00280 {
00281 int res = 0;
00282
00283 static Vector data(14);
00284
00285 int dataTag = this->getDbTag();
00286
00287 res += theChannel.recvVector(dataTag, commitTag, data);
00288 if(res < 0) {
00289 opserr << "ElasticShearSection3d::recvSelf -- failed to receive data\n";
00290 return res;
00291 }
00292
00293 this->setTag((int)data(0));
00294 E = data(1);
00295 A = data(2);
00296 Iz = data(3);
00297 Iy = data(4);
00298 G = data(5);
00299 J = data(6);
00300 alpha = data(7);
00301 eCommit(0) = data(8);
00302 eCommit(1) = data(9);
00303 eCommit(2) = data(10);
00304 eCommit(3) = data(11);
00305 eCommit(4) = data(12);
00306 eCommit(5) = data(13);
00307
00308 return res;
00309 }
00310
00311 void
00312 ElasticShearSection3d::Print(OPS_Stream &s, int flag)
00313 {
00314 if (flag == 2) {
00315
00316 } else {
00317 s << "ElasticShearSection3d, tag: " << this->getTag() << endln;
00318 s << "\t E: " << E << endln;
00319 s << "\t A: " << A << endln;
00320 s << "\tIz: " << Iz << endln;
00321 s << "\tIy: " << Iy << endln;
00322 s << "\t G: " << G << endln;
00323 s << "\t J: " << J << endln;
00324 s << "\talpha: " << alpha << endln;
00325 }
00326 }
00327
00328 int
00329 ElasticShearSection3d::setParameter(const char **argv, int argc, Parameter ¶m)
00330 {
00331 if (argc < 1)
00332 return -1;
00333
00334 if (strcmp(argv[0],"E") == 0)
00335 return param.addObject(1, this);
00336
00337 if (strcmp(argv[0],"A") == 0)
00338 return param.addObject(2, this);
00339
00340 if (strcmp(argv[0],"Iz") == 0)
00341 return param.addObject(3, this);
00342
00343 if (strcmp(argv[0],"Iy") == 0)
00344 return param.addObject(4, this);
00345
00346 if (strcmp(argv[0],"G") == 0)
00347 return param.addObject(5, this);
00348
00349 if (strcmp(argv[0],"J") == 0)
00350 return param.addObject(6, this);
00351
00352 if (strcmp(argv[0],"alpha") == 0)
00353 return param.addObject(7, this);
00354
00355 return -1;
00356 }
00357
00358 int
00359 ElasticShearSection3d::updateParameter(int paramID, Information &info)
00360 {
00361 if (paramID == 1)
00362 E = info.theDouble;
00363 if (paramID == 2)
00364 A = info.theDouble;
00365 if (paramID == 3)
00366 Iz = info.theDouble;
00367 if (paramID == 4)
00368 Iy = info.theDouble;
00369 if (paramID == 5)
00370 G = info.theDouble;
00371 if (paramID == 6)
00372 J = info.theDouble;
00373 if (paramID == 7)
00374 alpha = info.theDouble;
00375
00376 return 0;
00377 }
00378
00379 int
00380 ElasticShearSection3d::activateParameter(int paramID)
00381 {
00382 parameterID = paramID;
00383
00384 return 0;
00385 }
00386
00387 const Vector&
00388 ElasticShearSection3d::getStressResultantSensitivity(int gradNumber,
00389 bool conditional)
00390 {
00391 s.Zero();
00392
00393 if (parameterID == 1) {
00394 s(0) = A*e(0);
00395 s(1) = Iz*e(1);
00396 s(3) = Iy*e(3);
00397 }
00398 if (parameterID == 2) {
00399 s(0) = E*e(0);
00400 double Galpha = G*alpha;
00401 s(2) = Galpha*e(2);
00402 s(4) = Galpha*e(4);
00403 }
00404 if (parameterID == 3)
00405 s(1) = E*e(1);
00406 if (parameterID == 4)
00407 s(3) = E*e(3);
00408 if (parameterID == 5) {
00409 double Aalpha = A*alpha;
00410 s(2) = Aalpha*e(2);
00411 s(4) = Aalpha*e(4);
00412 s(5) = J*e(5);
00413 }
00414 if (parameterID == 6)
00415 s(5) = G*e(5);
00416 if (parameterID == 7) {
00417 double GA = G*A;
00418 s(2) = GA*e(2);
00419 s(4) = GA*e(4);
00420 }
00421
00422 return s;
00423 }
00424
00425 const Vector&
00426 ElasticShearSection3d::getSectionDeformationSensitivity(int gradNumber)
00427 {
00428 s.Zero();
00429
00430 return s;
00431 }
00432
00433 const Matrix&
00434 ElasticShearSection3d::getInitialTangentSensitivity(int gradNumber)
00435 {
00436 ks.Zero();
00437
00438 return ks;
00439 }
00440
00441 int
00442 ElasticShearSection3d::commitSensitivity(const Vector& dedh,
00443 int gradNumber, int numGrads)
00444 {
00445
00446 return 0;
00447 }