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 CC_YF_CPP
00035 #define CC_YF_CPP
00036
00037 #include "CC_YF.h"
00038
00039 stresstensor CC_YF::CCst;
00040
00041
00042 CC_YF::CC_YF(int M_which_in, int index_M_in,
00043 int p0_which_in, int index_p0_in)
00044 : M_which(M_which_in), index_M(index_M_in),
00045 p0_which(p0_which_in), index_p0(index_p0_in)
00046 {
00047
00048 }
00049
00050
00051 CC_YF::~CC_YF()
00052 {
00053
00054 }
00055
00056
00057 YieldFunction* CC_YF::newObj()
00058 {
00059 YieldFunction *new_YF = new CC_YF(M_which, index_M, p0_which, index_p0);
00060
00061 return new_YF;
00062 }
00063
00064
00065 double CC_YF::YieldFunctionValue( const stresstensor& Stre,
00066 const MaterialParameter &MaterialParameter_in ) const
00067 {
00068
00069
00070 double M = getM(MaterialParameter_in);
00071 double p0 = getP0(MaterialParameter_in);
00072 double p = Stre.p_hydrostatic();
00073 double q = Stre.q_deviatoric();
00074
00075 return q*q - M*M*p*(p0 - p);
00076 }
00077
00078
00079 const stresstensor& CC_YF::StressDerivative(const stresstensor& Stre,
00080 const MaterialParameter &MaterialParameter_in) const
00081 {
00082 double M = getM(MaterialParameter_in);
00083 double p0 = getP0(MaterialParameter_in);
00084 double p = Stre.p_hydrostatic();
00085 double q = Stre.q_deviatoric();
00086 double dFoverdp = -M*M*( p0 - 2.0*p );
00087 double dFoverdq = 2.0*q;
00088 BJtensor DpoDs = Stre.dpoverds();
00089 if (q != 0.0) {
00090 BJtensor DqoDs = Stre.dqoverds();
00091 CCst = DpoDs *dFoverdp + DqoDs *dFoverdq;
00092 }
00093 else
00094 CCst = DpoDs *dFoverdp;
00095
00096 return CCst;
00097 }
00098
00099
00100 double CC_YF::InScalarDerivative(const stresstensor& Stre,
00101 const MaterialParameter &MaterialParameter_in,
00102 int which) const
00103 {
00104 if (p0_which == 1 && which == index_p0) {
00105 double M = getM(MaterialParameter_in);
00106 double p = Stre.p_hydrostatic();
00107 return (-1.0)*M*M*p;
00108 }
00109 else {
00110 opserr << "Warning!! CC_YF: Invalid Input Parameter. " << endln;
00111 exit (1);
00112 }
00113 }
00114
00115
00116 int CC_YF::getNumInternalScalar() const
00117 {
00118 return 1;
00119 }
00120
00121
00122 int CC_YF::getNumInternalTensor() const
00123 {
00124 return 0;
00125 }
00126
00127
00128 int CC_YF::getYieldFunctionRank() const
00129 {
00130 return 2;
00131 }
00132
00133
00134 double CC_YF::getM(const MaterialParameter &MaterialParameter_in) const
00135 {
00136
00137 if ( M_which == 0 && index_M <= MaterialParameter_in.getNum_Material_Parameter() && index_M > 0 )
00138 return MaterialParameter_in.getMaterial_Parameter(index_M-1);
00139 else {
00140 opserr << "Warning!! CC_YF: Invalid Input (M). " << endln;
00141 exit (1);
00142 }
00143 }
00144
00145
00146 double CC_YF::getP0(const MaterialParameter &MaterialParameter_in) const
00147 {
00148
00149 if ( p0_which == 1 && index_p0 <= MaterialParameter_in.getNum_Internal_Scalar() && index_p0 > 0 )
00150 return MaterialParameter_in.getInternal_Scalar(index_p0-1);
00151 else {
00152 opserr << "Warning!! CC_YF: Invalid Input (po). " << endln;
00153 exit (1);
00154 }
00155 }
00156
00157
00158 #endif
00159