DP_PF.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 DP_PF_CPP
00035 #define DP_PF_CPP
00036 
00037 #include "DP_PF.h"
00038 
00039 straintensor DP_PF::DPm;
00040 
00041 //================================================================================
00042 DP_PF::DP_PF(int dilatant_which_in, int index_dilatant_in, int alpha_which_in, int index_alpha_in)
00043 : dilatant_which(dilatant_which_in), index_dilatant(index_dilatant_in), 
00044   alpha_which(alpha_which_in), index_alpha(index_alpha_in)
00045 {
00046 
00047 }
00048 
00049 //================================================================================
00050 DP_PF::~DP_PF() 
00051 {  
00052 
00053 }
00054 
00055 //================================================================================
00056 PlasticFlow* DP_PF::newObj() 
00057 {  
00058      PlasticFlow  *new_PF = new DP_PF(dilatant_which, index_dilatant, 
00059                                       alpha_which, index_alpha);
00060      
00061      return new_PF;
00062 }
00063 
00064 //================================================================================
00065 const straintensor& DP_PF::PlasticFlowTensor(const stresstensor &Stre, 
00066                                                     const straintensor &Stra, 
00067                                                     const MaterialParameter &MaterialParameter_in) const
00068 {
00069         double eps = pow( d_macheps(), 0.5 );
00070         BJtensor KroneckerI("I", 2, def_dim_2);
00071         if (alpha_which == -1) {
00072                 double temp0 = Stre.Jinvariant2();
00073         temp0 = sqrt(temp0);
00074                 if (fabs(temp0) < eps) {
00075                         DPm = KroneckerI *getdilatant(MaterialParameter_in);
00076                         return DPm;
00077                 }
00078                 DPm = KroneckerI *getdilatant(MaterialParameter_in) + ( Stre.deviator() *(0.5/temp0) );
00079                 return DPm;
00080         }
00081         else {
00082                 double p = Stre.p_hydrostatic();
00083                 stresstensor s_back = getalpha(MaterialParameter_in);
00084                 stresstensor sigma_b = Stre - (s_back * p);
00085                 stresstensor s_bar = sigma_b.deviator();
00086                 double temp1 = ( s_bar("ij") * s_bar("ij") ).trace();
00087         temp1 = sqrt(0.5*temp1);
00088                 if (fabs(temp1) < eps) {
00089                         DPm = KroneckerI *getdilatant(MaterialParameter_in);
00090                         return DPm;
00091                 }
00092                 double temp2 = ( s_bar("ij") * s_back("ij") ).trace();
00093                 DPm = s_bar + ( KroneckerI * (temp2/3.0) );
00094                 DPm = DPm*(0.5/temp1);
00095         DPm += ( KroneckerI *(getdilatant(MaterialParameter_in)/3.0) );
00096                 return DPm;
00097         }
00098 }
00099 
00100 //================================================================================
00101 double DP_PF::getdilatant(const MaterialParameter &MaterialParameter_in) const
00102 {
00103         // to dilatant
00104         if ( dilatant_which == 0) {
00105                 if ( index_dilatant <= MaterialParameter_in.getNum_Material_Parameter() && index_dilatant > 0)
00106                         return MaterialParameter_in.getMaterial_Parameter(index_dilatant-1); 
00107                 else {
00108                         opserr << "DP_PF: Invalid Input. " << endln;
00109                         exit (1);
00110                 }
00111         }
00112         else if ( dilatant_which == 1) {
00113                 if ( index_dilatant <= MaterialParameter_in.getNum_Internal_Scalar() && index_dilatant > 0)
00114                         return MaterialParameter_in.getInternal_Scalar(index_dilatant-1); 
00115                 else {
00116                         opserr << "DP_PF: Invalid Input. " << endln;
00117                         exit (1);
00118                 }
00119     }
00120         else {
00121                 opserr << "DP_PF: Invalid Input. " << endln;
00122                 exit(1);
00123         }
00124 }
00125 
00126 //================================================================================ 
00127 const stresstensor& DP_PF::getalpha(const MaterialParameter &MaterialParameter_in) const
00128 {
00129         //to get alpha(backstress)
00130         if ( alpha_which == 2 && index_alpha <= MaterialParameter_in.getNum_Internal_Tensor() && index_alpha > 0) {
00131                 DPm = MaterialParameter_in.getInternal_Tensor(index_alpha-1);
00132                 return DPm;
00133         }
00134         else {
00135                 opserr << "DP_PF: Invalid Input. " << endln;
00136                 exit (1);
00137         }
00138 }
00139 
00140 #endif
00141 

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