AbstractMaterialLaw.cpp

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

Generated on Mon Apr 18 11:35:36 2011 for Chaste by  doxygen 1.5.5