AbstractIsotropicIncompressibleMaterialLaw.cpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2010
00004 
00005 University of Oxford means the Chancellor, Masters and Scholars of the
00006 University of Oxford, having an administrative office at Wellington
00007 Square, Oxford OX1 2JD, UK.
00008 
00009 This file is part of Chaste.
00010 
00011 Chaste is free software: you can redistribute it and/or modify it
00012 under the terms of the GNU Lesser General Public License as published
00013 by the Free Software Foundation, either version 2.1 of the License, or
00014 (at your option) any later version.
00015 
00016 Chaste is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00019 License for more details. The offer of Chaste under the terms of the
00020 License is subject to the License being interpreted in accordance with
00021 English Law and subject to any action against the University of Oxford
00022 being under the jurisdiction of the English Courts.
00023 
00024 You should have received a copy of the GNU Lesser General Public License
00025 along with Chaste. If not, see <http://www.gnu.org/licenses/>.
00026 
00027 */
00028 
00029 #include "AbstractIsotropicIncompressibleMaterialLaw.hpp"
00030 
00031 template<unsigned DIM>
00032 AbstractIsotropicIncompressibleMaterialLaw<DIM>::~AbstractIsotropicIncompressibleMaterialLaw()
00033 {
00034 }
00035 
00036 template<unsigned DIM>
00037 void AbstractIsotropicIncompressibleMaterialLaw<DIM>::ComputeStressAndStressDerivative(
00038         c_matrix<double,DIM,DIM>& rC,
00039         c_matrix<double,DIM,DIM>& rInvC,
00040         double                    pressure,
00041         c_matrix<double,DIM,DIM>& rT,
00042         FourthOrderTensor<DIM>&   rDTdE,
00043         bool                      computeDTdE)
00044 {
00045     // this is covered, but gcov doesn't see this as being covered
00046     // for some reason, maybe because of optimisations
00047     #define COVERAGE_IGNORE
00048     assert((DIM==2) || (DIM==3));
00049     #undef COVERAGE_IGNORE
00050 
00051     static c_matrix<double,DIM,DIM> identity = identity_matrix<double>(DIM);
00052 
00053     double I1 = Trace(rC);
00054     double I2 = SecondInvariant(rC);
00055 
00056     double  dW_dI1 = Get_dW_dI1(I1, I2);
00057     double  dW_dI2; // only computed if DIM==3
00058 
00059     double  d2W_dI1;
00060     double  d2W_dI2;
00061     double  d2W_dI1I2;
00062 
00063     // Compute stress:
00064     //
00065     //  T = dW_dE
00066     //    = 2 * dI1_dC_MN * dI1_dC_MN   +   2 * dI1_dC_MN * dI1_dC_MN  -  p * invC
00067     //    = 2 * dI1_dC_MN * delta_MN    +   2 * dI1_dC_MN * (I1 delta_MN - C_MN)  -  p * invC
00068 
00069     rT = 2*dW_dI1*identity - pressure*rInvC;
00070     if (DIM==3)
00071     {
00072         dW_dI2 = Get_dW_dI2(I1, I2);
00073         rT += 2*dW_dI2*(I1*identity - rC);
00074     }
00075 
00076     // Compute stress derivative if required:
00077     //
00078     // The stress derivative dT_{MN}/dE_{PQ} can be expanded to be seen to be
00079     //
00080     //  dT_dE =    4 * true_d2WdI1 * dI1_dC_MN * dI1_dC_PQ
00081     //           + 4 * true_dWdI1  * d2I1_dC2
00082     //           + 4 * true_d2WdI2 * dI2_dC_MN * dI2_dC_PQ
00083     //           + 4 * true_dWdI2  * d2I2_dC2
00084     //           + 4 * true_d2WdI1I2 * (dI1_dC_MN*dI2_dC_PQ + dI1_dC_PQ*dI2_dC_MN)
00085     //          - 2 * pressure * d_invC_dC;
00086     //
00087     // where
00088     //   dI1_dC_MN = (M==N); // ie delta_{MN}
00089     //   dI1_dC_PQ = (P==Q);
00090     //   d2I1_dC2  = 0;
00091     //
00092     //   dI2_dC_MN = I1*(M==N)-C[M][N];
00093     //   dI2_dC_PQ = I1*(P==Q)-C[P][Q];
00094     //   d2I2_dC2  = (M==N)*(P==Q)-(M==P)*(N==Q);
00095     //
00096     //   d_invC_dC = -invC[M][P]*invC[Q][N];
00097     if (computeDTdE)
00098     {
00099         d2W_dI1 = Get_d2W_dI1(I1,I2);
00100 
00101         if (DIM==3)
00102         {
00103             d2W_dI2   = Get_d2W_dI2(I1, I2);
00104             d2W_dI1I2 = Get_d2W_dI1I2(I1, I2);
00105         }
00106 
00107         for (unsigned M=0; M<DIM; M++)
00108         {
00109             for (unsigned N=0; N<DIM; N++)
00110             {
00111                 for (unsigned P=0; P<DIM; P++)
00112                 {
00113                     for (unsigned Q=0; Q<DIM; Q++)
00114                     {
00115                         rDTdE(M,N,P,Q) =   4 * d2W_dI1  * (M==N) * (P==Q)
00116                                          + 2 * pressure * rInvC(M,P) * rInvC(Q,N);
00117 
00118                         if (DIM==3)
00119                         {
00120                             rDTdE(M,N,P,Q) +=   4 * d2W_dI2   * (I1*(M==N) - rC(M,N)) * (I1*(P==Q) - rC(P,Q))
00121                                               + 4 * dW_dI2    * ((M==N)*(P==Q) - (M==P)*(N==Q))
00122                                               + 4 * d2W_dI1I2 * ((M==N)*(I1*(P==Q) - rC(P,Q)) + (P==Q)*(I1*(M==N) - rC(M,N)));
00123                         }
00124                     }
00125                 }
00126             }
00127         }
00128     }
00129 }
00130 
00131 template<>
00132 double AbstractIsotropicIncompressibleMaterialLaw<2>::GetZeroStrainPressure()
00133 {
00134     return 2*Get_dW_dI1(2,0);
00135 }
00136 
00137 template<>
00138 double AbstractIsotropicIncompressibleMaterialLaw<3>::GetZeroStrainPressure()
00139 {
00140     return 2*Get_dW_dI1(3,3) + 4*Get_dW_dI2(3,3);
00141 }
00142 
00144 // Explicit instantiation
00146 
00147 template class AbstractIsotropicIncompressibleMaterialLaw<2>;
00148 template class AbstractIsotropicIncompressibleMaterialLaw<3>;

Generated by  doxygen 1.6.2