00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "AbstractMaterialLaw.hpp"
00030
00031 template<unsigned DIM>
00032 AbstractMaterialLaw<DIM>::AbstractMaterialLaw()
00033 : mpChangeOfBasisMatrix(NULL)
00034 {
00035 }
00036
00037 template<unsigned DIM>
00038 void AbstractMaterialLaw<DIM>::ComputeCauchyStress(c_matrix<double,DIM,DIM>& rF,
00039 double pressure,
00040 c_matrix<double,DIM,DIM>& rSigma)
00041 {
00042 double detF = Determinant(rF);
00043
00044 c_matrix<double,DIM,DIM> C = prod(trans(rF), rF);
00045 c_matrix<double,DIM,DIM> invC = Inverse(C);
00046
00047 c_matrix<double,DIM,DIM> T;
00048
00049 static FourthOrderTensor<DIM,DIM,DIM,DIM> dTdE;
00050
00051 ComputeStressAndStressDerivative(C, invC, pressure, T, dTdE, false);
00052
00053
00054
00055
00056
00057
00058 for (unsigned i=0; i<DIM; i++)
00059 {
00060 for (unsigned j=0; j<DIM; j++)
00061 {
00062 rSigma(i,j) = 0.0;
00063 for (unsigned M=0; M<DIM; M++)
00064 {
00065 for (unsigned N=0; N<DIM; N++)
00066 {
00067 rSigma(i,j) += rF(i,M)*T(M,N)*rF(j,N);
00068 }
00069 }
00070 rSigma(i,j) /= detF;
00071 }
00072 }
00073 }
00074
00075 template<unsigned DIM>
00076 void AbstractMaterialLaw<DIM>::Compute1stPiolaKirchoffStress(c_matrix<double,DIM,DIM>& rF,
00077 double pressure,
00078 c_matrix<double,DIM,DIM>& rS)
00079 {
00080 c_matrix<double,DIM,DIM> C = prod(trans(rF), rF);
00081 c_matrix<double,DIM,DIM> invC = Inverse(C);
00082
00083 c_matrix<double,DIM,DIM> T;
00084
00085 static FourthOrderTensor<DIM,DIM,DIM,DIM> dTdE;
00086
00087 ComputeStressAndStressDerivative(C, invC, pressure, T, dTdE, false);
00088
00089 rS = prod(T, trans(rF));
00090 }
00091
00092 template<unsigned DIM>
00093 void AbstractMaterialLaw<DIM>::Compute2ndPiolaKirchoffStress(c_matrix<double,DIM,DIM>& rC,
00094 double pressure,
00095 c_matrix<double,DIM,DIM>& rT)
00096 {
00097 c_matrix<double,DIM,DIM> invC = Inverse(rC);
00098
00099 static FourthOrderTensor<DIM,DIM,DIM,DIM> dTdE;
00100
00101 ComputeStressAndStressDerivative(rC, invC, pressure, rT, dTdE, false);
00102 }
00103
00104 template<unsigned DIM>
00105 void AbstractMaterialLaw<DIM>::ScaleMaterialParameters(double scaleFactor)
00106 {
00107 #define COVERAGE_IGNORE
00108 EXCEPTION("[the material law you are using]::ScaleMaterialParameters() has not been implemented\n");
00109 #undef COVERAGE_IGNORE
00110 }
00111
00112 template<unsigned DIM>
00113 void AbstractMaterialLaw<DIM>::SetChangeOfBasisMatrix(c_matrix<double,DIM,DIM>& rChangeOfBasisMatrix)
00114 {
00115 mpChangeOfBasisMatrix = &rChangeOfBasisMatrix;
00116 }
00117
00118 template<unsigned DIM>
00119 void AbstractMaterialLaw<DIM>::ResetToNoChangeOfBasisMatrix()
00120 {
00121 mpChangeOfBasisMatrix = NULL;
00122 }
00123
00124 template<unsigned DIM>
00125 void AbstractMaterialLaw<DIM>::ComputeTransformedDeformationTensor(c_matrix<double,DIM,DIM>& rC, c_matrix<double,DIM,DIM>& rInvC,
00126 c_matrix<double,DIM,DIM>& rCTransformed, c_matrix<double,DIM,DIM>& rInvCTransformed)
00127 {
00128
00129
00130
00131
00132 if (mpChangeOfBasisMatrix)
00133 {
00134
00135 rCTransformed = prod(trans(*mpChangeOfBasisMatrix),(c_matrix<double,DIM,DIM>)prod(rC,*mpChangeOfBasisMatrix));
00136 rInvCTransformed = prod(trans(*mpChangeOfBasisMatrix),(c_matrix<double,DIM,DIM>)prod(rInvC,*mpChangeOfBasisMatrix));
00137 }
00138 else
00139 {
00140 rCTransformed = rC;
00141 rInvCTransformed = rInvC;
00142 }
00143 }
00144
00145 template<unsigned DIM>
00146 void AbstractMaterialLaw<DIM>::TransformStressAndStressDerivative(c_matrix<double,DIM,DIM>& rT,
00147 FourthOrderTensor<DIM,DIM,DIM,DIM>& rDTdE,
00148 bool transformDTdE)
00149 {
00150
00151 if (mpChangeOfBasisMatrix)
00152 {
00153 static c_matrix<double,DIM,DIM> T_transformed_times_Ptrans;
00154 T_transformed_times_Ptrans = prod(rT, trans(*mpChangeOfBasisMatrix));
00155
00156 rT = prod(*mpChangeOfBasisMatrix, T_transformed_times_Ptrans);
00157
00158
00159 if (transformDTdE)
00160 {
00161 static FourthOrderTensor<DIM,DIM,DIM,DIM> temp;
00162 temp.template SetAsContractionOnFirstDimension<DIM>(*mpChangeOfBasisMatrix, rDTdE);
00163 rDTdE.template SetAsContractionOnSecondDimension<DIM>(*mpChangeOfBasisMatrix, temp);
00164 temp.template SetAsContractionOnThirdDimension<DIM>(*mpChangeOfBasisMatrix, rDTdE);
00165 rDTdE.template SetAsContractionOnFourthDimension<DIM>(*mpChangeOfBasisMatrix, temp);
00166 }
00167 }
00168 }
00169
00171
00173
00174
00175 template class AbstractMaterialLaw<2>;
00176 template class AbstractMaterialLaw<3>;