NeoHookeanCompressible3D.cpp

Go to the documentation of this file.
00001 //===============================================================================
00002 
00003 //# COPYRIGHT (C): Woody's license (by BJ):
00004 
00005 //                 ``This    source  code is Copyrighted in
00006 
00007 //                 U.S.,  for  an  indefinite  period,  and anybody
00008 
00009 //                 caught  using it without our permission, will be
00010 
00011 //                 mighty good friends of ourn, cause we don't give
00012 
00013 //                 a  darn.  Hack it. Compile it. Debug it. Run it.
00014 
00015 //                 Yodel  it.  Enjoy it. We wrote it, that's all we
00016 
00017 //                 wanted to do.''
00018 
00019 //
00020 
00021 //# PROJECT:           Object Oriented Finite Element Program
00022 
00023 //# PURPOSE:           Finite Deformation Hyper-Elastic classes
00024 
00025 //# CLASS:
00026 
00027 //#
00028 
00029 //# VERSION:           0.6_(1803398874989) (golden section)
00030 
00031 //# LANGUAGE:          C++
00032 
00033 //# TARGET OS:         all...
00034 
00035 //# DESIGN:            Zhao Cheng, Boris Jeremic (jeremic@ucdavis.edu)
00036 
00037 //# PROGRAMMER(S):     Zhao Cheng, Boris Jeremic
00038 
00039 //#
00040 
00041 //#
00042 
00043 //# DATE:              July 2004
00044 
00045 //# UPDATE HISTORY:
00046 
00047 //#
00048 
00049 //===============================================================================
00050 
00051 
00052 
00053 // the traditional neo-Hookean hyperelasticity:
00054 
00055 // w = 0.5*lambda*(lnJ)^2 - G*(lnJ) + 0.5*G*(trace(C)-3)
00056 
00057 
00058 
00059 #include <NeoHookeanCompressible3D.h>
00060 
00061 
00062 
00063 stresstensor NeoHookeanCompressible3D::static_NHC_stress;
00064 
00065 
00066 
00067 //-----------------------------------------------------------------------------------------------------------------------------------------------
00068 
00069 NeoHookeanCompressible3D::NeoHookeanCompressible3D(int tag,
00070 
00071                                                    int classTag,
00072 
00073                                                    double K_in,
00074 
00075                                                    double G_in,
00076 
00077                                                    double rho_in = 0.0)
00078 
00079 :FiniteDeformationElastic3D(tag, classTag, rho_in), K(K_in), G(G_in)
00080 
00081 {
00082 
00083 
00084 
00085 }
00086 
00087 
00088 
00089 //-----------------------------------------------------------------------------------------------------------------------------------------------
00090 
00091 NeoHookeanCompressible3D::NeoHookeanCompressible3D(int tag,
00092 
00093                                                double K_in,
00094 
00095                                                double G_in,
00096 
00097                                                    double rho_in = 0.0)
00098 
00099 :FiniteDeformationElastic3D(tag, ND_TAG_NeoHookeanCompressible3D, rho_in), K(K_in), G(G_in)
00100 
00101 {
00102 
00103 
00104 
00105 }
00106 
00107 
00108 
00109 //------------------------------------------------------------------------------------------------------------------------------------------------
00110 
00111 NeoHookeanCompressible3D::NeoHookeanCompressible3D( )
00112 
00113 :FiniteDeformationElastic3D(0, 0, 0.0), K(0.0), G(0.0)
00114 
00115 {
00116 
00117 
00118 
00119 }
00120 
00121 
00122 
00123 //------------------------------------------------------------------------------------------------------------------------------------------------
00124 
00125 NeoHookeanCompressible3D::~NeoHookeanCompressible3D()
00126 
00127 {
00128 
00129 
00130 
00131 }
00132 
00133 
00134 
00135 //-------------------------------------------------------------------------------------------------------------------------------------------------
00136 
00137 double NeoHookeanCompressible3D::getRho(void)
00138 
00139 {
00140 
00141    return rho;
00142 
00143 }
00144 
00145 
00146 
00147 //--------------------------------------------------------------------------------------------------------------------------------------------------
00148 
00149 int NeoHookeanCompressible3D::setTrialF(const straintensor &f)
00150 
00151 {
00152 
00153    FromForC = 0;
00154 
00155    F = f;
00156 
00157    C = F("ki")*F("kj");   C.null_indices();
00158 
00159    return this->ComputeTrials();
00160 
00161 }
00162 
00163 
00164 
00165 //---------------------------------------------------------------------------------------------------------------------------------------------------
00166 
00167 int NeoHookeanCompressible3D::setTrialFIncr(const straintensor &df)
00168 
00169 {
00170 
00171    return this->setTrialF(this->getF() + df);
00172 
00173 }
00174 
00175 
00176 
00177 //---------------------------------------------------------------------------------------------------------------------------------------------------
00178 
00179 int NeoHookeanCompressible3D::setTrialC(const straintensor &c)
00180 
00181 {
00182 
00183    FromForC = 1;
00184 
00185    C = c;
00186 
00187    return this->ComputeTrials();
00188 
00189 }
00190 
00191 
00192 
00193 //---------------------------------------------------------------------------------------------------------------------------------------------------
00194 
00195 int NeoHookeanCompressible3D::setTrialCIncr(const straintensor &dc)
00196 
00197 {
00198 
00199    return this->setTrialC(this->getC() + dc);
00200 
00201 }
00202 
00203 
00204 
00205 //-----------------------------------------------------------------------------------------------------------------------------------------------------
00206 
00207 const straintensor& NeoHookeanCompressible3D::getF(void)
00208 
00209 {
00210 
00211    return F;
00212 
00213 }
00214 
00215 
00216 
00217 //-----------------------------------------------------------------------------------------------------------------------------------------------------
00218 
00219 const straintensor& NeoHookeanCompressible3D::getC(void)
00220 
00221 {
00222 
00223    return C;
00224 
00225 }
00226 
00227 
00228 
00230 
00231 //const double NeoHookeanCompressible3D::getJ(void)
00232 
00233 //{
00234 
00235 //   return J;
00236 
00237 //}
00238 
00239 
00240 
00241 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00242 
00243 const Tensor& NeoHookeanCompressible3D::getTangentTensor(void)
00244 
00245 {
00246 
00247     return Stiffness;
00248 
00249 }
00250 
00251 
00252 
00253 //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00254 
00255 const Tensor
00256 
00257 &NeoHookeanCompressible3D::getInitialTangentTensor(void)
00258 
00259 {
00260 
00261     return this->getTangentTensor();
00262 
00263 }
00264 
00265 
00266 
00267 //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00268 
00269 const straintensor& NeoHookeanCompressible3D::getStrainTensor(void)
00270 
00271 {
00272 
00273    return thisGreenStrain;
00274 
00275 }
00276 
00277 
00278 
00279 //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00280 
00281 const stresstensor& NeoHookeanCompressible3D::getStressTensor(void)
00282 
00283 {
00284 
00285    return thisPK2Stress;
00286 
00287 }
00288 
00289 
00290 
00291 //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00292 
00293 const stresstensor& NeoHookeanCompressible3D::getPK1StressTensor(void)
00294 
00295 {
00296 
00297    stresstensor thisSPKStress;
00298 
00299 
00300 
00301    if ( FromForC == 0 ) {
00302 
00303     thisSPKStress = this->getStressTensor();
00304 
00305     static_NHC_stress = F("kJ") * thisSPKStress("IJ");
00306 
00307    }
00308 
00309 
00310 
00311    if ( FromForC == 1 ) {
00312 
00313     opserr << "NeoHookeanCompressible3D: unknown deformation gradient - cannot compute PK1 stress" << "\n";
00314 
00315     exit (-1);
00316 
00317    }
00318 
00319 
00320 
00321     return NeoHookeanCompressible3D::static_NHC_stress;
00322 
00323 }
00324 
00325 
00326 
00327 //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00328 
00329 const stresstensor& NeoHookeanCompressible3D::getCauchyStressTensor(void)
00330 
00331 {
00332 
00333    stresstensor thisSPKStress;
00334 
00335 
00336 
00337    if ( FromForC == 0 ) {
00338 
00339     thisSPKStress = this->getStressTensor();
00340 
00341     static_NHC_stress = F("iJ") * thisSPKStress("JK"); 
00342 
00343     static_NHC_stress = static_NHC_stress("iK") * F("mK");
00344 
00345     static_NHC_stress = static_NHC_stress *(1.0/J);
00346 
00347    }
00348 
00349 
00350 
00351    if ( FromForC == 1 ) {
00352 
00353     opserr << "NeoHookeanCompressible3D: unknown deformation gradient - cannot compute Cauchy stress" << "\n";
00354 
00355     exit (-1);
00356 
00357    }
00358 
00359 
00360 
00361     return NeoHookeanCompressible3D::static_NHC_stress;
00362 
00363 }
00364 
00365 
00366 
00367 //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00368 
00369 int NeoHookeanCompressible3D::commitState (void)
00370 
00371 {
00372 
00373    return 0;
00374 
00375 }
00376 
00377 
00378 
00379 //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00380 
00381 int NeoHookeanCompressible3D::revertToLastCommit (void)
00382 
00383 {
00384 
00385    return 0;
00386 
00387 }
00388 
00389 
00390 
00391 //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00392 
00393 int NeoHookeanCompressible3D::revertToStart (void)
00394 
00395 {
00396 
00397    tensor F0("I", 2, def_dim_2);
00398 
00399    F = F0;
00400 
00401    C = F0;
00402 
00403    Cinv = F0;
00404 
00405    J = 1.0;
00406 
00407 
00408 
00409    tensor ss_zero(2,def_dim_2,0.0);
00410 
00411    thisPK2Stress = ss_zero;
00412 
00413    thisGreenStrain = ss_zero;
00414 
00415    
00416 
00417    Stiffness = getInitialTangentTensor();
00418 
00419 
00420 
00421    return 0;
00422 
00423 }
00424 
00425 
00426 
00427 //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00428 
00429 NDMaterial * NeoHookeanCompressible3D::getCopy (void)
00430 
00431 {
00432 
00433     NeoHookeanCompressible3D   *theCopy =
00434 
00435     new NeoHookeanCompressible3D (this->getTag(), K, G, rho);
00436 
00437 
00438 
00439     theCopy->F = F;
00440 
00441     theCopy->C = C;
00442 
00443     theCopy->Cinv = Cinv;
00444 
00445     theCopy->J = J;
00446 
00447 
00448 
00449     theCopy->Stiffness = Stiffness;
00450 
00451     theCopy->thisGreenStrain = thisGreenStrain;
00452 
00453     theCopy->thisPK2Stress = thisPK2Stress;
00454 
00455 
00456 
00457     return theCopy;
00458 
00459 }
00460 
00461 
00462 
00463 //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00464 
00465 NDMaterial * NeoHookeanCompressible3D::getCopy (const char *type)
00466 
00467 {
00468 
00469    opserr << "NeoHookeanCompressible3D::getCopy(const char *) - not yet implemented\n";
00470 
00471    return 0;
00472 
00473 }
00474 
00475 
00476 
00477 //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00478 
00479 const char* NeoHookeanCompressible3D::getType (void) const
00480 
00481 {
00482 
00483    return "ThreeDimentionalFD";
00484 
00485 }
00486 
00487 
00488 
00490 
00491 //int NeoHookeanCompressible3D::getOrder (void) const
00492 
00493 //{
00494 
00495 //   return 6;
00496 
00497 //}
00498 
00499 
00500 
00501 //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00502 
00503 int NeoHookeanCompressible3D::sendSelf (int commitTag, Channel &theChannel)
00504 
00505 {
00506 
00507    int res = 0;
00508 
00509    // not yet implemented
00510 
00511    return res;
00512 
00513 }
00514 
00515 
00516 
00517 //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00518 
00519 int NeoHookeanCompressible3D::recvSelf (int commitTag,
00520 
00521                                           Channel &theChannel,
00522 
00523                                           FEM_ObjectBroker &theBroker)
00524 
00525 {
00526 
00527    int res = 0;
00528 
00529    // not yet implemented
00530 
00531    return res;
00532 
00533 }
00534 
00535 
00536 
00537 //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00538 
00539 void NeoHookeanCompressible3D::Print (OPS_Stream &s, int flag)
00540 
00541 {
00542 
00543    s << "Finite Deformation Elastic 3D model" << "\n";
00544 
00545    s << "\trho: " << rho << "\n";
00546 
00547    s << "\tK: " << K << "\n";
00548 
00549    s << "\tG: " << G << "\n";
00550 
00551    return;
00552 
00553 }
00554 
00555 
00556 
00557 //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00558 
00559 //int NeoHookeanCompressible3D::setParameter(char **argv, int argc, Information &info)
00560 
00561 //{
00562 
00563 //   return -1;
00564 
00565 //}
00566 
00567 
00568 
00569 //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00570 
00571 //int NeoHookeanCompressible3D::updateParameter(int parameterID, Information &info)
00572 
00573 //{
00574 
00575 //   return -1;
00576 
00577 //}
00578 
00579 
00580 
00581 //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
00582 
00583 int NeoHookeanCompressible3D::ComputeTrials()
00584 
00585 {   
00586 
00587    tensor tensorI2("I", 2, def_dim_2);
00588 
00589    tensor tsr1;
00590 
00591    tensor tsr2;
00592 
00593 
00594 
00595    // Cinv:
00596 
00597    Cinv = C.inverse();
00598 
00599    Cinv.symmetrize11();
00600 
00601 
00602 
00603    // J:
00604 
00605    J = sqrt(C.determinant());
00606 
00607 
00608 
00609    // lame constants:
00610 
00611    double lambda = K - 2.0*G/3.0;
00612 
00613    double mu = G - lambda*log(J);
00614 
00615 
00616 
00617    // Pk2Stress:
00618 
00619    thisPK2Stress = (tensorI2-Cinv)*G + Cinv*lambda*log(J);
00620 
00621    
00622 
00623    // Green Strain:
00624 
00625    thisGreenStrain = (C - tensorI2) * 0.5; 
00626 
00627    
00628 
00629    // Langrangian Tangent Stiffness:
00630 
00631    tsr1 = Cinv("ij")*Cinv("kl");
00632 
00633      tsr1.null_indices();
00634 
00635    tsr2 = tsr1.transpose0110() + tsr1.transpose0111();
00636 
00637    Stiffness = tsr1*lambda + tsr2*mu;
00638 
00639 
00640 
00641    return 0;
00642 
00643 }
00644 
00645 
00646 

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