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
00038
00039 template<unsigned DIM>
00040 void AbstractMaterialLaw<DIM>::ComputeCauchyStress(c_matrix<double,DIM,DIM>& rF,
00041 double pressure,
00042 c_matrix<double,DIM,DIM>& rSigma)
00043 {
00044 double detF = Determinant(rF);
00045
00046 c_matrix<double,DIM,DIM> C = prod(trans(rF), rF);
00047 c_matrix<double,DIM,DIM> invC = Inverse(C);
00048
00049 c_matrix<double,DIM,DIM> T;
00050
00051 static FourthOrderTensor<DIM,DIM,DIM,DIM> dTdE;
00052
00053 ComputeStressAndStressDerivative(C, invC, pressure, T, dTdE, false);
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
00113 template<unsigned DIM>
00114 void AbstractMaterialLaw<DIM>::SetChangeOfBasisMatrix(c_matrix<double,DIM,DIM>& rChangeOfBasisMatrix)
00115 {
00116 mpChangeOfBasisMatrix = &rChangeOfBasisMatrix;
00117 }
00118
00119 template<unsigned DIM>
00120 void AbstractMaterialLaw<DIM>::ResetToNoChangeOfBasisMatrix()
00121 {
00122 mpChangeOfBasisMatrix = NULL;
00123 }
00124
00125
00126 template<unsigned DIM>
00127 void AbstractMaterialLaw<DIM>::ComputeTransformedDeformationTensor(c_matrix<double,DIM,DIM>& rC, c_matrix<double,DIM,DIM>& rInvC,
00128 c_matrix<double,DIM,DIM>& rCTransformed, c_matrix<double,DIM,DIM>& rInvCTransformed)
00129 {
00130
00131
00132
00133
00134
00135 if(mpChangeOfBasisMatrix)
00136 {
00137
00138 rCTransformed = prod(trans(*mpChangeOfBasisMatrix),(c_matrix<double,DIM,DIM>)prod(rC,*mpChangeOfBasisMatrix));
00139 rInvCTransformed = prod(trans(*mpChangeOfBasisMatrix),(c_matrix<double,DIM,DIM>)prod(rInvC,*mpChangeOfBasisMatrix));
00140 }
00141 else
00142 {
00143 rCTransformed = rC;
00144 rInvCTransformed = rInvC;
00145 }
00146 }
00147
00148 template<unsigned DIM>
00149 void AbstractMaterialLaw<DIM>::TransformStressAndStressDerivative(c_matrix<double,DIM,DIM>& rT,
00150 FourthOrderTensor<DIM,DIM,DIM,DIM>& rDTdE,
00151 bool transformDTdE)
00152 {
00153
00154 if(mpChangeOfBasisMatrix)
00155 {
00156 static c_matrix<double,DIM,DIM> T_transformed_times_Ptrans;
00157 T_transformed_times_Ptrans = prod(rT, trans(*mpChangeOfBasisMatrix));
00158
00159 rT = prod(*mpChangeOfBasisMatrix, T_transformed_times_Ptrans);
00160
00161
00162 if (transformDTdE)
00163 {
00164 static FourthOrderTensor<DIM,DIM,DIM,DIM> temp;
00165 temp.template SetAsContractionOnFirstDimension<DIM>(*mpChangeOfBasisMatrix, rDTdE);
00166 rDTdE.template SetAsContractionOnSecondDimension<DIM>(*mpChangeOfBasisMatrix, temp);
00167 temp.template SetAsContractionOnThirdDimension<DIM>(*mpChangeOfBasisMatrix, rDTdE);
00168 rDTdE.template SetAsContractionOnFourthDimension<DIM>(*mpChangeOfBasisMatrix, temp);
00169 }
00170 }
00171 }
00172
00173
00174
00175
00177
00179
00180
00181 template class AbstractMaterialLaw<2>;
00182 template class AbstractMaterialLaw<3>;