DM04_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 // Ref: Dafalias and Manzari 2004: J. Eng. Mech. 130(6), pp 622-634
00035 // Parameters:
00036 // 1- m:      f = [(sij-p*aij)(sij-p*aij)]^0.5 - sqrt(2/3)*p*m = 0;
00037 // 2- alpha:  f = [(sij-p*aij)(sij-p*aij)]^0.5 - sqrt(2/3)*p*m = 0;
00038 
00039 #ifndef DM04_YF_CPP
00040 #define DM04_YF_CPP
00041 
00042 #include "DM04_YF.h"
00043 
00044 stresstensor DM04_YF::DM04st;
00045 
00046 //================================================================================
00047 DM04_YF::DM04_YF(int m_which_in, int index_m_in, 
00048                  int alpha_which_in, int index_alpha_in)
00049 : m_which(m_which_in), index_m(index_m_in), 
00050   alpha_which(alpha_which_in), index_alpha(index_alpha_in)
00051 {
00052 
00053 }
00054 
00055 //================================================================================
00056 DM04_YF::~DM04_YF() 
00057 {
00058 
00059 }
00060 
00061 //================================================================================
00062 YieldFunction* DM04_YF::newObj() 
00063 {
00064         YieldFunction  *new_YF = new DM04_YF(m_which, index_m, 
00065                                          alpha_which, index_alpha);
00066 
00067         return new_YF;
00068 }
00069 
00070 //================================================================================
00071 double DM04_YF::YieldFunctionValue( const stresstensor& Stre, 
00072                                     const MaterialParameter &MaterialParameter_in ) const
00073 {
00074         //f = [(sij-p*aij)(sij-p*aij)] - (2/3)*(p*m)^2 = 0
00075         
00076         double p = Stre.p_hydrostatic();
00077 
00078         double m = getm(MaterialParameter_in);
00079         stresstensor alpha = getalpha(MaterialParameter_in);
00080         
00081     stresstensor s_bar = Stre.deviator() - (alpha * p);
00082         double temp1 = ( s_bar("ij") * s_bar("ij") ).trace();
00083         
00084     return temp1 - (2.0/3.0)*m*m*p*p - 1.0e-6;
00085 }
00086 
00087 //================================================================================
00088 const stresstensor& DM04_YF::StressDerivative(const stresstensor& Stre, 
00089                                               const MaterialParameter &MaterialParameter_in) const
00090 {
00091      BJtensor KroneckerI("I", 2, def_dim_2);
00092 
00093      double p = Stre.p_hydrostatic();
00094      
00095      double m = getm(MaterialParameter_in);
00096      stresstensor alpha = getalpha(MaterialParameter_in);
00097      
00098          stresstensor s_bar = Stre.deviator() - (alpha * p);
00099 
00100      double s_bar_alpha = (s_bar("ij")*alpha("ij")).trace();
00101      
00102      DM04st = s_bar + ( KroneckerI * ( s_bar_alpha/3.0 + (4.0/9.0)*m*m*p ));
00103      
00104      return DM04st;
00105 }
00106 
00107 //================================================================================
00108 const stresstensor& DM04_YF::InTensorDerivative(const stresstensor& Stre, 
00109                                                 const MaterialParameter &MaterialParameter_in, 
00110                                                 int which) const
00111 {
00112     if (which == index_alpha) {
00113     
00114         stresstensor alpha = getalpha(MaterialParameter_in);
00115 
00116             double p = Stre.p_hydrostatic();            
00117         stresstensor s_bar = Stre.deviator() - (alpha *p);          
00118                 
00119                 DM04_YF::DM04st = s_bar *(-p);      
00120     }
00121         else {
00122                 opserr << "DM04_YF: Invalid Input. " << endln;
00123                 exit (1);
00124         }
00125     
00126         return DM04_YF::DM04st;
00127 }
00128 
00129 //================================================================================
00130 int DM04_YF::getNumInternalScalar() const
00131 {
00132         return 0;
00133 }
00134 
00135 //================================================================================
00136 int DM04_YF::getNumInternalTensor() const
00137 {
00138         return 1;
00139 }
00140 
00141 //================================================================================   
00142 int DM04_YF::getYieldFunctionRank() const
00143 {
00144         return 1;
00145 }
00146 
00147 //================================================================================   
00148 double DM04_YF::getm(const MaterialParameter &MaterialParameter_in) const
00149 {
00150         // to get m
00151         double m = 0.0;
00152     if ( m_which == 0 && index_m <= MaterialParameter_in.getNum_Material_Parameter() && index_m > 0 ) {
00153         m = MaterialParameter_in.getMaterial_Parameter(index_m-1);
00154             if (m <= 0.0) {
00155                     opserr << "DM04_YF: Invalid Input, m <= 0.0. " << endln;
00156                     exit (1);
00157             }
00158                 return m;
00159     }
00160         else {
00161                 opserr << "Warning!! DM04_YF: Invalid Input. " << endln;
00162                 exit (1);
00163         }
00164 }
00165 
00166 //================================================================================ 
00167 const stresstensor& DM04_YF::getalpha(const MaterialParameter &MaterialParameter_in) const
00168 {
00169         //to get alpha
00170         if ( alpha_which == 2 && index_alpha <= MaterialParameter_in.getNum_Internal_Tensor() && index_alpha > 0 ) {
00171                 DM04_YF::DM04st = MaterialParameter_in.getInternal_Tensor(index_alpha-1);
00172                 return DM04_YF::DM04st;
00173         }
00174         else {
00175                 opserr << "Warning!! DM04_YF: Invalid Input. " << endln;
00176                 exit (1);
00177         }
00178 }
00179 
00180 #endif
00181 

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