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
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include <ElasticSection3d.h>
00037 #include <Matrix.h>
00038 #include <Vector.h>
00039 #include <Channel.h>
00040 #include <FEM_ObjectBroker.h>
00041 #include <MatrixUtil.h>
00042 #include <stdlib.h>
00043
00044 #include <classTags.h>
00045
00046 ID ElasticSection3d::code(4);
00047
00048 ElasticSection3d::ElasticSection3d(void)
00049 :SectionForceDeformation(0, SEC_TAG_Elastic3d),
00050 E(0), A(0), Iz(0), Iy(0), G(0), J(0),
00051 e(4), eCommit(4)
00052 {
00053 if (code(0) != SECTION_RESPONSE_P)
00054 {
00055 code(0) = SECTION_RESPONSE_P;
00056 code(1) = SECTION_RESPONSE_MZ;
00057 code(2) = SECTION_RESPONSE_MY;
00058 code(3) = SECTION_RESPONSE_T;
00059 }
00060 }
00061
00062 ElasticSection3d::ElasticSection3d
00063 (int tag, double E_in, double A_in, double Iz_in, double Iy_in, double G_in, double J_in)
00064 :SectionForceDeformation(tag, SEC_TAG_Elastic3d),
00065 E(E_in), A(A_in), Iz(Iz_in), Iy(Iy_in), G(G_in), J(J_in),
00066 e(4), eCommit(4)
00067 {
00068 if (E <= 0.0) {
00069 g3ErrorHandler->warning("%s -- Input E <= 0.0 ... setting E to 1.0",
00070 "ElasticSection3d::ElasticSection3d");
00071 E = 1.0;
00072 }
00073
00074 if (A <= 0.0) {
00075 g3ErrorHandler->warning("%s -- Input A <= 0.0 ... setting A to 1.0",
00076 "ElasticSection3d::ElasticSection3d");
00077 A = 1.0;
00078 }
00079
00080 if (Iz <= 0.0) {
00081 g3ErrorHandler->warning("%s -- Input Iz <= 0.0 ... setting Iz to 1.0",
00082 "ElasticSection3d::ElasticSection3d");
00083 Iz = 1.0;
00084 }
00085
00086 if (Iy <= 0.0) {
00087 g3ErrorHandler->warning("%s -- Input Iy <= 0.0 ... setting Iy to 1.0",
00088 "ElasticSection3d::ElasticSection3d");
00089 Iy = 1.0;
00090 }
00091
00092 if (G <= 0.0) {
00093 g3ErrorHandler->warning("%s -- Input G <= 0.0 ... setting G to 1.0",
00094 "ElasticSection3d::ElasticSection3d");
00095 G = 1.0;
00096 }
00097
00098 if (J <= 0.0) {
00099 g3ErrorHandler->warning("%s -- Input J <= 0.0 ... setting J to 1.0",
00100 "ElasticSection3d::ElasticSection3d");
00101 J = 1.0;
00102 }
00103
00104 if (code(0) != SECTION_RESPONSE_P)
00105 {
00106 code(0) = SECTION_RESPONSE_P;
00107 code(1) = SECTION_RESPONSE_MZ;
00108 code(2) = SECTION_RESPONSE_MY;
00109 code(3) = SECTION_RESPONSE_T;
00110 }
00111 }
00112
00113 ElasticSection3d::ElasticSection3d
00114 (int tag, double EA_in, double EIz_in, double EIy_in, double GJ_in)
00115 :SectionForceDeformation(tag, SEC_TAG_Elastic3d),
00116 E(1), A(EA_in), Iz(EIz_in), Iy(EIy_in), G(1), J(GJ_in),
00117 e(4), eCommit(4)
00118 {
00119 if (A <= 0.0) {
00120 g3ErrorHandler->warning("%s -- Input EA <= 0.0 ... setting EA to 1.0",
00121 "ElasticSection3d::ElasticSection3d");
00122 A = 1.0;
00123 }
00124
00125 if (Iz <= 0.0) {
00126 g3ErrorHandler->warning("%s -- Input EIz <= 0.0 ... setting EIz to 1.0",
00127 "ElasticSection3d::ElasticSection3d");
00128 Iz = 1.0;
00129 }
00130
00131 if (Iy <= 0.0) {
00132 g3ErrorHandler->warning("%s -- Input EIy <= 0.0 ... setting EIy to 1.0",
00133 "ElasticSection3d::ElasticSection3d");
00134 Iy = 1.0;
00135 }
00136
00137 if (J <= 0.0) {
00138 g3ErrorHandler->warning("%s -- Input GJ <= 0.0 ... setting GJ to 1.0",
00139 "ElasticSection3d::ElasticSection3d");
00140 J = 1.0;
00141 }
00142
00143 if (code(0) != SECTION_RESPONSE_P)
00144 {
00145 code(0) = SECTION_RESPONSE_P;
00146 code(1) = SECTION_RESPONSE_MZ;
00147 code(2) = SECTION_RESPONSE_MY;
00148 code(3) = SECTION_RESPONSE_T;
00149 }
00150 }
00151
00152 ElasticSection3d::~ElasticSection3d(void)
00153 {
00154
00155 }
00156
00157 int
00158 ElasticSection3d::commitState(void)
00159 {
00160 eCommit = e;
00161
00162 return 0;
00163 }
00164
00165 int
00166 ElasticSection3d::revertToLastCommit(void)
00167 {
00168 e = eCommit;
00169
00170 return 0;
00171 }
00172
00173 int
00174 ElasticSection3d::revertToStart(void)
00175 {
00176 eCommit.Zero();
00177
00178 return 0;
00179 }
00180
00181 int
00182 ElasticSection3d::setTrialSectionDeformation (const Vector &def)
00183 {
00184 e = def;
00185
00186 return 0;
00187 }
00188
00189 const Vector &
00190 ElasticSection3d::getSectionDeformation (void)
00191 {
00192 return e;
00193 }
00194
00195 const Vector &
00196 ElasticSection3d::getStressResultant (void)
00197 {
00198 static Vector s(4);
00199
00200 s(0) = E*A*e(0);
00201 s(1) = E*Iz*e(1);
00202 s(2) = E*Iy*e(2);
00203 s(3) = G*J*e(3);
00204
00205 return s;
00206 }
00207
00208 const Matrix &
00209 ElasticSection3d::getSectionTangent(void)
00210 {
00211 static Matrix ks(4,4);
00212
00213 ks(0,0) = E*A;
00214 ks(1,1) = E*Iz;
00215 ks(2,2) = E*Iy;
00216 ks(3,3) = G*J;
00217
00218 return ks;
00219 }
00220
00221 const Matrix &
00222 ElasticSection3d::getSectionFlexibility (void)
00223 {
00224 static Matrix fs(4,4);
00225
00226 fs(0,0) = 1.0/(E*A);
00227 fs(1,1) = 1.0/(E*Iz);
00228 fs(2,2) = 1.0/(E*Iy);
00229 fs(3,3) = 1.0/(G*J);
00230
00231 return fs;
00232 }
00233
00234 SectionForceDeformation*
00235 ElasticSection3d::getCopy ()
00236 {
00237
00238 ElasticSection3d *theCopy =
00239 new ElasticSection3d (this->getTag(), E, A, Iz, Iy, G, J);
00240
00241 theCopy->eCommit = eCommit;
00242
00243 return theCopy;
00244 }
00245
00246 const ID&
00247 ElasticSection3d::getType () const
00248 {
00249 return code;
00250 }
00251
00252 int
00253 ElasticSection3d::getOrder () const
00254 {
00255 return 4;
00256 }
00257
00258 int
00259 ElasticSection3d::sendSelf(int commitTag, Channel &theChannel)
00260 {
00261 int res = 0;
00262
00263 static Vector data(11);
00264
00265 int dataTag = this->getDbTag();
00266
00267 data(0) = this->getTag();
00268 data(1) = E;
00269 data(2) = A;
00270 data(3) = Iz;
00271 data(4) = Iy;
00272 data(5) = G;
00273 data(6) = J;
00274 data(7) = eCommit(0);
00275 data(8) = eCommit(1);
00276 data(9) = eCommit(2);
00277 data(10) = eCommit(3);
00278
00279 res += theChannel.sendVector(dataTag, commitTag, data);
00280 if(res < 0) {
00281 g3ErrorHandler->warning("%s -- failed to send data",
00282 "ElasticSection3d::sendSelf");
00283 return res;
00284 }
00285
00286 return res;
00287 }
00288
00289 int
00290 ElasticSection3d::recvSelf(int commitTag, Channel &theChannel,
00291 FEM_ObjectBroker &theBroker)
00292 {
00293 int res = 0;
00294
00295 static Vector data(11);
00296
00297 int dataTag = this->getDbTag();
00298
00299 res += theChannel.recvVector(dataTag, commitTag, data);
00300 if(res < 0) {
00301 g3ErrorHandler->warning("%s -- failed to receive data",
00302 "ElasticSection3d::recvSelf");
00303 return res;
00304 }
00305
00306 this->setTag((int)data(0));
00307 E = data(1);
00308 A = data(2);
00309 Iz = data(3);
00310 Iy = data(4);
00311 G = data(5);
00312 J = data(6);
00313 eCommit(0) = data(7);
00314 eCommit(1) = data(8);
00315 eCommit(2) = data(9);
00316 eCommit(3) = data(10);
00317
00318 return res;
00319 }
00320
00321 void
00322 ElasticSection3d::Print(ostream &s, int flag)
00323 {
00324 s << "ElasticSection3d, tag: " << this->getTag() << endl;
00325 s << "\t E: " << E << endl;
00326 s << "\t A: " << A << endl;
00327 s << "\tIz: " << Iz << endl;
00328 s << "\tIy: " << Iy << endl;
00329 s << "\t G: " << G << endl;
00330 s << "\t J: " << J << endl;
00331 }