RMC_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 RMC_PF_CPP
00035 #define RMC_PF_CPP
00036 
00037 #include "RMC_PF.h"
00038 
00039 straintensor RMC_PF::RMCm;
00040 
00041 //================================================================================
00042 RMC_PF::RMC_PF(int dilatant_which_in, int index_dilatant_in, int r_which_in, int index_r_in)
00043 : dilatant_which(dilatant_which_in), index_dilatant(index_dilatant_in), 
00044   r_which(r_which_in), index_r(index_r_in)
00045 {
00046 
00047 }
00048 
00049 //================================================================================
00050 RMC_PF::~RMC_PF() 
00051 {  
00052 
00053 }
00054 
00055 //================================================================================
00056 PlasticFlow* RMC_PF::newObj() 
00057 {  
00058      PlasticFlow  *new_PF = new RMC_PF(dilatant_which, index_dilatant, 
00059                                       r_which, index_r);
00060      
00061      return new_PF;
00062 }
00063 
00064 //================================================================================
00065 const straintensor& RMC_PF::PlasticFlowTensor(const stresstensor &Stre, 
00066                                               const straintensor &Stra, 
00067                                               const MaterialParameter &MaterialParameter_in) const
00068 {
00069         double d = getdilatant(MaterialParameter_in);
00070         double r = getr(MaterialParameter_in);
00071         
00072         double q = Stre.q_deviatoric();
00073         double theta = Stre.theta();
00074         
00075         // g = f1/f2, 1/g = f2/f1;
00076         // d(1/g) = d(f2/f1) = (df2*f1 - df1*f2)/(f1)^2;
00077         double f1 = RoundedFunctionf1(theta, r);
00078         double f2 = RoundedFunctionf2(theta, r);
00079         double df1 = RoundedFunctiondf1(theta, r);
00080         double df2 = RoundedFunctiondf2(theta, r);
00081         double dginv = (df2*f1 - df1*f2) /(f1*f1);
00082         
00083         double dfodp = -3.0*d;
00084         double dfodq = f1/(f2*sqrt(3.0));
00085         double dfodtheta = dginv*q/sqrt(3.0);
00086         
00087         RMCm = Stre.dpoverds() *dfodp + Stre.dqoverds() *dfodq + Stre.dthetaoverds() *dfodtheta;
00088                 
00089     return RMCm;
00090 }
00091 
00092 //================================================================================
00093 double RMC_PF::getdilatant(const MaterialParameter &MaterialParameter_in) const
00094 {
00095         // to dilatant
00096         if ( dilatant_which == 0) {
00097                 if ( index_dilatant <= MaterialParameter_in.getNum_Material_Parameter() && index_dilatant > 0)
00098                         return MaterialParameter_in.getMaterial_Parameter(index_dilatant-1); 
00099                 else {
00100                         opserr << "RMC_PF: Invalid Input. " << endln;
00101                         exit (1);
00102                 }
00103         }
00104         else if ( dilatant_which == 1) {
00105                 if ( index_dilatant <= MaterialParameter_in.getNum_Internal_Scalar() && index_dilatant > 0)
00106                         return MaterialParameter_in.getInternal_Scalar(index_dilatant-1); 
00107                 else {
00108                         opserr << "RMC_PF: Invalid Input. " << endln;
00109                         exit (1);
00110                 }
00111     }
00112         else {
00113                 opserr << "RMC_PF: Invalid Input. " << endln;
00114                 exit(1);
00115         }
00116 }
00117 
00118 //================================================================================   
00119 double RMC_PF::getr(const MaterialParameter &MaterialParameter_in) const
00120 {
00121         // to get r
00122         if ( r_which == 0) {
00123                 if ( index_r <= MaterialParameter_in.getNum_Material_Parameter() && index_r > 0)
00124                         return MaterialParameter_in.getMaterial_Parameter(index_r-1); 
00125                 else {
00126                         opserr << "RMC_YF: Invalid Input. " << endln;
00127                         exit (1);
00128                 }
00129         }
00130         else if ( r_which == 1) {
00131                 if ( index_r <= MaterialParameter_in.getNum_Internal_Scalar() && index_r > 0)
00132                         return MaterialParameter_in.getInternal_Scalar(index_r-1); 
00133                 else {
00134                         opserr << "RMC_YF: Invalid Input. " << endln;
00135                         exit (1);
00136                 }
00137     }
00138         else {
00139                 opserr << "RMC_YF: Invalid Input. " << endln;
00140                 exit(1);
00141         }
00142 }
00143 
00144 //================================================================================   
00145 double RMC_PF::RoundedFunctionf1(double s, double r) const
00146 {
00147         double t1 = sqrt(-4.0*r + 5.0*r*r + 4.0*(1.0 - r*r)*pow(cos(s),2));
00148         return 2.0*(1.0 - r*r)*cos(s) + (-1.0 + 2.0*r) * t1;
00149 }
00150 
00151 //================================================================================   
00152 double RMC_PF::RoundedFunctionf2(double s, double r) const
00153 {
00154         return pow(-1.0 + 2.0*r,2) + 4.0*(1.0 - r*r)*pow(cos(s),2);
00155 }
00156 
00157 //================================================================================   
00158 double RMC_PF::RoundedFunctiondf1(double s, double r) const
00159 {
00160         double t1 = sqrt(-4.0*r + 5.0*r*r + 4.0*(1 - r*r)*pow(cos(s),2));       
00161         return -2.0*(1.0 - r*r)*sin(s) - (4.0*(-1.0 + 2.0*r)*(1 - r*r)*cos(s)*sin(s))/t1;
00162 }
00163 
00164 //================================================================================   
00165 double RMC_PF::RoundedFunctiondf2(double s, double r) const
00166 {
00167         return -8.0*(1 - r*r)*cos(s)*sin(s);
00168 }
00169 
00170 
00171 #endif

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