00001
00002
00004
00005 #include "Orbison2D.h"
00006 #include <math.h>
00007 #define ORBISON_CLASS_TAG -1
00009 // Construction/Destruction
00011
00012 Orbison2D::Orbison2D(int tag, double xcap, double ycap,
00013 YS_Evolution &model)
00014 :YieldSurface_BC2D(tag, ORBISON_CLASS_TAG, xcap, ycap, model)
00015 {
00016
00017 }
00018
00019 Orbison2D::~Orbison2D()
00020 {
00021
00022 }
00023
00025
00027
00028 void Orbison2D::setExtent()
00029 {
00030
00031 xPos = 1;
00032 xNeg = -1;
00033 yPos = 1;
00034 yNeg = -1;
00035 }
00036
00037
00038 void Orbison2D::getGradient(double &gx, double &gy, double x, double y)
00039 {
00040
00041 double drift = getDrift(x, y);
00042 double capx = capXdim;
00043 double capy = capYdim;
00044
00045 if(forceLocation(drift)!=0)
00046 {
00047 opserr << "ERROR - Orbison2D::getGradient(double &gx, double &gy, double x, double y)\n";
00048 opserr << "Force point not on the yield surface\n";
00049 opserr << " fx = " << x << ", fy = " << y << " drift = " << drift << "\n";
00050 opserr << "\a";
00051 }
00052 else
00053 {
00054 gx = 2*x/(capx) + 7.34*pow(y, 2)*(x/(capx));
00055 gy = 2.3*y/(capy) - 0.9*pow(y, 5)/(capy) + 7.34*pow(x, 2)*(y/(capy));
00056
00057
00058
00059
00060
00061
00062 }
00063
00064 }
00065
00066 double Orbison2D::getSurfaceDrift(double x, double y)
00067 {
00068 double phi = 1.15*y*y - 0.15*pow(y, 6) + x*x + 3.67*y*y*x*x;
00069 double drift = phi - 1;
00070 return drift;
00071 }
00072
00073 YieldSurface_BC *Orbison2D::getCopy(void)
00074 {
00075 Orbison2D *theCopy = new Orbison2D(this->getTag(), capX, capY, *hModel);
00076 if(theCopy==0)
00077 {
00078 opserr << "Orbison2D::getCopy(void) - unable to make copy\n";
00079 opserr << "\a";
00080 }
00081
00082 return theCopy;
00083 }
00084
00085 int Orbison2D::displaySelf(Renderer &theViewer, int displayMode, float fact)
00086 {
00087 this->YieldSurface_BC2D::displaySelf(theViewer, displayMode, fact);
00088
00089 Vector pOld(3), pCurr(3);
00090 Vector rgb(3);
00091 rgb(0) = 0; rgb(1) = 0; rgb(2) = 0;
00092 double incr = 0.1;
00093 double x1, y1, xOld, yOld, x2, y2;
00094
00095 xOld = 1;
00096 yOld = 0.0;
00097
00098
00099 double err = 1e-5;
00100
00101 if(fact < 1) incr = fact;
00102
00103 for(double y = 0; y <= 1+err; y = y+incr)
00104 {
00105 if(y > 1) y = int(1);
00106 double x = (1 - 1.15*y*y + 0.15*pow(y, 6))/(1 + 3.67*y*y);
00107 if (x>0) x = sqrt(x);
00108
00109
00110
00111
00112 {
00113 if(displayMode==100)
00114 opserr << " x = " << x << ", y = " << y << "\n";
00115
00117 x1 = x;
00118 y1 = y;
00119 hModel->toDeformedCoord(x1, y1);
00120 pCurr(0) = x1;
00121 pCurr(1) = y1;
00122
00123 x2 = xOld;
00124 y2 = yOld;
00125 hModel->toDeformedCoord(x2, y2);
00126 pOld(0) = x2;
00127 pOld(1) = y2;
00128 theViewer.drawLine(pOld, pCurr, rgb, rgb);
00129
00131 x1 = -1*x;
00132 y1 = y;
00133 hModel->toDeformedCoord(x1, y1);
00134 pCurr(0) = x1;
00135 pCurr(1) = y1;
00136
00137 x2 = -1*xOld;
00138 y2 = yOld;
00139 hModel->toDeformedCoord(x2, y2);
00140 pOld(0) = x2;
00141 pOld(1) = y2;
00142
00143 theViewer.drawLine(pOld, pCurr, rgb, rgb);
00144
00146 x1 = x;
00147 y1 = -1*y;
00148 hModel->toDeformedCoord(x1, y1);
00149 pCurr(0) = x1;
00150 pCurr(1) = y1;
00151
00152 x2 = xOld;
00153 y2 = -1*yOld;
00154 hModel->toDeformedCoord(x2, y2);
00155 pOld(0) = x2;
00156 pOld(1) = y2;
00157
00158 theViewer.drawLine(pOld, pCurr, rgb, rgb);
00159
00161 x1 = -1*x;
00162 y1 = -1*y;
00163 hModel->toDeformedCoord(x1, y1);
00164 pCurr(0) = x1;
00165 pCurr(1) = y1;
00166
00167 x2 = -1*xOld;
00168 y2 = -1*yOld;
00169 hModel->toDeformedCoord(x2, y2);
00170 pOld(0) = x2;
00171 pOld(1) = y2;
00172
00173 theViewer.drawLine(pOld, pCurr, rgb, rgb);
00174
00175
00176 xOld = x;
00177 yOld = y;
00178
00179 }
00180 }
00181
00182
00183
00184 return 0;
00185 }
00186
00187
00188 void Orbison2D::Print(OPS_Stream &s, int flag)
00189 {
00190 s << "\nYield Surface No: " << this->getTag() << " type: Attalla2D\n";
00191 }