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 VM_YF_CPP
00035 #define VM_YF_CPP
00036
00037 #include "VM_YF.h"
00038
00039 stresstensor VM_YF::VMst;
00040
00041
00042 VM_YF::VM_YF(int k_which_in, int index_k_in, int alpha_which_in, int index_alpha_in)
00043 : k_which(k_which_in), index_k(index_k_in),
00044 alpha_which(alpha_which_in), index_alpha(index_alpha_in)
00045 {
00046
00047 }
00048
00049
00050 VM_YF::~VM_YF()
00051 {
00052
00053 }
00054
00055
00056 YieldFunction* VM_YF::newObj()
00057 {
00058 YieldFunction *new_YF = new VM_YF(k_which, index_k, alpha_which, index_alpha);
00059
00060 return new_YF;
00061 }
00062
00063
00064 double VM_YF::YieldFunctionValue( const stresstensor &Stre,
00065 const MaterialParameter &MaterialParameter_in ) const
00066 {
00067
00068
00069
00070 if (alpha_which == -1)
00071 return Stre.Jinvariant2()*3.0 - pow(getk(MaterialParameter_in), 2);
00072 if (alpha_which == 2) {
00073 stresstensor s_back = getbackstress(MaterialParameter_in);
00074 stresstensor s_bar = Stre.deviator() - s_back;
00075 double temp2 = ( s_bar("ij") * s_bar("ij") ).trace();
00076 return temp2*1.5 - pow(getk(MaterialParameter_in), 2);
00077 }
00078 else {
00079 opserr << "Warning!! VM_YF: Invalid Input Parameter. " << endln;
00080 exit (1);
00081 }
00082 }
00083
00084
00085 const stresstensor& VM_YF::StressDerivative(const stresstensor &Stre,
00086 const MaterialParameter &MaterialParameter_in) const
00087 {
00088 if (alpha_which == -1) {
00089 VMst = Stre.deviator() *3.0;
00090 return VMst;
00091 }
00092 if (alpha_which == 2) {
00093 stresstensor s_back = getbackstress(MaterialParameter_in);
00094 stresstensor s_bar = Stre.deviator() - s_back;
00095 VMst = s_bar *3.0;
00096 return VMst;
00097 }
00098 else {
00099 opserr << "Warning!! VM_YF: Invalid Input Parameter. " << endln;
00100 exit (1);
00101 }
00102 }
00103
00104
00105 double VM_YF::InScalarDerivative(const stresstensor &Stre,
00106 const MaterialParameter &MaterialParameter_in,
00107 int index_) const
00108 {
00109 if (k_which == 1 && index_ == index_k)
00110 return -2.0*getk(MaterialParameter_in);
00111 else {
00112 opserr << "Warning!! VM_YF: Invalid Input Parameter. " << endln;
00113 exit (1);
00114 }
00115 }
00116
00117
00118 const stresstensor& VM_YF::InTensorDerivative(const stresstensor &Stre,
00119 const MaterialParameter &MaterialParameter_in,
00120 int index_) const
00121 {
00122 if (alpha_which == 2 || index_ == index_alpha) {
00123 stresstensor s_back = getbackstress(MaterialParameter_in);
00124 stresstensor s_bar = Stre.deviator() - s_back;
00125 VMst = s_bar *(-3.0);
00126 return VMst;
00127 }
00128 else {
00129 opserr << "Warning!! VM_YF: Invalid Input Parameter. " << endln;
00130 exit (1);
00131 }
00132 }
00133
00134
00135 int VM_YF::getNumInternalScalar() const
00136 {
00137 if ( k_which == 1)
00138 return 1;
00139 else
00140 return 0;
00141 }
00142
00143
00144 int VM_YF::getNumInternalTensor() const
00145 {
00146 if (alpha_which == 2)
00147 return 1;
00148 else
00149 return 0;
00150 }
00151
00152
00153 int VM_YF::getYieldFunctionRank() const
00154 {
00155 return 2;
00156 }
00157
00158
00159 double VM_YF::getk(const MaterialParameter &MaterialParameter_in) const
00160 {
00161
00162 if ( k_which == 0 && index_k <= MaterialParameter_in.getNum_Material_Parameter() && index_k > 2)
00163 return MaterialParameter_in.getMaterial_Parameter(index_k-1);
00164 else if( k_which == 1 && index_k <= MaterialParameter_in.getNum_Internal_Scalar() && index_k > 0)
00165 return MaterialParameter_in.getInternal_Scalar(index_k-1);
00166 else {
00167 opserr << "Warning!! VM_YF: Invalid Input. " << endln;
00168 exit (1);
00169 }
00170 }
00171
00172
00173 const stresstensor& VM_YF::getbackstress(const MaterialParameter &MaterialParameter_in) const
00174 {
00175
00176 if ( alpha_which == 2 && index_alpha <= MaterialParameter_in.getNum_Internal_Tensor() && index_alpha > 0) {
00177 VMst = MaterialParameter_in.getInternal_Tensor(index_alpha-1);
00178 return VMst;
00179 }
00180 else {
00181 opserr << "Warning!! VM_YF: Invalid Input. " << endln;
00182 exit (1);
00183 }
00184 }
00185
00186
00187 #endif
00188