00001 #include "YieldSurface_BC.h"
00002 #include <TclModelBuilder.h>
00003 #include <string.h>
00004 #include <Vector.h>
00005
00006 #include "NullYS2D.h"
00007 #include "Attalla2D.h"
00008 #include "Orbison2D.h"
00009 #include "Hajjar2D.h"
00010 #include "ElTawil2D.h"
00011 #include "ElTawil2DUnSym.h"
00012
00013
00014 static void printCommand(int argc, TCL_Char **argv)
00015 {
00016 opserr << "Input command: ";
00017 for (int i=0; i<argc; i++)
00018 opserr << argv[i] << " ";
00019 opserr << endln;
00020 }
00021
00022 int
00023 TclModelBuilderYieldSurface_BCCommand (ClientData clienData, Tcl_Interp *interp, int argc,
00024 TCL_Char **argv, TclModelBuilder *theBuilder)
00025 {
00026
00027 if (argc < 3) {
00028 opserr << "WARNING insufficient number of uniaxial material arguments\n";
00029 opserr << "Want: yieldSurfaceBC type? tag? <specific material args>" << endln;
00030 return TCL_ERROR;
00031 }
00032
00033
00034 YieldSurface_BC *theYS = 0;
00035
00036 if(strcmp(argv[1],"null") == 0)
00037 {
00038 if(argc < 4)
00039 {
00040 opserr << "WARNING invalid number of arguments\n";
00041 printCommand(argc,argv);
00042 opserr << "Want: yieldSurfaceBC null tag? dimensions?" << endln;
00043 return TCL_ERROR;
00044 }
00045 int tag, dim;
00046 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK)
00047 {
00048 opserr << "WARNING invalid yieldSurfaceBC null tag" << endln;
00049 return TCL_ERROR;
00050 }
00051 if (Tcl_GetInt(interp, argv[3], &dim) != TCL_OK)
00052 {
00053 opserr << "WARNING invalid yieldSurfaceBC null dimensions" << endln;
00054 return TCL_ERROR;
00055 }
00056
00057 switch (dim)
00058 {
00059
00060 case 2: theYS = new NullYS2D(tag); break;
00061
00062 default:
00063 opserr << "incorrect dimension for null ys\n";
00064 return TCL_ERROR;
00065 }
00066
00067 }
00068 else if (strcmp(argv[1],"Orbison2D") == 0)
00069 {
00070 if (argc < 6)
00071 {
00072 opserr << "WARNING invalid number of arguments\n";
00073 printCommand(argc,argv);
00074
00075 opserr << "Want: yieldSurfaceBC Orbison2D tag? xCap? yCap? ys_model_tag?" << endln;
00076 return TCL_ERROR;
00077 }
00078
00079 int tag;
00080 double xCap, yCap;
00081
00082 int modelID;
00083
00084
00085 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK)
00086 {
00087 opserr << "WARNING invalid yieldSurfaceBC Orbison2D tag" << endln;
00088 return TCL_ERROR;
00089 }
00090
00091 if (Tcl_GetDouble(interp, argv[3], &xCap) != TCL_OK)
00092 {
00093 opserr << "WARNING invalid xCap\n";
00094 opserr << "yieldSurfaceBC Orbison2D tag: " << tag << endln;
00095 return TCL_ERROR;
00096 }
00097
00098 if (Tcl_GetDouble(interp, argv[4], &yCap) != TCL_OK)
00099 {
00100 opserr << "WARNING invalid yCap\n";
00101 opserr << "yieldSurfaceBC Orbison2D tag: " << tag << endln;
00102 return TCL_ERROR;
00103 }
00104
00105 if (Tcl_GetInt(interp, argv[5], &modelID) != TCL_OK)
00106 {
00107 opserr << "WARNING invalid yieldSurfaceBC Orbison2D matID1" << modelID << endln;
00108 return TCL_ERROR;
00109 }
00110
00111 YS_Evolution *theModel = theBuilder->getYS_EvolutionModel(modelID);
00112 if(theModel == 0)
00113 {
00114 opserr << "WARNING yieldSurfaceBC Orbison2D no ys_model exixts with tag: " << modelID << endln;
00115 return TCL_ERROR;
00116 }
00117
00118
00119 theYS = new Orbison2D(tag, xCap, yCap, *theModel);
00120 }
00121
00122 else if (strcmp(argv[1],"ElTawil2D") == 0)
00123 {
00124 if (argc < 7)
00125 {
00126 opserr << "WARNING invalid number of arguments\n";
00127 printCommand(argc,argv);
00128
00129 opserr << "Want: yieldSurfaceBC ElTawil2D tag? xCap? yCap? ys_model_tag?" << endln;
00130 return TCL_ERROR;
00131 }
00132
00133 int tag;
00134 double xBal, yBal;
00135 double yPos, yNeg;
00136
00137 int modelID;
00138
00139 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK)
00140 {
00141 opserr << "WARNING invalid yieldSurfaceBC ElTawil2D tag" << endln;
00142 return TCL_ERROR;
00143 }
00144
00145 if (Tcl_GetDouble(interp, argv[3], &xBal) != TCL_OK)
00146 {
00147 opserr << "WARNING invalid xBal\n";
00148 opserr << "yieldSurfaceBC ElTawil2D tag: " << tag << endln;
00149 return TCL_ERROR;
00150 }
00151
00152 if (Tcl_GetDouble(interp, argv[4], &yBal) != TCL_OK)
00153 {
00154 opserr << "WARNING invalid yBal\n";
00155 opserr << "yieldSurfaceBC ElTawil2D tag: " << tag << endln;
00156 return TCL_ERROR;
00157 }
00158
00159 if (Tcl_GetDouble(interp, argv[5], &yPos) != TCL_OK)
00160 {
00161 opserr << "WARNING invalid xPos\n";
00162 opserr << "yieldSurfaceBC ElTawil2D tag: " << tag << endln;
00163 return TCL_ERROR;
00164 }
00165
00166 if (Tcl_GetDouble(interp, argv[6], &yNeg) != TCL_OK)
00167 {
00168 opserr << "WARNING invalid yNeg\n";
00169 opserr << "yieldSurfaceBC ElTawil2D tag: " << tag << endln;
00170 return TCL_ERROR;
00171 }
00172
00173
00174 if (Tcl_GetInt(interp, argv[7], &modelID) != TCL_OK)
00175 {
00176 opserr << "WARNING invalid yieldSurfaceBC ElTawil2D matID1" << modelID << endln;
00177 return TCL_ERROR;
00178 }
00179
00180 YS_Evolution *theModel = theBuilder->getYS_EvolutionModel(modelID);
00181 if(theModel == 0)
00182 {
00183 opserr << "WARNING yieldSurfaceBC ElTawil2D no ys_model exixts with tag: " << modelID << endln;
00184 return TCL_ERROR;
00185 }
00186
00187
00188 theYS = new ElTawil2D(tag, xBal, yBal, yPos, yNeg, *theModel);
00189 }
00190
00191 else if (strcmp(argv[1],"ElTawil2DUnSym") == 0)
00192 {
00193 if (argc < 9)
00194 {
00195 opserr << "WARNING invalid number of arguments\n";
00196 printCommand(argc,argv);
00197
00198 opserr << "Want: yieldSurfaceBC ElTawil2DUnSym tag? xPosBal? yPosBal? "
00199 << "xNegBal? yPos? yNeg? ys_model_tag?" << endln;
00200 return TCL_ERROR;
00201 }
00202
00203 int tag;
00204 double xPosBal, yPosBal;
00205 double xNegBal, yNegBal;
00206 double yPos, yNeg;
00207
00208 int modelID;
00209
00210 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK)
00211 {
00212 opserr << "WARNING invalid yieldSurfaceBC ElTawil2DUnSym tag" << endln;
00213 return TCL_ERROR;
00214 }
00215
00216 if (Tcl_GetDouble(interp, argv[3], &xPosBal) != TCL_OK)
00217 {
00218 opserr << "WARNING invalid xPosBal\n";
00219 opserr << "yieldSurfaceBC ElTawil2DUnSym tag: " << tag << endln;
00220 return TCL_ERROR;
00221 }
00222
00223 if (Tcl_GetDouble(interp, argv[4], &yPosBal) != TCL_OK)
00224 {
00225 opserr << "WARNING invalid yPosBal\n";
00226 opserr << "yieldSurfaceBC ElTawil2DUnSym tag: " << tag << endln;
00227 return TCL_ERROR;
00228 }
00229 if (Tcl_GetDouble(interp, argv[5], &xNegBal) != TCL_OK)
00230 {
00231 opserr << "WARNING invalid xNegBal\n";
00232 opserr << "yieldSurfaceBC ElTawil2DUnSym tag: " << tag << endln;
00233 return TCL_ERROR;
00234 }
00235
00236 if (Tcl_GetDouble(interp, argv[6], &yNegBal) != TCL_OK)
00237 {
00238 opserr << "WARNING invalid yNegBal\n";
00239 opserr << "yieldSurfaceBC ElTawil2DUnSym tag: " << tag << endln;
00240 return TCL_ERROR;
00241 }
00242
00243 if (Tcl_GetDouble(interp, argv[7], &yPos) != TCL_OK)
00244 {
00245 opserr << "WARNING invalid xPos\n";
00246 opserr << "yieldSurfaceBC ElTawil2DUnSym tag: " << tag << endln;
00247 return TCL_ERROR;
00248 }
00249
00250 if (Tcl_GetDouble(interp, argv[8], &yNeg) != TCL_OK)
00251 {
00252 opserr << "WARNING invalid yNeg\n";
00253 opserr << "yieldSurfaceBC ElTawil2DUnSym tag: " << tag << endln;
00254 return TCL_ERROR;
00255 }
00256
00257
00258 if (Tcl_GetInt(interp, argv[9], &modelID) != TCL_OK)
00259 {
00260 opserr << "WARNING invalid yieldSurfaceBC ElTawil2DUnSym matID1"
00261 << modelID << endln;
00262 return TCL_ERROR;
00263 }
00264
00265 YS_Evolution *theModel = theBuilder->getYS_EvolutionModel(modelID);
00266 if(theModel == 0)
00267 {
00268 opserr << "WARNING yieldSurfaceBC ElTawil2D no ys_model exixts with tag: " << modelID << endln;
00269 return TCL_ERROR;
00270 }
00271
00272
00273 theYS = new ElTawil2DUnSym(tag, xPosBal, yPosBal, xNegBal, yNegBal, yPos, yNeg, *theModel);
00274 }
00275
00276 else if (strcmp(argv[1],"Attalla2D") == 0)
00277 {
00278
00279
00280
00281
00282
00283 if (argc < 6 || argc > 14)
00284 {
00285 opserr << "WARNING invalid number of arguments\n";
00286 printCommand(argc,argv);
00287 opserr << "Want: yieldSurfaceBC Attalla2D tag? xCap? yCap? matXTag? maxYTag? isoRatio? <..>" << endln;
00288 return TCL_ERROR;
00289 }
00290
00291 int tag;
00292 double xCap, yCap;
00293
00294 int modelID;
00295
00296
00297 Vector param(6);
00298
00299 param[0] = 0.19;
00300 param[1] = 0.54;
00301 param[2] =-1.40;
00302 param[3] =-1.64;
00303 param[4] = 2.21;
00304 param[5] = 2.10;
00305
00306
00307 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK)
00308 {
00309 opserr << "WARNING invalid yieldSurfaceBC Attalla2D tag" << endln;
00310 return TCL_ERROR;
00311 }
00312
00313 if (Tcl_GetDouble(interp, argv[3], &xCap) != TCL_OK)
00314 {
00315 opserr << "WARNING invalid xCap\n";
00316 opserr << "yieldSurfaceBC Attalla2D tag: " << tag << endln;
00317 return TCL_ERROR;
00318 }
00319
00320 if (Tcl_GetDouble(interp, argv[4], &yCap) != TCL_OK)
00321 {
00322 opserr << "WARNING invalid yCap\n";
00323 opserr << "yieldSurfaceBC Attalla2D tag: " << tag << endln;
00324 return TCL_ERROR;
00325 }
00326
00327 if (Tcl_GetInt(interp, argv[5], &modelID) != TCL_OK)
00328 {
00329 opserr << "WARNING invalid yieldSurfaceBC Attalla2D modelID" << modelID << endln;
00330 return TCL_ERROR;
00331 }
00332
00333 YS_Evolution *theModel = theBuilder->getYS_EvolutionModel(modelID);
00334 if(theModel == 0)
00335 {
00336 opserr << "WARNING yieldSurfaceBC Orbison2D no ys_model exixts with tag: " << modelID << endln;
00337 return TCL_ERROR;
00338 }
00339
00340
00341
00342 if(argc > 6)
00343 {
00344 int count = 6;
00345 double temp;
00346
00347 for(int i=0; i < 6; i++)
00348 {
00349 if (Tcl_GetDouble(interp, argv[count], &temp) != TCL_OK)
00350 {
00351 opserr << "WARNING invalid parameter " << i+1 << "\n";
00352 opserr << "yieldSurfaceBC Attalla2D tag: " << tag << endln;
00353 return TCL_ERROR;
00354 }
00355 param(i) = temp;
00356 count++;
00357 }
00358
00359 }
00360
00361
00362 theYS = new Attalla2D(tag, xCap, yCap, *theModel,
00363 param(0),param(1),param(2),param(3),param(4),param(5));
00364
00365 }
00366
00367 else if (strcmp(argv[1],"Hajjar2D") == 0)
00368 {
00369 if (argc < 9)
00370 {
00371 opserr << "WARNING invalid number of arguments\n";
00372 printCommand(argc,argv);
00373 opserr << "Want: yieldSurfaceBC Hajjar2D tag? ysModelTag? D? b? t? fc? fy?" << endln;
00374 return TCL_ERROR;
00375 }
00376
00377 int tag;
00378
00379 int modelID;
00380
00381 double D, b, t, fc, fy;
00382
00383 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK)
00384 {
00385 opserr << "WARNING invalid yieldSurfaceBC Hajjar2D tag" << endln;
00386 return TCL_ERROR;
00387 }
00388
00389 if (Tcl_GetInt(interp, argv[3], &modelID) != TCL_OK)
00390 {
00391 opserr << "WARNING invalid yieldSurfaceBC Hajjar2D matID1" << modelID << endln;
00392 return TCL_ERROR;
00393 }
00394
00395 if (Tcl_GetDouble(interp, argv[4], &D) != TCL_OK)
00396 {
00397 opserr << "WARNING invalid D \n";
00398 opserr << "yieldSurfaceBC Hajjar2D tag: " << tag << endln;
00399 return TCL_ERROR;
00400 }
00401
00402 if (Tcl_GetDouble(interp, argv[5], &b) != TCL_OK)
00403 {
00404 opserr << "WARNING invalid b \n";
00405 opserr << "yieldSurfaceBC Hajjar2D tag: " << tag << endln;
00406 return TCL_ERROR;
00407 }
00408
00409 if (Tcl_GetDouble(interp, argv[6], &t) != TCL_OK)
00410 {
00411 opserr << "WARNING invalid t \n";
00412 opserr << "yieldSurfaceBC Hajjar2D tag: " << tag << endln;
00413 return TCL_ERROR;
00414 }
00415
00416 if (Tcl_GetDouble(interp, argv[7], &fc) != TCL_OK)
00417 {
00418 opserr << "WARNING invalid fc \n";
00419 opserr << "yieldSurfaceBC Hajjar2D tag: " << tag << endln;
00420 return TCL_ERROR;
00421 }
00422
00423 if (Tcl_GetDouble(interp, argv[8], &fy) != TCL_OK)
00424 {
00425 opserr << "WARNING invalid fy \n";
00426 opserr << "yieldSurfaceBC Hajjar2D tag: " << tag << endln;
00427 return TCL_ERROR;
00428 }
00429
00430 YS_Evolution *theModel = theBuilder->getYS_EvolutionModel(modelID);
00431 if(theModel == 0)
00432 {
00433 opserr << "WARNING yieldSurfaceBC Orbison2D no ys_model exixts with tag: " << modelID << endln;
00434 return TCL_ERROR;
00435 }
00436
00437
00438 theYS = new Hajjar2D(tag, *theModel, D, b, t, fc, fy);
00439 }
00440
00441 else
00442 {
00443 opserr << "Warning - unknown yield surface type \n";
00444 printCommand(argc,argv);
00445 }
00446
00448
00450
00451 if (theBuilder->addYieldSurface_BC(*theYS) < 0)
00452 {
00453 opserr << "WARNING could not add YieldSurfaceBC to the domain\n";
00454 opserr << *theYS << endln;
00455 delete theYS;
00456 return TCL_ERROR;
00457 }
00458
00459
00460 return TCL_OK;
00461 }
00462
00463
00464
00465
00466
00467
00468