00001 #include "YieldSurface_BC.h"
00002 #include <TclModelBuilder.h>
00003 #include <string.h>
00004 #include <Vector.h>
00005
00006 #include "NullEvolution.h"
00007 #include "Kinematic2D01.h"
00008 #include "PeakOriented2D01.h"
00009 #include "Isotropic2D01.h"
00010 #include "CombinedIsoKin2D01.h"
00011
00012 #include "Kinematic2D02.h"
00013 #include "PeakOriented2D02.h"
00014 #include "CombinedIsoKin2D02.h"
00015
00016 #include "PlasticHardeningMaterial.h"
00017 #include "YieldSurface_BC.h"
00018
00019
00020
00021 int addTclYS_Evolution(TclModelBuilder *theBuilder, YS_Evolution *theModel)
00022 {
00023 if(theModel ==0)
00024 return TCL_ERROR;
00025
00026 if(!theModel)
00027 {
00028 opserr << "Model not created\n";
00029 return TCL_ERROR;
00030 }
00031
00032 if (theBuilder->addYS_EvolutionModel(*theModel) < 0)
00033 {
00034 opserr << "WARNING could not add hardening model to the domain\n";
00035 opserr << *theModel << endln;
00036 delete theModel;
00037 return TCL_ERROR;
00038 }
00039
00040 return TCL_OK;
00041
00042 }
00043
00044 PlasticHardeningMaterial * getTclPlasticMaterial(Tcl_Interp *interp, TCL_Char *arg, TclModelBuilder *theBuilder)
00045 {
00046 int id;
00047 if (Tcl_GetInt(interp, arg, &id) != TCL_OK)
00048 {
00049 opserr << "WARNING: TclModelYS_EvolutionCommand - Invalid plastic material tag \n";
00050 return 0;
00051 }
00052
00053 PlasticHardeningMaterial *theMat = theBuilder->getPlasticMaterial(id);
00054 if(theMat == 0)
00055 {
00056 opserr << "WARNING: TclModelYS_EvolutionCommand - no PlasticHardeningMaterial with id = "
00057 << id << " exists\n";
00058 return 0;
00059 }
00060 else
00061 return theMat;
00062 }
00063
00064 YieldSurface_BC * getTclYieldSurface_BC(Tcl_Interp *interp, TCL_Char *arg, TclModelBuilder *theBuilder)
00065 {
00066 int id;
00067 if (Tcl_GetInt(interp, arg, &id) != TCL_OK)
00068 {
00069 opserr << "WARNING: TclModelYS_EvolutionCommand - Invalid YieldSurface_BC tag \n";
00070 return 0;
00071 }
00072
00073 YieldSurface_BC *theYS = theBuilder->getYieldSurface_BC(id);
00074 if(theYS == 0)
00075 {
00076 opserr << "WARNING: TclModelYS_EvolutionCommand - no YieldSurface_BC with id = "
00077 << id << " exists\n";
00078 return 0;
00079 }
00080 else
00081 return theYS;
00082 }
00083
00085
00087
00088 int TclNullEvolutionCommand(ClientData clienData, Tcl_Interp *interp, int argc,
00089 TCL_Char **argv, TclModelBuilder *theBuilder)
00090 {
00091 YS_Evolution *theModel = 0;
00092 int tag;
00093 double isox;
00094 double isoy;
00095 double isoz;
00096 int dim=0;
00097
00098 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK)
00099 return TCL_ERROR;
00100
00101 if(argc > 3)
00102 {
00103 if (Tcl_GetDouble(interp, argv[3], &isox) != TCL_OK)
00104 return TCL_ERROR;
00105 dim++;
00106 }
00107 if(argc > 4)
00108 {
00109 if (Tcl_GetDouble(interp, argv[4], &isoy) != TCL_OK)
00110 return TCL_ERROR;
00111 dim++;
00112 }
00113 if(argc > 5)
00114 {
00115 if (Tcl_GetDouble(interp, argv[5], &isoz) != TCL_OK)
00116 return TCL_ERROR;
00117 dim++;
00118 }
00119
00120
00121
00122
00123
00124 if(dim==1)
00125 theModel = new NullEvolution(tag, isox);
00126 else if(dim == 2)
00127 theModel = new NullEvolution(tag, isox, isoy);
00128 else if(dim == 3)
00129 theModel = new NullEvolution(tag, isox, isoy, isoz);
00130 else
00131 theModel = 0;
00132
00133 return addTclYS_Evolution(theBuilder, theModel);
00134 }
00135
00136 int TclKinematic2D01Command(ClientData clienData, Tcl_Interp *interp, int argc,
00137 TCL_Char **argv, TclModelBuilder *theBuilder)
00138 {
00139 YS_Evolution *theModel = 0;
00140 int tag;
00141 double minIsoFactor;
00142
00143 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK)
00144 return TCL_ERROR;
00145
00146 if (Tcl_GetDouble(interp, argv[3], &minIsoFactor) != TCL_OK)
00147 return TCL_ERROR;
00148
00149 PlasticHardeningMaterial *theMatX = getTclPlasticMaterial(interp, argv[4], theBuilder);
00150 if(theMatX == 0)
00151 return TCL_ERROR;
00152
00153 PlasticHardeningMaterial *theMatY = getTclPlasticMaterial(interp, argv[5], theBuilder);
00154 if(theMatY == 0)
00155 return TCL_ERROR;
00156
00157 double dir;
00158 if (Tcl_GetDouble(interp, argv[6], &dir) != TCL_OK)
00159 return TCL_ERROR;
00160
00161
00162 theModel = new Kinematic2D01(tag, minIsoFactor, *theMatX, *theMatY, dir);
00163
00164
00165 return addTclYS_Evolution(theBuilder, theModel);
00166 }
00167
00168
00169 int TclIsotropic2D01Command(ClientData clienData, Tcl_Interp *interp, int argc,
00170 TCL_Char **argv, TclModelBuilder *theBuilder)
00171 {
00172 YS_Evolution *theModel = 0;
00173
00174 int tag;
00175 double minIsoFactor;
00176
00177 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK)
00178 return TCL_ERROR;
00179
00180 if (Tcl_GetDouble(interp, argv[3], &minIsoFactor) != TCL_OK)
00181 return TCL_ERROR;
00182
00183 PlasticHardeningMaterial *theMatX = getTclPlasticMaterial(interp, argv[4], theBuilder);
00184 if(theMatX == 0)
00185 return TCL_ERROR;
00186
00187 PlasticHardeningMaterial *theMatY = getTclPlasticMaterial(interp, argv[5], theBuilder);
00188 if(theMatY == 0)
00189 return TCL_ERROR;
00190
00191
00192 theModel = new Isotropic2D01(tag, minIsoFactor, *theMatX, *theMatY);
00193
00194 return addTclYS_Evolution(theBuilder, theModel);
00195 }
00196
00197
00198 int TclPeakOriented2D01Command(ClientData clienData, Tcl_Interp *interp, int argc,
00199 TCL_Char **argv, TclModelBuilder *theBuilder)
00200 {
00201 YS_Evolution *theModel = 0;
00202 int tag;
00203 double minIsoFactor;
00204
00205
00206 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK)
00207 return TCL_ERROR;
00208
00209 if (Tcl_GetDouble(interp, argv[3], &minIsoFactor) != TCL_OK)
00210 return TCL_ERROR;
00211
00212 PlasticHardeningMaterial *theMatX = getTclPlasticMaterial(interp, argv[4], theBuilder);
00213 if(theMatX == 0)
00214 return TCL_ERROR;
00215
00216 PlasticHardeningMaterial *theMatY = getTclPlasticMaterial(interp, argv[5], theBuilder);
00217 if(theMatY == 0)
00218 return TCL_ERROR;
00219
00220
00221 theModel = new PeakOriented2D01(tag, minIsoFactor, *theMatX, *theMatY);
00222
00223
00224 return addTclYS_Evolution(theBuilder, theModel);
00225 }
00226
00227
00228
00229 int TclCombinedIsoKin2D01Command(ClientData clienData, Tcl_Interp *interp, int argc,
00230 TCL_Char **argv, TclModelBuilder *theBuilder)
00231 {
00232 YS_Evolution *theModel = 0;
00233
00234 int tag;
00235 double minIsoFactor, iso_ratio, kin_ratio, shr_iso_ratio, shr_kin_ratio;
00236 int deformable;
00237 bool deform = false;
00238
00239
00240 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK)
00241 return TCL_ERROR;
00242 if (Tcl_GetDouble(interp, argv[3], &iso_ratio) != TCL_OK)
00243 return TCL_ERROR;
00244 if (Tcl_GetDouble(interp, argv[4], &kin_ratio) != TCL_OK)
00245 return TCL_ERROR;
00246 if (Tcl_GetDouble(interp, argv[5], &shr_iso_ratio) != TCL_OK)
00247 return TCL_ERROR;
00248 if (Tcl_GetDouble(interp, argv[6], &shr_kin_ratio) != TCL_OK)
00249 return TCL_ERROR;
00250 if (Tcl_GetDouble(interp, argv[7], &minIsoFactor) != TCL_OK)
00251 return TCL_ERROR;
00252
00253 PlasticHardeningMaterial *kpx_pos = getTclPlasticMaterial(interp, argv[8], theBuilder);
00254 if(kpx_pos == 0)
00255 return TCL_ERROR;
00256
00257 PlasticHardeningMaterial *kpx_neg = getTclPlasticMaterial(interp, argv[9], theBuilder);
00258 if(kpx_neg == 0)
00259 return TCL_ERROR;
00260
00261 PlasticHardeningMaterial *kpy_pos = getTclPlasticMaterial(interp, argv[10], theBuilder);
00262 if(kpx_pos == 0)
00263 return TCL_ERROR;
00264
00265 PlasticHardeningMaterial *kpy_neg = getTclPlasticMaterial(interp, argv[11], theBuilder);
00266 if(kpx_neg == 0)
00267 return TCL_ERROR;
00268
00269 if (Tcl_GetInt(interp, argv[12], &deformable) != TCL_OK)
00270 return TCL_ERROR;
00271
00272 double dir;
00273 if (Tcl_GetDouble(interp, argv[13], &dir) != TCL_OK)
00274 return TCL_ERROR;
00275
00276 if (deformable == 1)
00277 deform = true;
00278
00279
00280 theModel = new CombinedIsoKin2D01(tag, iso_ratio, kin_ratio,
00281 shr_iso_ratio, shr_kin_ratio, minIsoFactor,
00282 *kpx_pos, *kpx_neg, *kpy_pos, *kpy_neg, deform, dir);
00283
00284 return addTclYS_Evolution(theBuilder, theModel);
00285 }
00286
00287
00289 int TclKinematic2D02Command(ClientData clienData, Tcl_Interp *interp, int argc,
00290 TCL_Char **argv, TclModelBuilder *theBuilder)
00291 {
00292 YS_Evolution *theModel = 0;
00293 int tag;
00294 double minIsoFactor;
00295
00296 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK)
00297 return TCL_ERROR;
00298
00299 if (Tcl_GetDouble(interp, argv[3], &minIsoFactor) != TCL_OK)
00300 return TCL_ERROR;
00301
00302 YieldSurface_BC *ys = getTclYieldSurface_BC(interp, argv[4], theBuilder);
00303 if(ys==0)
00304 return TCL_ERROR;
00305
00306 PlasticHardeningMaterial *theMatX = getTclPlasticMaterial(interp, argv[5], theBuilder);
00307 if(theMatX == 0)
00308 return TCL_ERROR;
00309
00310 PlasticHardeningMaterial *theMatY = getTclPlasticMaterial(interp, argv[6], theBuilder);
00311 if(theMatY == 0)
00312 return TCL_ERROR;
00313
00314 int algo;
00315 double resfact, appfact, dir;
00316
00317 if (Tcl_GetInt(interp, argv[7], &algo) != TCL_OK)
00318 return TCL_ERROR;
00319
00320 if (Tcl_GetDouble(interp, argv[8], &resfact) != TCL_OK)
00321 return TCL_ERROR;
00322
00323 if (Tcl_GetDouble(interp, argv[9], &appfact) != TCL_OK)
00324 return TCL_ERROR;
00325
00326 if (Tcl_GetDouble(interp, argv[10], &dir) != TCL_OK)
00327 return TCL_ERROR;
00328
00329
00330 theModel = new Kinematic2D02(tag, minIsoFactor, *ys,
00331 *theMatX, *theMatY, algo, resfact, appfact, dir);
00332
00333
00334 return addTclYS_Evolution(theBuilder, theModel);
00335 }
00336
00337
00338 int TclPeakOriented2D02Command(ClientData clienData, Tcl_Interp *interp, int argc,
00339 TCL_Char **argv, TclModelBuilder *theBuilder)
00340 {
00341 YS_Evolution *theModel = 0;
00342
00343 int tag;
00344 double minIsoFactor;
00345
00346 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK)
00347 return TCL_ERROR;
00348
00349 if (Tcl_GetDouble(interp, argv[3], &minIsoFactor) != TCL_OK)
00350 return TCL_ERROR;
00351
00352 YieldSurface_BC *ys = getTclYieldSurface_BC(interp, argv[4], theBuilder);
00353 if(ys==0)
00354 return TCL_ERROR;
00355
00356 PlasticHardeningMaterial *kinX = getTclPlasticMaterial(interp, argv[5], theBuilder);
00357 if(kinX == 0)
00358 return TCL_ERROR;
00359
00360 PlasticHardeningMaterial *kinY = getTclPlasticMaterial(interp, argv[6], theBuilder);
00361 if(kinY == 0)
00362 return TCL_ERROR;
00363
00364 PlasticHardeningMaterial *isoX = getTclPlasticMaterial(interp, argv[7], theBuilder);
00365 if(isoX == 0)
00366 return TCL_ERROR;
00367
00368 PlasticHardeningMaterial *isoY = getTclPlasticMaterial(interp, argv[8], theBuilder);
00369 if(isoY == 0)
00370 return TCL_ERROR;
00371 int algo;
00372 if (Tcl_GetInt(interp, argv[9], &algo) != TCL_OK)
00373 return TCL_ERROR;
00374
00375
00376 theModel = new PeakOriented2D02(tag, minIsoFactor, *ys, *kinX, *kinY, *isoX, *isoY, algo);
00377
00378 return addTclYS_Evolution(theBuilder, theModel);
00379 }
00380
00381
00382 int TclCombinedIsoKin2D02Command(ClientData clienData, Tcl_Interp *interp, int argc,
00383 TCL_Char **argv, TclModelBuilder *theBuilder)
00384 {
00385 YS_Evolution *theModel = 0;
00386 int tag, deformable;
00387 bool deform = false;
00388 double minIsoFactor, isoRatio, kinRatio;
00389
00390 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK)
00391 return TCL_ERROR;
00392
00393 if (Tcl_GetDouble(interp, argv[3], &minIsoFactor) != TCL_OK)
00394 return TCL_ERROR;
00395
00396 if (Tcl_GetDouble(interp, argv[4], &isoRatio) != TCL_OK)
00397 return TCL_ERROR;
00398
00399 if (Tcl_GetDouble(interp, argv[5], &kinRatio) != TCL_OK)
00400 return TCL_ERROR;
00401
00402 YieldSurface_BC *ys = getTclYieldSurface_BC(interp, argv[6], theBuilder);
00403 if(ys==0)
00404 return TCL_ERROR;
00405
00406 PlasticHardeningMaterial *kinX = getTclPlasticMaterial(interp, argv[7], theBuilder);
00407 if(kinX == 0)
00408 return TCL_ERROR;
00409
00410 PlasticHardeningMaterial *kinY = getTclPlasticMaterial(interp, argv[8], theBuilder);
00411 if(kinY == 0)
00412 return TCL_ERROR;
00413
00414 PlasticHardeningMaterial *isoXPos = getTclPlasticMaterial(interp, argv[9], theBuilder);
00415 if(isoXPos == 0)
00416 return TCL_ERROR;
00417
00418 PlasticHardeningMaterial *isoXNeg = getTclPlasticMaterial(interp, argv[10], theBuilder);
00419 if(isoXNeg == 0)
00420 return TCL_ERROR;
00421
00422 PlasticHardeningMaterial *isoYPos = getTclPlasticMaterial(interp, argv[11], theBuilder);
00423 if(isoYPos == 0)
00424 return TCL_ERROR;
00425
00426 PlasticHardeningMaterial *isoYNeg = getTclPlasticMaterial(interp, argv[12], theBuilder);
00427 if(isoYNeg == 0)
00428 return TCL_ERROR;
00429
00430 if (Tcl_GetInt(interp, argv[13], &deformable) != TCL_OK)
00431 return TCL_ERROR;
00432
00433 if(deformable == 1)
00434 deform = true;
00435 int algo;
00436 if (Tcl_GetInt(interp, argv[14], &algo) != TCL_OK)
00437 return TCL_ERROR;
00438
00439 double resfact, appfact, dir;
00440
00441 if (Tcl_GetDouble(interp, argv[15], &resfact) != TCL_OK)
00442 return TCL_ERROR;
00443
00444 if (Tcl_GetDouble(interp, argv[16], &appfact) != TCL_OK)
00445 return TCL_ERROR;
00446
00447 if (Tcl_GetDouble(interp, argv[17], &dir) != TCL_OK)
00448 return TCL_ERROR;
00449
00450
00451
00452 theModel = new CombinedIsoKin2D02(tag, minIsoFactor, isoRatio, kinRatio, *ys, *kinX, *kinY,
00453 *isoXPos, *isoXNeg, *isoYPos, *isoYNeg,
00454 deform, algo, resfact, appfact, dir);
00455
00456 return addTclYS_Evolution(theBuilder, theModel);
00457 }
00458
00459
00460
00461
00462 int
00463 TclModelBuilderYS_EvolutionModelCommand (ClientData clientData, Tcl_Interp *interp, int argc,
00464 TCL_Char **argv, TclModelBuilder *theBuilder)
00465 {
00466 if (strcmp(argv[1],"null") == 0)
00467 {
00468 return TclNullEvolutionCommand(clientData, interp, argc, argv, theBuilder);
00469 }
00470 else if (strcmp(argv[1],"kinematic2D01") == 0)
00471 {
00472 return TclKinematic2D01Command(clientData, interp, argc, argv, theBuilder);
00473 }
00474 else if (strcmp(argv[1],"isotropic2D01") == 0)
00475 {
00476 return TclIsotropic2D01Command(clientData, interp, argc, argv, theBuilder);
00477 }
00478 else if (strcmp(argv[1],"peakOriented2D01") == 0)
00479 {
00480 return TclPeakOriented2D01Command(clientData, interp, argc, argv, theBuilder);
00481 }
00482 else if (strcmp(argv[1],"combinedIsoKin2D01") == 0)
00483 {
00484 return TclCombinedIsoKin2D01Command(clientData, interp, argc, argv, theBuilder);
00485 }
00486
00487 else if (strcmp(argv[1],"kinematic2D02") == 0)
00488 {
00489 return TclKinematic2D02Command(clientData, interp, argc, argv, theBuilder);
00490 }
00491 else if (strcmp(argv[1],"peakOriented2D02") == 0)
00492 {
00493 return TclPeakOriented2D02Command(clientData, interp, argc, argv, theBuilder);
00494 }
00495 else if (strcmp(argv[1],"combinedIsoKin2D02") == 0)
00496 {
00497 return TclCombinedIsoKin2D02Command(clientData, interp, argc, argv, theBuilder);
00498 }
00499 else
00500 {
00501 opserr << "Unkown YS_Evolution type: " << argv[1] << endln;
00502 return TCL_ERROR;
00503 }
00504
00505
00506 }
00507
00509
00510
00511
00512
00513
00514
00515