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
00031
00032 #include <ViscousMaterial.h>
00033 #include <Vector.h>
00034 #include <Channel.h>
00035
00036 ViscousMaterial::ViscousMaterial(int tag, double c, double a)
00037 :UniaxialMaterial(tag,MAT_TAG_Viscous),
00038 trialRate(0.0), C(c), Alpha(a)
00039 {
00040 if (Alpha < 0.0) {
00041 g3ErrorHandler->warning("%s -- Alpha < 0.0, setting to 1.0",
00042 "ViscousMaterial::ViscousMaterial");
00043 Alpha = 1.0;
00044 }
00045 }
00046
00047 ViscousMaterial::ViscousMaterial()
00048 :UniaxialMaterial(0,MAT_TAG_Viscous),
00049 trialRate(0.0), C(0.0), Alpha(0.0)
00050 {
00051
00052 }
00053
00054 ViscousMaterial::~ViscousMaterial()
00055 {
00056
00057 }
00058
00059 int
00060 ViscousMaterial::setTrialStrain(double strain, double strainRate)
00061 {
00062 trialRate = strainRate;
00063
00064 return 0;
00065 }
00066
00067 double
00068 ViscousMaterial::getStress(void)
00069 {
00070 double stress = C*pow(fabs(trialRate),Alpha);
00071
00072 if (trialRate < 0.0)
00073 return -stress;
00074 else
00075 return stress;
00076 }
00077
00078 double
00079 ViscousMaterial::getTangent(void)
00080 {
00081 return 0.0;
00082 }
00083
00084 double
00085 ViscousMaterial::getDampTangent(void)
00086 {
00087 static const double minvel = 1.e-11;
00088
00089 double absRate = fabs(trialRate);
00090
00091 if (absRate < minvel)
00092 return Alpha*C*pow(minvel,Alpha-1.0);
00093 else
00094 return Alpha*C*pow(absRate,Alpha-1.0);
00095 }
00096
00097 double
00098 ViscousMaterial::getSecant(void)
00099 {
00100 return 0.0;
00101 }
00102
00103 double
00104 ViscousMaterial::getStrain(void)
00105 {
00106 return 0.0;
00107 }
00108
00109 double
00110 ViscousMaterial::getStrainRate(void)
00111 {
00112 return trialRate;
00113 }
00114
00115 int
00116 ViscousMaterial::commitState(void)
00117 {
00118 return 0;
00119 }
00120
00121 int
00122 ViscousMaterial::revertToLastCommit(void)
00123 {
00124 return 0;
00125 }
00126
00127 int
00128 ViscousMaterial::revertToStart(void)
00129 {
00130 trialRate = 0.0;
00131
00132 return 0;
00133 }
00134
00135 UniaxialMaterial *
00136 ViscousMaterial::getCopy(void)
00137 {
00138 ViscousMaterial *theCopy = new ViscousMaterial(this->getTag(),C,Alpha);
00139
00140 theCopy->trialRate = trialRate;
00141
00142 return theCopy;
00143 }
00144
00145 int
00146 ViscousMaterial::sendSelf(int cTag, Channel &theChannel)
00147 {
00148 int res = 0;
00149 static Vector data(4);
00150 data(0) = this->getTag();
00151 data(1) = C;
00152 data(2) = Alpha;
00153 data(3) = trialRate;
00154 res = theChannel.sendVector(this->getDbTag(), cTag, data);
00155 if (res < 0)
00156 cerr << "ViscousMaterial::sendSelf() - failed to send data\n";
00157
00158 return res;
00159 }
00160
00161 int
00162 ViscousMaterial::recvSelf(int cTag, Channel &theChannel,
00163 FEM_ObjectBroker &theBroker)
00164 {
00165 int res = 0;
00166 static Vector data(4);
00167 res = theChannel.recvVector(this->getDbTag(), cTag, data);
00168
00169 if (res < 0) {
00170 cerr << "ViscousMaterial::recvSelf() - failed to receive data\n";
00171 C = 0;
00172 this->setTag(0);
00173 }
00174 else {
00175 this->setTag((int)data(0));
00176 C = data(1);
00177 Alpha = data(2);
00178 trialRate = data(3);
00179 }
00180
00181 return res;
00182 }
00183
00184 void
00185 ViscousMaterial::Print(ostream &s, int flag)
00186 {
00187 s << "Viscous tag: " << this->getTag() << endl;
00188 s << " C: " << C << endl;
00189 s << " Alpha: " << Alpha << endl;
00190 }
00191
00192