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
00032
00033
00034 #ifndef RMC_YF_CPP
00035 #define RMC_YF_CPP
00036
00037 #include "RMC_YF.h"
00038
00039 stresstensor RMC_YF::RMCst;
00040
00041
00042 RMC_YF::RMC_YF(int a_which_in, int index_a_in,
00043 int k_which_in, int index_k_in,
00044 int r_which_in, int index_r_in)
00045 : a_which(a_which_in), index_a(index_a_in),
00046 k_which(k_which_in), index_k(index_k_in),
00047 r_which(r_which_in), index_r(index_r_in)
00048 {
00049
00050 }
00051
00052
00053 RMC_YF::~RMC_YF()
00054 {
00055
00056 }
00057
00058
00059 YieldFunction* RMC_YF::newObj()
00060 {
00061 YieldFunction *new_YF = new RMC_YF(a_which, index_a,
00062 k_which, index_k,
00063 r_which, index_r);
00064
00065 return new_YF;
00066 }
00067
00068
00069 double RMC_YF::YieldFunctionValue( const stresstensor& Stre,
00070 const MaterialParameter &MaterialParameter_in ) const
00071 {
00072
00073
00074
00075 double a = geta(MaterialParameter_in);
00076 double k = getk(MaterialParameter_in);
00077 double r = getr(MaterialParameter_in);
00078
00079 double theta = Stre.theta();
00080 double g = RoundedFunction(theta, r);
00081
00082 return Stre.Iinvariant1() *a + sqrt(Stre.Jinvariant2())/g - k;
00083 }
00084
00085
00086 const stresstensor& RMC_YF::StressDerivative(const stresstensor& Stre,
00087 const MaterialParameter &MaterialParameter_in) const
00088 {
00089 double a = geta(MaterialParameter_in);
00090 double r = getr(MaterialParameter_in);
00091
00092 double q = Stre.q_deviatoric();
00093 double theta = Stre.theta();
00094
00095
00096
00097 double f1 = RoundedFunctionf1(theta, r);
00098 double f2 = RoundedFunctionf2(theta, r);
00099 double df1 = RoundedFunctiondf1(theta, r);
00100 double df2 = RoundedFunctiondf2(theta, r);
00101 double dginv = (df2*f1 - df1*f2) /(f1*f1);
00102
00103
00104
00105
00106
00107
00108
00109
00110 double dfodp = -3.0*a;
00111 double dfodq = f1/(f2*sqrt(3.0));
00112 double dfodtheta = dginv*q/sqrt(3.0);
00113
00114 RMCst = Stre.dpoverds() *dfodp + Stre.dqoverds() *dfodq + Stre.dthetaoverds() *dfodtheta;
00115
00116 return RMCst;
00117 }
00118
00119
00120 double RMC_YF::InScalarDerivative(const stresstensor& Stre,
00121 const MaterialParameter &MaterialParameter_in,
00122 int which) const
00123 {
00124 if (a_which == 1 && which == index_a)
00125 return Stre.Iinvariant1();
00126
00127 if (k_which == 1 && which == index_k)
00128 return -1.0;
00129
00130 return 0.0;
00131 }
00132
00133
00134 int RMC_YF::getNumInternalScalar() const
00135 {
00136 int Numyf = 0;
00137
00138 if ( a_which == 1)
00139 Numyf++;
00140
00141 if ( k_which == 1)
00142 Numyf++;
00143
00144 return Numyf;
00145 }
00146
00147
00148 int RMC_YF::getNumInternalTensor() const
00149 {
00150 return 0;
00151 }
00152
00153
00154 int RMC_YF::getYieldFunctionRank() const
00155 {
00156 return 1;
00157 }
00158
00159
00160 double RMC_YF::geta(const MaterialParameter &MaterialParameter_in) const
00161 {
00162
00163 if ( a_which == 0) {
00164 if ( index_a <= MaterialParameter_in.getNum_Material_Parameter() && index_a > 0)
00165 return MaterialParameter_in.getMaterial_Parameter(index_a-1);
00166 else {
00167 opserr << "RMC_YF: Invalid Input. " << endln;
00168 exit (1);
00169 }
00170 }
00171 else if ( a_which == 1) {
00172 if ( index_a <= MaterialParameter_in.getNum_Internal_Scalar() && index_a > 0)
00173 return MaterialParameter_in.getInternal_Scalar(index_a-1);
00174 else {
00175 opserr << "RMC_YF: Invalid Input. " << endln;
00176 exit (1);
00177 }
00178 }
00179 else {
00180 opserr << "RMC_YF: Invalid Input. " << endln;
00181 exit(1);
00182 }
00183 }
00184
00185
00186 double RMC_YF::getk(const MaterialParameter &MaterialParameter_in) const
00187 {
00188
00189 if ( k_which == 0) {
00190 if ( index_k <= MaterialParameter_in.getNum_Material_Parameter() && index_k > 0)
00191 return MaterialParameter_in.getMaterial_Parameter(index_k-1);
00192 else {
00193 opserr << "RMC_YF: Invalid Input. " << endln;
00194 exit (1);
00195 }
00196 }
00197 else if ( k_which == 1) {
00198 if ( index_k <= MaterialParameter_in.getNum_Internal_Scalar() && index_k > 0)
00199 return MaterialParameter_in.getInternal_Scalar(index_k-1);
00200 else {
00201 opserr << "RMC_YF: Invalid Input. " << endln;
00202 exit (1);
00203 }
00204 }
00205 else {
00206 opserr << "RMC_YF: Invalid Input. " << endln;
00207 exit(1);
00208 }
00209 }
00210
00211
00212 double RMC_YF::getr(const MaterialParameter &MaterialParameter_in) const
00213 {
00214
00215 if ( r_which == 0) {
00216 if ( index_r <= MaterialParameter_in.getNum_Material_Parameter() && index_r > 0)
00217 return MaterialParameter_in.getMaterial_Parameter(index_r-1);
00218 else {
00219 opserr << "RMC_YF: Invalid Input. " << endln;
00220 exit (1);
00221 }
00222 }
00223 else if ( r_which == 1) {
00224 if ( index_r <= MaterialParameter_in.getNum_Internal_Scalar() && index_r > 0)
00225 return MaterialParameter_in.getInternal_Scalar(index_r-1);
00226 else {
00227 opserr << "RMC_YF: Invalid Input. " << endln;
00228 exit (1);
00229 }
00230 }
00231 else {
00232 opserr << "RMC_YF: Invalid Input. " << endln;
00233 exit(1);
00234 }
00235 }
00236
00237
00238 double RMC_YF::RoundedFunctionf1(double s, double r) const
00239 {
00240 double t1 = sqrt(-4.0*r + 5.0*r*r + 4.0*(1.0 - r*r)*pow(cos(s),2));
00241 return 2.0*(1.0 - r*r)*cos(s) + (-1.0 + 2.0*r) * t1;
00242 }
00243
00244
00245 double RMC_YF::RoundedFunctionf2(double s, double r) const
00246 {
00247 return pow(-1.0 + 2.0*r,2) + 4.0*(1.0 - r*r)*pow(cos(s),2);
00248 }
00249
00250
00251 double RMC_YF::RoundedFunctiondf1(double s, double r) const
00252 {
00253 double t1 = sqrt(-4.0*r + 5.0*r*r + 4.0*(1 - r*r)*pow(cos(s),2));
00254 return -2.0*(1.0 - r*r)*sin(s) - (4.0*(-1.0 + 2.0*r)*(1 - r*r)*cos(s)*sin(s))/t1;
00255 }
00256
00257
00258 double RMC_YF::RoundedFunctiondf2(double s, double r) const
00259 {
00260 return -8.0*(1 - r*r)*cos(s)*sin(s);
00261 }
00262
00263
00264 double RMC_YF::RoundedFunction(double s, double r) const
00265 {
00266 double f1 = RoundedFunctionf1(s, r);
00267 double f2 = RoundedFunctionf2(s, r);
00268
00269 return f1/f2;
00270 }
00271
00272 #endif