AbstractIncompressibleMaterialLaw.cpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2009
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 "AbstractIncompressibleMaterialLaw.hpp"
00030 
00031 template<unsigned DIM>
00032 AbstractIncompressibleMaterialLaw<DIM>::~AbstractIncompressibleMaterialLaw()
00033 {
00034 }
00035 
00036 template<unsigned DIM>
00037 void AbstractIncompressibleMaterialLaw<DIM>::ComputeCauchyStress(c_matrix<double,DIM,DIM>& F, double pressure, c_matrix<double,DIM,DIM>& sigma)
00038 {
00039     double detF = Determinant(F);
00040 
00041     c_matrix<double,DIM,DIM> C = prod(trans(F),F);
00042     c_matrix<double,DIM,DIM> invC = Inverse(C);
00043 
00044     c_matrix<double,DIM,DIM> T;
00045 
00046     static FourthOrderTensor2<DIM> dTdE; // not filled in, made static for efficiency
00047 
00048     ComputeStressAndStressDerivative(C,invC,pressure,T,dTdE,false);
00049 
00050     // looping it probably more eficient then doing sigma = (1/detF)F*T*transpose(F)
00051     // which doesn't seem to compile anyway, as F is a Tensor<2,DIM> and T is a
00052     // SymmetricTensor<2,DIM>
00053     for (unsigned i=0; i<DIM; i++)
00054     {
00055         for (unsigned j=0; j<DIM; j++)
00056         {
00057             sigma(i,j) = 0.0;
00058             for (unsigned M=0; M<DIM; M++)
00059             {
00060                 for (unsigned N=0; N<DIM; N++)
00061                 {
00062                     sigma(i,j) += F(i,M)*T(M,N)*F(j,N);
00063                 }
00064             }
00065             sigma(i,j) /= detF;
00066         }
00067     }
00068 }
00069 
00070 template<unsigned DIM>
00071 void AbstractIncompressibleMaterialLaw<DIM>::Compute1stPiolaKirchoffStress(c_matrix<double,DIM,DIM>& F, double pressure, c_matrix<double,DIM,DIM>& S)
00072 {
00073     c_matrix<double,DIM,DIM> C = prod(trans(F),F);
00074     c_matrix<double,DIM,DIM> invC = Inverse(C);
00075 
00076     c_matrix<double,DIM,DIM> T;
00077 
00078     static FourthOrderTensor2<DIM> dTdE; // not filled in, made static for efficiency
00079 
00080     ComputeStressAndStressDerivative(C,invC,pressure,T,dTdE,false);
00081 
00082     S = prod(T,trans(F));
00083 }
00084 
00085 template<unsigned DIM>
00086 void AbstractIncompressibleMaterialLaw<DIM>::Compute2ndPiolaKirchoffStress(c_matrix<double,DIM,DIM>& C, double pressure, c_matrix<double,DIM,DIM>& T)
00087 {
00088     c_matrix<double,DIM,DIM> invC = Inverse(C);
00089 
00090     static FourthOrderTensor2<DIM> dTdE; // not filled in, made static for efficiency
00091 
00092     ComputeStressAndStressDerivative(C,invC,pressure,T,dTdE,false);
00093 }
00094 
00095 template<unsigned DIM>
00096 void AbstractIncompressibleMaterialLaw<DIM>::ScaleMaterialParameters(double scaleFactor)
00097 {
00098     #define COVERAGE_IGNORE
00099     EXCEPTION("[the material law you are using]::ScaleMaterialParameters() has not been implemented\n");
00100     #undef COVERAGE_IGNORE
00101 }
00102 
00103 
00105 // Explicit instantiation
00107 
00108 //template class AbstractIncompressibleMaterialLaw<1>;
00109 template class AbstractIncompressibleMaterialLaw<2>;
00110 template class AbstractIncompressibleMaterialLaw<3>;

Generated on Wed Mar 18 12:51:56 2009 for Chaste by  doxygen 1.5.5