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