PolynomialMaterialLaw3d.cpp
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 "PolynomialMaterialLaw3d.hpp"
00037
00038 double PolynomialMaterialLaw3d::Get_dW_dI1(double I1, double I2)
00039 {
00040 double ret = 0.0;
00041
00042
00043
00044 for (int p=1; p<=(int)mN; p++)
00045 {
00046 for (int q=0; q<=(int)mN-p; q++)
00047 {
00048 ret += mAlpha[p][q] * p * pow(I1-3,p-1) * pow(I2-3,q);
00049 }
00050 }
00051
00052 return ret;
00053 }
00054
00055 double PolynomialMaterialLaw3d::Get_dW_dI2(double I1, double I2)
00056 {
00057 double ret = 0.0;
00058
00059
00060
00061 for (int p=0; p<=(int)mN; p++)
00062 {
00063 for (int q=1; q<=(int)mN-p; q++)
00064 {
00065 ret += mAlpha[p][q] * q * pow(I1-3,p) * pow(I2-3,q-1);
00066 }
00067 }
00068 return ret;
00069 }
00070
00071 double PolynomialMaterialLaw3d::Get_d2W_dI1(double I1, double I2)
00072 {
00073 double ret = 0.0;
00074
00075
00076
00077
00078 for (int p=2; p<=(int)mN; p++)
00079 {
00080 for (int q=0; q<=(int)mN-p; q++)
00081 {
00082 ret += mAlpha[p][q] * p * (p-1) * pow(I1-3,(p-1)*(p-2)) * pow((double)I2-3,(double)q);
00083 }
00084 }
00085 return ret;
00086 }
00087
00088 double PolynomialMaterialLaw3d::Get_d2W_dI2(double I1, double I2)
00089 {
00090 double ret = 0.0;
00091
00092
00093
00094
00095 for (int p=0; p<=(int)mN; p++)
00096 {
00097 for (int q=2; q<=(int)mN-p; q++)
00098 {
00099 ret += mAlpha[p][q] * q * (q-1) * pow((double)I1-3,(double)p) * pow(I2-3,(q-1)*(q-2));
00100 }
00101 }
00102 return ret;
00103 }
00104
00105 double PolynomialMaterialLaw3d::Get_d2W_dI1I2(double I1, double I2)
00106 {
00107 double ret = 0.0;
00108
00109
00110
00111
00112 for (int p=1; p<=(int)mN; p++)
00113 {
00114 for (int q=1; q<=(int)mN-p; q++)
00115 {
00116 ret += mAlpha[p][q] * p * q * pow(I1-3,p-1) * pow(I2-3,q-1);
00117 }
00118 }
00119 return ret;
00120 }
00121
00122 double PolynomialMaterialLaw3d::GetAlpha(unsigned i, unsigned j)
00123 {
00124 assert(i+j > 0);
00125 assert(i+j <= mN);
00126
00127 return mAlpha[i][j];
00128 }
00129
00130 PolynomialMaterialLaw3d::PolynomialMaterialLaw3d(unsigned n, std::vector<std::vector<double> > alpha)
00131 {
00132 if (n==0)
00133 {
00134 EXCEPTION("n must be positive");
00135 }
00136
00137 mN = n;
00138
00139
00140 for (unsigned p=0; p<=mN; p++)
00141 {
00142 if (alpha[p].size() < mN+1-p)
00143 {
00144 EXCEPTION("alpha not big enough");
00145 }
00146
00147 for (unsigned q=0; q<alpha[p].size(); q++)
00148 {
00149 if ((p+q>mN) && (fabs(alpha[p][q]) > 1e-12))
00150 {
00151 EXCEPTION("alpha[" << p << "][" << q << "] should be zero, as p+q > " << n);
00152 }
00153 }
00154 }
00155
00156 mAlpha = alpha;
00157 }
00158
00159 std::vector<std::vector<double> > PolynomialMaterialLaw3d::GetZeroedAlpha(unsigned n)
00160 {
00161 std::vector<std::vector<double> > alpha(n+1);
00162
00163 for (unsigned i=0; i<n+1; i++)
00164 {
00165 alpha[i].resize(n+1);
00166 for (unsigned j=0; j<n+1; j++)
00167 {
00168 alpha[i][j] = 0.0;
00169 }
00170 }
00171
00172 return alpha;
00173 }