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