VM_YF.cpp

Go to the documentation of this file.
00001 
00002 //   COPYLEFT (C): Woody's viral GPL-like license (by BJ):
00003 //                 ``This    source  code is Copyrighted in
00004 //                 U.S.,  for  an  indefinite  period,  and anybody
00005 //                 caught  using it without our permission, will be
00006 //                 mighty good friends of ourn, cause we don't give
00007 //                 a  darn.  Hack it. Compile it. Debug it. Run it.
00008 //                 Yodel  it.  Enjoy it. We wrote it, that's all we
00009 //                 wanted to do.''
00010 //
00011 //
00012 // COPYRIGHT (C):     :-))
00013 // PROJECT:           Object Oriented Finite Element Program
00014 // FILE:              
00015 // CLASS:             
00016 // MEMBER FUNCTIONS:
00017 //
00018 // MEMBER VARIABLES
00019 //
00020 // PURPOSE:           
00021 //
00022 // RETURN:
00023 // VERSION:
00024 // LANGUAGE:          C++
00025 // TARGET OS:         
00026 // DESIGNER:          Zhao Cheng, Boris Jeremic
00027 // PROGRAMMER:        Zhao Cheng, 
00028 // DATE:              Fall 2005
00029 // UPDATE HISTORY:    
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         // f = 1.5*(sij-aij)*(sij-aij) - k*k = 0
00068         // or f = 3.0*J2^2 - k*k = 0
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         // to get k
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         //to get backstress
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 

Generated on Mon Oct 23 15:05:15 2006 for OpenSees by doxygen 1.5.0