Chaste Release::3.1
|
00001 /* 00002 00003 Copyright (c) 2005-2012, University of Oxford. 00004 All rights reserved. 00005 00006 University of Oxford means the Chancellor, Masters and Scholars of the 00007 University of Oxford, having an administrative office at Wellington 00008 Square, Oxford OX1 2JD, UK. 00009 00010 This file is part of Chaste. 00011 00012 Redistribution and use in source and binary forms, with or without 00013 modification, are permitted provided that the following conditions are met: 00014 * Redistributions of source code must retain the above copyright notice, 00015 this list of conditions and the following disclaimer. 00016 * Redistributions in binary form must reproduce the above copyright notice, 00017 this list of conditions and the following disclaimer in the documentation 00018 and/or other materials provided with the distribution. 00019 * Neither the name of the University of Oxford nor the names of its 00020 contributors may be used to endorse or promote products derived from this 00021 software without specific prior written permission. 00022 00023 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00024 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00025 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00026 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00027 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00028 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 00029 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00030 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00031 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00032 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 00034 */ 00035 00036 #include "AbstractIsotropicIncompressibleMaterialLaw.hpp" 00037 00038 template<unsigned DIM> 00039 AbstractIsotropicIncompressibleMaterialLaw<DIM>::~AbstractIsotropicIncompressibleMaterialLaw() 00040 { 00041 } 00042 00043 template<unsigned DIM> 00044 void AbstractIsotropicIncompressibleMaterialLaw<DIM>::ComputeStressAndStressDerivative( 00045 c_matrix<double,DIM,DIM>& rC, 00046 c_matrix<double,DIM,DIM>& rInvC, 00047 double pressure, 00048 c_matrix<double,DIM,DIM>& rT, 00049 FourthOrderTensor<DIM,DIM,DIM,DIM>& rDTdE, 00050 bool computeDTdE) 00051 { 00052 /* 00053 * This is covered, but gcov doesn't see this as being covered 00054 * for some reason, maybe because of optimisations. 00055 */ 00056 #define COVERAGE_IGNORE 00057 assert((DIM==2) || (DIM==3)); 00058 #undef COVERAGE_IGNORE 00059 00060 static c_matrix<double,DIM,DIM> identity = identity_matrix<double>(DIM); 00061 00062 double I1 = Trace(rC); 00063 double I2 = SecondInvariant(rC); 00064 00065 double w1 = Get_dW_dI1(I1, I2); 00066 double w2; // only computed if DIM==3 00067 00068 // Compute stress: **** See FiniteElementImplementations document. **** 00069 // 00070 // T = dW_dE 00071 // = 2 * w1 * dI1_dC_MN + 2 * w2 * dI1_dC_MN - p * invC 00072 // = 2 * w1 * delta_MN + 2 * w2 * (I1 delta_MN - C_MN) - p * invC 00073 // 00074 // (where w1 = dW/dI1, etc). 00075 00076 rT = 2*w1*identity - pressure*rInvC; 00077 if (DIM==3) 00078 { 00079 w2 = Get_dW_dI2(I1, I2); 00080 rT += 2*w2*(I1*identity - rC); 00081 } 00082 00083 // Compute stress derivative if required: **** See FiniteElementImplementations document. **** 00084 // 00085 // The stress derivative dT_{MN}/dE_{PQ} is 00086 // 00087 // dT_dE = 4 * w11 * dI1_dC_MN * dI1_dC_PQ 00088 // + 4 * w1 * d2I1_dC2 00089 // + 4 * w22 * dI2_dC_MN * dI2_dC_PQ 00090 // + 4 * w2 * d2I2_dC2 00091 // + 4 * w12 * (dI1_dC_MN*dI2_dC_PQ + dI1_dC_PQ*dI2_dC_MN) 00092 // - 2 * pressure * d_invC_dC; 00093 // 00094 // where 00095 // dI1_dC_MN = (M==N); // ie delta_{MN} 00096 // dI1_dC_PQ = (P==Q); 00097 // d2I1_dC2 = 0; 00098 // 00099 // dI2_dC_MN = I1*(M==N)-C[M][N]; 00100 // dI2_dC_PQ = I1*(P==Q)-C[P][Q]; 00101 // d2I2_dC2 = (M==N)*(P==Q)-(M==P)*(N==Q); 00102 // 00103 // d_invC_dC = -invC[M][P]*invC[Q][N]; 00104 // 00105 if (computeDTdE) 00106 { 00107 double w11 = Get_d2W_dI1(I1,I2); 00108 00109 double w12; 00110 double w22; 00111 00112 if (DIM==3) 00113 { 00114 w22 = Get_d2W_dI2(I1, I2); 00115 w12 = Get_d2W_dI1I2(I1, I2); 00116 } 00117 00118 for (unsigned M=0; M<DIM; M++) 00119 { 00120 for (unsigned N=0; N<DIM; N++) 00121 { 00122 for (unsigned P=0; P<DIM; P++) 00123 { 00124 for (unsigned Q=0; Q<DIM; Q++) 00125 { 00126 rDTdE(M,N,P,Q) = 4 * w11 * (M==N) * (P==Q) 00127 + 2 * pressure * rInvC(M,P) * rInvC(Q,N); 00128 00129 if (DIM==3) 00130 { 00131 rDTdE(M,N,P,Q) += 4 * w22 * (I1*(M==N) - rC(M,N)) * (I1*(P==Q) - rC(P,Q)) 00132 + 4 * w2 * ((M==N)*(P==Q) - (M==P)*(N==Q)) 00133 + 4 * w12 * ((M==N)*(I1*(P==Q) - rC(P,Q)) + (P==Q)*(I1*(M==N) - rC(M,N))); 00134 } 00135 } 00136 } 00137 } 00138 } 00139 } 00140 } 00141 00142 template<> 00143 double AbstractIsotropicIncompressibleMaterialLaw<2>::GetZeroStrainPressure() 00144 { 00145 return 2*Get_dW_dI1(2,0); 00146 } 00147 00148 template<> 00149 double AbstractIsotropicIncompressibleMaterialLaw<3>::GetZeroStrainPressure() 00150 { 00151 return 2*Get_dW_dI1(3,3) + 4*Get_dW_dI2(3,3); 00152 } 00153 00155 // Explicit instantiation 00157 00158 template class AbstractIsotropicIncompressibleMaterialLaw<2>; 00159 template class AbstractIsotropicIncompressibleMaterialLaw<3>;