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