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
00032
00033
00034 #include <string.h>
00035 #include <math.h>
00036 #include <stdio.h>
00037 #include <stdlib.h>
00038
00039 #include <Domain.h>
00040
00041 #include <tcl.h>
00042 #include <ErrorHandler.h>
00043 #include <TclModelBuilder.h>
00044 #include <OPS_Globals.h>
00045 #include <ConsoleErrorHandler.h>
00046
00047 #include <stresst.h>
00048
00049 #include "NewTemplate3Dep.h"
00050
00051 #include "MaterialParameter.h"
00052
00053 #include "ElasticState.h"
00054 #include "Isotropic_Elastic.h"
00055 #include "elnp_Elastic.h"
00056 #include "PressureDependent_Elastic.h"
00057 #include "DM04_Elastic.h"
00058
00059 #include "YieldFunction.h"
00060 #include "DP_YF.h"
00061 #include "VM_YF.h"
00062 #include "CC_YF.h"
00063 #include "DM04_YF.h"
00064
00065 #include "PlasticFlow.h"
00066 #include "DP_PF.h"
00067 #include "VM_PF.h"
00068 #include "CC_PF.h"
00069 #include "DM04_PF.h"
00070
00071 #include "ScalarEvolution.h"
00072 #include "Linear_Eeq.h"
00073 #include "CC_Ev.h"
00074
00075
00076 #include "TensorEvolution.h"
00077 #include "Linear_Eij.h"
00078 #include "AF_Eij.h"
00079 #include "DM04_alpha_Eij.h"
00080 #include "DM04_z_Eij.h"
00081
00082 int n_mc = 0;
00083 int n_is = 0;
00084 int n_it = 0;
00085
00086 MaterialParameter* EvaluateMaterialParameter(ClientData, Tcl_Interp*, TCL_Char* tclString);
00087 ElasticState* EvaluateElasticState(ClientData, Tcl_Interp*, TCL_Char* tclString);
00088 YieldFunction* EvaluateYieldFunction(ClientData, Tcl_Interp*, TCL_Char* tclString);
00089 PlasticFlow* EvaluatePlasticFlow(ClientData, Tcl_Interp*, TCL_Char* tclString);
00090 ScalarEvolution** EvaluateSE(ClientData, Tcl_Interp*, TCL_Char* tclString);
00091 TensorEvolution** EvaluateTE(ClientData, Tcl_Interp*, TCL_Char* tclString);
00092
00093
00094 static void cleanup(TCL_Char **argv) {
00095 Tcl_Free((char *) argv);
00096 }
00097
00098
00099
00100
00101 NewTemplate3Dep*
00102 TclModelBuilder_addNewTemplate3Dep(ClientData clientData, Tcl_Interp *interp, int argc,
00103 TCL_Char **argv, TclModelBuilder *theTclBuilder, int eleArgStart)
00104 {
00105 int tag = 0;
00106 MaterialParameter* MatP= NULL;
00107 ElasticState* ES = NULL;
00108 YieldFunction* YF = NULL;
00109 PlasticFlow* PF = NULL;
00110 ScalarEvolution** SSE = NULL;
00111 TensorEvolution** TTE = NULL;
00112 int CI = 0;
00113
00114 int loc = eleArgStart;
00115
00116 if (Tcl_GetInt(interp, argv[loc++], &tag) != TCL_OK) {
00117 opserr << "Warning: NewTemplate3Dep - invalid tag " << argv[loc] << endln;
00118 exit (1);
00119 }
00120
00121 while (loc < argc) {
00122
00123 if ( strcmp(argv[loc],"-MaterialParameter") == 0 ) {
00124 MatP = EvaluateMaterialParameter(clientData, interp, argv[loc+1]);
00125 if (MatP == NULL) {
00126 opserr << "Warning: TclNewTemplate3Dep - could not create elastic state from " << argv[loc+1] << endln;
00127 exit (1);
00128 }
00129 loc += 2;
00130 }
00131
00132 else if ( strcmp(argv[loc],"-ElasticState") == 0 ) {
00133 ES = EvaluateElasticState(clientData, interp, argv[loc+1]);
00134 if (ES == NULL) {
00135 opserr << "Warning: TclNewTemplate3Dep - could not create elastic state from " << argv[loc+1] << endln;
00136 exit (1);
00137 }
00138 loc += 2;
00139 }
00140
00141 else if ( strcmp(argv[loc],"-YieldFunction") == 0 ) {
00142 YF = EvaluateYieldFunction(clientData, interp, argv[loc+1]);
00143 if (YF == NULL) {
00144 opserr << "Warning: TclNewTemplate3Dep - could not create a yield function from " << argv[loc+1] << endln;
00145 exit (1);
00146 }
00147 loc += 2;
00148 }
00149
00150 else if ( strcmp(argv[loc],"-PlasticFlow") == 0 ) {
00151 PF = EvaluatePlasticFlow(clientData, interp, argv[loc+1]);
00152 if (PF == NULL) {
00153 opserr << "Warning: TclNewTemplate3Dep - could not create a yield function from " << argv[loc+1] << endln;
00154 exit (1);
00155 }
00156 loc += 2;
00157 }
00158
00159 else if ( strcmp(argv[loc],"-ScalarEvolution") == 0 ) {
00160 SSE = EvaluateSE(clientData, interp, argv[loc+1]);
00161 if (SSE == NULL) {
00162 opserr << "Warning: TclNewTemplate3Dep - could not create a scalar evolution from " << argv[loc+1] << endln;
00163 exit (1);
00164 }
00165 loc += 2;
00166 }
00167
00168 else if ( strcmp(argv[loc],"-TensorEvolution") == 0 ) {
00169 TTE = EvaluateTE(clientData, interp, argv[loc+1]);
00170 if (TTE == NULL) {
00171 opserr << "Warning: TclNewTemplate3Dep - could not create a tensor evolution from " << argv[loc+1] << endln;
00172 exit (1);
00173 }
00174 loc += 2;
00175 }
00176
00177 else if ( strcmp(argv[loc],"-Algorithm") == 0 ) {
00178 if (Tcl_GetInt(interp, argv[loc+1], &CI) != TCL_OK) {
00179 opserr << "Warning: TclNewTemplate3Dep - invalid algorithm index " << argv[loc] << endln;
00180 exit (1);
00181 }
00182 loc += 2;
00183 }
00184
00185 else {
00186 opserr << "Warning: TclNewTemplate3Dep - unknown keyword/command : " << argv[loc] << endln;
00187 exit (1);
00188 }
00189
00190 }
00191
00192 NewTemplate3Dep *theMaterial = 0;
00193
00194 if ( (MatP != NULL) && (ES != NULL) && (YF != NULL) && (PF != NULL) && (SSE != NULL) )
00195 theMaterial = new NewTemplate3Dep(tag, MatP, ES, YF, PF, SSE, TTE, CI);
00196 else if ( (MatP != NULL) && (ES != NULL) && (YF != NULL) && (PF != NULL) && (SSE == NULL) )
00197 theMaterial = new NewTemplate3Dep(tag, MatP, ES, YF, PF, TTE, CI);
00198 else
00199 opserr << "Warning: invalid args used to create a NewTemplate3Dep material." << endln;
00200
00201 return theMaterial;
00202 }
00203
00204
00205
00206
00207 MaterialParameter *EvaluateMaterialParameter(ClientData clientData, Tcl_Interp *interp, TCL_Char *tclString)
00208 {
00209 int argc;
00210 TCL_Char **argv;
00211
00212
00213 if (Tcl_SplitList(interp, tclString, &argc, &argv) != TCL_OK)
00214 exit (1);
00215
00216 if (argc == 0)
00217 exit (1);
00218
00219 int loc = 0;
00220 double* mc = NULL;
00221 double* is = NULL;
00222 stresstensor* it = NULL;
00223 MaterialParameter *inp = NULL;
00224
00225 while (loc < argc) {
00226
00227 if ( strcmp(argv[loc],"MaterialConstant") == 0 ) {
00228
00229 loc++;
00230
00231 if (Tcl_GetInt(interp, argv[loc], &n_mc) != TCL_OK) {
00232 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[loc] << endln;
00233 exit (1);
00234 }
00235
00236
00237
00238 if (n_mc > 0)
00239 mc = new double[n_mc];
00240
00241 if (mc == 0) {
00242 opserr << "Warning: TclNewTemplate3Dep - could not create material constants " << endln;
00243 exit (1);
00244 }
00245
00246 for (int i = 0; i < n_mc; i++) {
00247 loc++;
00248 if (Tcl_GetDouble(interp, argv[loc], &mc[i]) != TCL_OK) {
00249 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[loc] << endln;
00250 exit (1);
00251 }
00252 }
00253 }
00254
00255 else if ( strcmp(argv[loc],"InternalScalar") == 0 ) {
00256
00257 loc++;
00258
00259 if (Tcl_GetInt(interp, argv[loc], &n_is) != TCL_OK) {
00260 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[loc] << endln;
00261 exit (1);
00262 }
00263
00264
00265
00266 if (n_is > 0) {
00267 is = new double[n_is];
00268 if (is == 0) {
00269 opserr << "Warning: TclNewTemplate3Dep - could not create scalar variables " << endln;
00270 exit (1);
00271 }
00272
00273 for (int i = 0; i < n_is; i++) {
00274 loc++;
00275 if (Tcl_GetDouble(interp, argv[loc], &is[i]) != TCL_OK) {
00276 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[loc] << endln;
00277 exit (1);
00278 }
00279 }
00280 }
00281 }
00282
00283 else if ( strcmp(argv[loc],"InternalTensor") == 0 ) {
00284
00285 loc++;
00286
00287 if (Tcl_GetInt(interp, argv[loc], &n_it) != TCL_OK) {
00288 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[loc] << endln;
00289 exit (1);
00290 }
00291
00292 if (n_it > 0) {
00293 it = new stresstensor[n_it];
00294 double a[9];
00295 if (it == 0) {
00296 opserr << "Warning: TclNewTemplate3Dep - could not create tensor variables " << endln;
00297 exit (1);
00298 }
00299
00300
00301
00302 for (int i = 0; i < n_it; i++) {
00303 for (int j = 0; j < 9; j++) {
00304 loc++;
00305 if (Tcl_GetDouble(interp, argv[loc], &a[j]) != TCL_OK) {
00306 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[loc] << endln;
00307 exit (1);
00308 }
00309 }
00310 it[i].val(1,1) = a[0]; it[i].val(1,2) = a[1]; it[i].val(1,3) = a[2];
00311 it[i].val(2,1) = a[3]; it[i].val(2,2) = a[4]; it[i].val(2,3) = a[5];
00312 it[i].val(3,1) = a[6]; it[i].val(3,2) = a[7]; it[i].val(3,3) = a[8];
00313 }
00314 }
00315 }
00316
00317 loc++;
00318 }
00319
00320
00321 if ( (mc != NULL) && (is != NULL) && (it != NULL) )
00322 inp = new MaterialParameter(mc, n_mc, is, n_is, it, n_it);
00323 else if ( (mc != NULL) && (is != NULL) && (it == NULL) )
00324 inp = new MaterialParameter(mc, n_mc, is, n_is);
00325 else if ( (mc != NULL) && (is == NULL) && (it != NULL) )
00326 inp = new MaterialParameter(mc, n_mc, it, n_it);
00327 else if ( (mc != NULL) && (is == NULL) && (it == NULL) )
00328 inp = new MaterialParameter(mc, n_mc);
00329 else {
00330 opserr << "Warning: TclNewTemplate3Dep - could not create input parameter " << endln;
00331 exit (1);
00332 }
00333
00334 cleanup(argv);
00335 return inp;
00336 }
00337
00338
00339
00340
00341 ElasticState *EvaluateElasticState(ClientData clientData, Tcl_Interp *interp, TCL_Char *tclString)
00342 {
00343 int argc;
00344 TCL_Char **argv;
00345
00346
00347 if (Tcl_SplitList(interp, tclString, &argc, &argv) != TCL_OK) {
00348 exit (1);
00349 }
00350
00351 if (argc == 0)
00352 exit (1);
00353
00354
00355 ElasticState *ElS = NULL;
00356
00357
00358 if ( strcmp(argv[0],"Isotropic") == 0 ) {
00359 int a1 = 0;
00360 int a2 = 0;
00361 stresstensor initStre;
00362 straintensor initStra;
00363
00364 if (argc > 2 ) {
00365 if (Tcl_GetInt(interp, argv[1], &a1) != TCL_OK) {
00366 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[1] << endln;
00367 exit (1);
00368 }
00369 if (Tcl_GetInt(interp, argv[2], &a2) != TCL_OK) {
00370 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[2] << endln;
00371 exit (1);
00372 }
00373 }
00374 if (argc > (2 + 9) ) {
00375 double a[9];
00376 for (int j = 0; j < 9; j++) {
00377 if (Tcl_GetDouble(interp, argv[4+1+j], &a[j]) != TCL_OK) {
00378 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[2+1+j] << endln;
00379 exit (1);
00380 }
00381 }
00382 initStre.val(1,1) = a[0]; initStre.val(1,2) = a[1]; initStre.val(1,3) = a[2];
00383 initStre.val(2,1) = a[3]; initStre.val(2,2) = a[4]; initStre.val(2,3) = a[5];
00384 initStre.val(3,1) = a[6]; initStre.val(3,2) = a[7]; initStre.val(3,3) = a[8];
00385 }
00386 if (argc > (2 + 18) ) {
00387 double a[9];
00388 for (int j = 0; j < 9; j++) {
00389 if (Tcl_GetDouble(interp, argv[2+10+j], &a[j]) != TCL_OK) {
00390 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[2+10+j] << endln;
00391 exit (1);
00392 }
00393 }
00394 initStra.val(1,1) = a[0]; initStra.val(1,2) = a[1]; initStra.val(1,3) = a[2];
00395 initStra.val(2,1) = a[3]; initStra.val(2,2) = a[4]; initStra.val(2,3) = a[5];
00396 initStra.val(3,1) = a[6]; initStra.val(3,2) = a[7]; initStra.val(3,3) = a[8];
00397 }
00398
00399 ElS = new Isotropic_Elastic(a1, a2, initStre, initStra);
00400 }
00401
00402
00403 else if ( strcmp(argv[0],"elnp") == 0 || strcmp(argv[0],"Cam-Clay") == 0 ) {
00404 int a1 = 0;
00405 int a2 = 0;
00406 int a3 = 0;
00407 int a4 = 0;
00408 stresstensor initStre;
00409 straintensor initStra;
00410
00411 if (argc > 4 ) {
00412 if (Tcl_GetInt(interp, argv[1], &a1) != TCL_OK) {
00413 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[1] << endln;
00414 exit (1);
00415 }
00416 if (Tcl_GetInt(interp, argv[2], &a2) != TCL_OK) {
00417 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[2] << endln;
00418 exit (1);
00419 }
00420 if (Tcl_GetInt(interp, argv[3], &a3) != TCL_OK) {
00421 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[3] << endln;
00422 exit (1);
00423 }
00424 if (Tcl_GetInt(interp, argv[4], &a4) != TCL_OK) {
00425 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[4] << endln;
00426 exit (1);
00427 }
00428 }
00429 if (argc > (4 + 9) ) {
00430 double a[9];
00431 for (int j = 0; j < 9; j++) {
00432 if (Tcl_GetDouble(interp, argv[4+1+j], &a[j]) != TCL_OK) {
00433 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[4+1+j] << endln;
00434 exit (1);
00435 }
00436 }
00437 initStre.val(1,1) = a[0]; initStre.val(1,2) = a[1]; initStre.val(1,3) = a[2];
00438 initStre.val(2,1) = a[3]; initStre.val(2,2) = a[4]; initStre.val(2,3) = a[5];
00439 initStre.val(3,1) = a[6]; initStre.val(3,2) = a[7]; initStre.val(3,3) = a[8];
00440 }
00441 if (argc > (4 + 18) ) {
00442 double a[9];
00443 for (int j = 0; j < 9; j++) {
00444 if (Tcl_GetDouble(interp, argv[4+10+j], &a[j]) != TCL_OK) {
00445 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[4+10+j] << endln;
00446 exit (1);
00447 }
00448 }
00449 initStra.val(1,1) = a[0]; initStra.val(1,2) = a[1]; initStra.val(1,3) = a[2];
00450 initStra.val(2,1) = a[3]; initStra.val(2,2) = a[4]; initStra.val(2,3) = a[5];
00451 initStra.val(3,1) = a[6]; initStra.val(3,2) = a[7]; initStra.val(3,3) = a[8];
00452 }
00453
00454 ElS = new elnp_Elastic(a1, a2, a3, a4, initStre, initStra);
00455 }
00456
00457
00458 else if (strcmp(argv[0],"PressureDependent") == 0) {
00459 int a1 = 0;
00460 int a2 = 0;
00461 int a3 = 0;
00462 int a4 = 0;
00463 int a5 = 0;
00464 stresstensor initStre;
00465 straintensor initStra;
00466
00467 if (argc > 5 ) {
00468 if (Tcl_GetInt(interp, argv[1], &a1) != TCL_OK) {
00469 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[1] << endln;
00470 exit (1);
00471 }
00472 if (Tcl_GetInt(interp, argv[2], &a2) != TCL_OK) {
00473 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[2] << endln;
00474 exit (1);
00475 }
00476 if (Tcl_GetInt(interp, argv[3], &a3) != TCL_OK) {
00477 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[3] << endln;
00478 exit (1);
00479 }
00480 if (Tcl_GetInt(interp, argv[4], &a4) != TCL_OK) {
00481 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[4] << endln;
00482 exit (1);
00483 }
00484 if (Tcl_GetInt(interp, argv[5], &a5) != TCL_OK) {
00485 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[5] << endln;
00486 exit (1);
00487 }
00488 }
00489 if (argc > (5 + 9) ) {
00490 double a[9];
00491 for (int j = 0; j < 9; j++) {
00492 if (Tcl_GetDouble(interp, argv[5+1+j], &a[j]) != TCL_OK) {
00493 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[5+1+j] << endln;
00494 exit (1);
00495 }
00496 }
00497 initStre.val(1,1) = a[0]; initStre.val(1,2) = a[1]; initStre.val(1,3) = a[2];
00498 initStre.val(2,1) = a[3]; initStre.val(2,2) = a[4]; initStre.val(2,3) = a[5];
00499 initStre.val(3,1) = a[6]; initStre.val(3,2) = a[7]; initStre.val(3,3) = a[8];
00500 }
00501 if (argc > (5 + 18) ) {
00502 double a[9];
00503 for (int j = 0; j < 9; j++) {
00504 if (Tcl_GetDouble(interp, argv[4+10+j], &a[j]) != TCL_OK) {
00505 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[5+10+j] << endln;
00506 exit (1);
00507 }
00508 }
00509 initStra.val(1,1) = a[0]; initStra.val(1,2) = a[1]; initStra.val(1,3) = a[2];
00510 initStra.val(2,1) = a[3]; initStra.val(2,2) = a[4]; initStra.val(2,3) = a[5];
00511 initStra.val(3,1) = a[6]; initStra.val(3,2) = a[7]; initStra.val(3,3) = a[8];
00512 }
00513
00514 ElS = new PressureDependent_Elastic(a1, a2, a3, a4, a5, initStre, initStra);
00515 }
00516
00517
00518 else if ( strcmp(argv[0],"Dafalias-Manzari") == 0 ) {
00519 int a1 = 0;
00520 int a2 = 0;
00521 int a3 = 0;
00522 int a4 = 0;
00523 int a5 = 0;
00524 stresstensor initStre;
00525 straintensor initStra;
00526
00527 if (argc > 5 ) {
00528 if (Tcl_GetInt(interp, argv[1], &a1) != TCL_OK) {
00529 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[1] << endln;
00530 exit (1);
00531 }
00532 if (Tcl_GetInt(interp, argv[2], &a2) != TCL_OK) {
00533 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[2] << endln;
00534 exit (1);
00535 }
00536 if (Tcl_GetInt(interp, argv[3], &a3) != TCL_OK) {
00537 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[3] << endln;
00538 exit (1);
00539 }
00540 if (Tcl_GetInt(interp, argv[4], &a4) != TCL_OK) {
00541 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[4] << endln;
00542 exit (1);
00543 }
00544 if (Tcl_GetInt(interp, argv[5], &a5) != TCL_OK) {
00545 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[5] << endln;
00546 exit (1);
00547 }
00548 }
00549 if (argc > (5 + 9) ) {
00550 double a[9];
00551 for (int j = 0; j < 9; j++) {
00552 if (Tcl_GetDouble(interp, argv[5+1+j], &a[j]) != TCL_OK) {
00553 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[5+1+j] << endln;
00554 exit (1);
00555 }
00556 }
00557 initStre.val(1,1) = a[0]; initStre.val(1,2) = a[1]; initStre.val(1,3) = a[2];
00558 initStre.val(2,1) = a[3]; initStre.val(2,2) = a[4]; initStre.val(2,3) = a[5];
00559 initStre.val(3,1) = a[6]; initStre.val(3,2) = a[7]; initStre.val(3,3) = a[8];
00560 }
00561 if (argc > (5 + 18) ) {
00562 double a[9];
00563 for (int j = 0; j < 9; j++) {
00564 if (Tcl_GetDouble(interp, argv[5+10+j], &a[j]) != TCL_OK) {
00565 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[5+10+j] << endln;
00566 exit (1);
00567 }
00568 }
00569 initStra.val(1,1) = a[0]; initStra.val(1,2) = a[1]; initStra.val(1,3) = a[2];
00570 initStra.val(2,1) = a[3]; initStra.val(2,2) = a[4]; initStra.val(2,3) = a[5];
00571 initStra.val(3,1) = a[6]; initStra.val(3,2) = a[7]; initStra.val(3,3) = a[8];
00572 }
00573
00574 ElS = new DM04_Elastic(a1, a2, a3, a4, a5, initStre, initStra);
00575 }
00576
00577
00578 else {
00579 opserr << "Warning: invalid elastic state object: " << argv[0] << endln;
00580 exit(1);
00581 }
00582
00583 cleanup(argv);
00584 return ElS;
00585 }
00586
00587
00588
00589
00590 YieldFunction *EvaluateYieldFunction(ClientData clientData, Tcl_Interp *interp, TCL_Char *tclString)
00591 {
00592 int argc;
00593 TCL_Char **argv;
00594
00595
00596 if (Tcl_SplitList(interp, tclString, &argc, &argv) != TCL_OK) {
00597 exit (1);
00598 }
00599
00600 if (argc == 0)
00601 exit (1);
00602
00603
00604 YieldFunction *YF = NULL;
00605
00606
00607 if ((strcmp(argv[0],"Von-Mises") == 0) || (strcmp(argv[0],"von-Mises") == 0)) {
00608 int a1 = -1; int b1 = 0;
00609 int a2 = -1; int b2 = 0;
00610
00611 if (argc <= 2) {
00612 opserr << "Warning: TclNewTemplate3Dep - Yield Function (VM) - input parameters < 2" << endln;
00613 exit (1);
00614 }
00615
00616 if (argc > 2 ) {
00617 if (Tcl_GetInt(interp, argv[1], &a1) != TCL_OK) {
00618 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[1] << endln;
00619 exit (1);
00620 }
00621 if (Tcl_GetInt(interp, argv[2], &b1) != TCL_OK) {
00622 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[2] << endln;
00623 exit (1);
00624 }
00625 }
00626 if (argc > 4 ) {
00627 if (Tcl_GetInt(interp, argv[3], &a2) != TCL_OK) {
00628 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[3] << endln;
00629 exit (1);
00630 }
00631 if (Tcl_GetInt(interp, argv[4], &b2) != TCL_OK) {
00632 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[4] << endln;
00633 exit (1);
00634 }
00635 }
00636
00637 YF = new VM_YF(a1,b1, a2,b2);
00638 }
00639
00640
00641 else if ( (strcmp(argv[0],"Drucker-Prager") == 0) ) {
00642 int a1 = -1; int b1 = 0;
00643 int a2 = -1; int b2 = 0;
00644 int a3 = -1; int b3 = 0;
00645
00646 if (argc <= 2) {
00647 opserr << "Warning: TclNewTemplate3Dep - Yield Function (DP) - input parameters < 2" << endln;
00648 exit (1);
00649 }
00650
00651 if (argc > 2 ) {
00652 if (Tcl_GetInt(interp, argv[1], &a1) != TCL_OK) {
00653 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[1] << endln;
00654 exit (1);
00655 }
00656 if (Tcl_GetInt(interp, argv[2], &b1) != TCL_OK) {
00657 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[2] << endln;
00658 exit (1);
00659 }
00660 }
00661 if (argc > 4 ) {
00662 if (Tcl_GetInt(interp, argv[3], &a2) != TCL_OK) {
00663 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[3] << endln;
00664 exit (1);
00665 }
00666 if (Tcl_GetInt(interp, argv[4], &b2) != TCL_OK) {
00667 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[4] << endln;
00668 exit (1);
00669 }
00670 }
00671 if (argc > 6 ) {
00672 if (Tcl_GetInt(interp, argv[5], &a3) != TCL_OK) {
00673 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[5] << endln;
00674 exit (1);
00675 }
00676 if (Tcl_GetInt(interp, argv[6], &b3) != TCL_OK) {
00677 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[6] << endln;
00678 exit (1);
00679 }
00680 }
00681
00682 YF = new DP_YF(a1,b1, a2,b2, a3, b3);
00683 }
00684
00685
00686 else if ( (strcmp(argv[0],"Cam-Clay") == 0) ) {
00687 int a1 = -1; int b1 = 0;
00688 int a2 = -1; int b2 = 0;
00689
00690 if (argc <= 4) {
00691 opserr << "Warning: TclNewTemplate3Dep - Yield Function (CC) - input parameters < 4" << endln;
00692 exit (1);
00693 }
00694
00695 if (argc > 4 ) {
00696 if (Tcl_GetInt(interp, argv[1], &a1) != TCL_OK) {
00697 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[1] << endln;
00698 exit (1);
00699 }
00700 if (Tcl_GetInt(interp, argv[2], &b1) != TCL_OK) {
00701 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[2] << endln;
00702 exit (1);
00703 }
00704 if (Tcl_GetInt(interp, argv[3], &a2) != TCL_OK) {
00705 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[3] << endln;
00706 exit (1);
00707 }
00708 if (Tcl_GetInt(interp, argv[4], &b2) != TCL_OK) {
00709 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[4] << endln;
00710 exit (1);
00711 }
00712 }
00713
00714 YF = new CC_YF(a1,b1, a2,b2);
00715 }
00716
00717
00718 else if ( strcmp(argv[0],"Dafalias-Manzari") == 0 ) {
00719 int a1 = -1; int b1 = 0;
00720 int a2 = -1; int b2 = 0;
00721
00722 if (argc <= 2) {
00723 opserr << "Warning: TclNewTemplate3Dep - Yield Function (DM) - input parameters < 2" << endln;
00724 exit (1);
00725 }
00726
00727 if (argc > 2 ) {
00728 if (Tcl_GetInt(interp, argv[1], &a1) != TCL_OK) {
00729 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[1] << endln;
00730 exit (1);
00731 }
00732 if (Tcl_GetInt(interp, argv[2], &b1) != TCL_OK) {
00733 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[2] << endln;
00734 exit (1);
00735 }
00736 if (Tcl_GetInt(interp, argv[3], &a2) != TCL_OK) {
00737 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[3] << endln;
00738 exit (1);
00739 }
00740 if (Tcl_GetInt(interp, argv[4], &b2) != TCL_OK) {
00741 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[4] << endln;
00742 exit (1);
00743 }
00744 }
00745
00746 YF = new DM04_YF(a1,b1, a2,b2);
00747 }
00748
00749
00750 else {
00751 opserr << "Warning: invalid yield function: " << argv[0] << endln;
00752 exit (1);
00753 }
00754
00755 cleanup(argv);
00756 return YF;
00757 }
00758
00759
00760
00761
00762 PlasticFlow *EvaluatePlasticFlow(ClientData clientData, Tcl_Interp *interp, TCL_Char *tclString)
00763 {
00764 int argc;
00765 TCL_Char **argv;
00766
00767
00768 if (Tcl_SplitList(interp, tclString, &argc, &argv) != TCL_OK) {
00769 exit (1);
00770 }
00771
00772 if (argc == 0)
00773 exit (1);
00774
00775
00776 PlasticFlow *PF = NULL;
00777
00778
00779 if ((strcmp(argv[0],"Von-Mises") == 0) || (strcmp(argv[0],"von-Mises") == 0)) {
00780 int a1 = -1; int b1 = 0;
00781
00782
00783
00784
00785
00786
00787 if (argc > 2 ) {
00788 if (Tcl_GetInt(interp, argv[1], &a1) != TCL_OK) {
00789 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[1] << endln;
00790 exit (1);
00791 }
00792 if (Tcl_GetInt(interp, argv[2], &b1) != TCL_OK) {
00793 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[2] << endln;
00794 exit (1);
00795 }
00796 }
00797
00798 PF = new VM_PF(a1,b1);
00799 }
00800
00801
00802 else if ( (strcmp(argv[0],"Drucker-Prager") == 0) ) {
00803 int a1 = -1; int b1 = 0;
00804 int a2 = -1; int b2 = 0;
00805
00806 if (argc <= 2) {
00807 opserr << "Warning: TclNewTemplate3Dep - Plastic Flow (DP) - input parameters < 2" << endln;
00808 exit (1);
00809 }
00810
00811 if (argc > 2 ) {
00812 if (Tcl_GetInt(interp, argv[1], &a1) != TCL_OK) {
00813 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[1] << endln;
00814 exit (1);
00815 }
00816 if (Tcl_GetInt(interp, argv[2], &b1) != TCL_OK) {
00817 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[2] << endln;
00818 exit (1);
00819 }
00820 }
00821 if (argc > 4 ) {
00822 if (Tcl_GetInt(interp, argv[3], &a2) != TCL_OK) {
00823 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[3] << endln;
00824 exit (1);
00825 }
00826 if (Tcl_GetInt(interp, argv[4], &b2) != TCL_OK) {
00827 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[4] << endln;
00828 exit (1);
00829 }
00830 }
00831
00832 PF = new DP_PF(a1,b1, a2,b2);
00833 }
00834
00835
00836 else if ( (strcmp(argv[0],"Cam-Clay") == 0) ) {
00837 int a1 = -1; int b1 = 0;
00838 int a2 = -1; int b2 = 0;
00839
00840 if (argc <= 4) {
00841 opserr << "Warning: TclNewTemplate3Dep - Plastic Flow (CC) - input parameters < 4" << endln;
00842 exit (1);
00843 }
00844
00845 if (argc > 2 ) {
00846 if (Tcl_GetInt(interp, argv[1], &a1) != TCL_OK) {
00847 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[1] << endln;
00848 exit (1);
00849 }
00850 if (Tcl_GetInt(interp, argv[2], &b1) != TCL_OK) {
00851 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[2] << endln;
00852 exit (1);
00853 }
00854 }
00855 if (argc > 4 ) {
00856 if (Tcl_GetInt(interp, argv[3], &a2) != TCL_OK) {
00857 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[3] << endln;
00858 exit (1);
00859 }
00860 if (Tcl_GetInt(interp, argv[4], &b2) != TCL_OK) {
00861 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[4] << endln;
00862 exit (1);
00863 }
00864 }
00865
00866 PF = new CC_PF(a1,b1, a2,b2);
00867 }
00868
00869
00870 else if ( strcmp(argv[0],"Dafalias-Manzari") == 0 ) {
00871 int a[12] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
00872 int b[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
00873
00874 if (argc <= 22) {
00875 opserr << "Warning: TclNewTemplate3Dep - Plastic Flow (DM) - input parameters < 22" << endln;
00876 exit (1);
00877 }
00878
00879 if (argc > 24 ) {
00880 for (int i = 0; i < 12; i++) {
00881 if (Tcl_GetInt(interp, argv[i*2+1], &a[i]) != TCL_OK) {
00882 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[i*2+1] << endln;
00883 exit (1);
00884 }
00885 if (Tcl_GetInt(interp, argv[i*2+2], &b[i]) != TCL_OK) {
00886 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[i*2+2] << endln;
00887 exit (1);
00888 }
00889 }
00890 }
00891
00892 PF = new DM04_PF( a[0],b[0], a[1],b[1], a[2],b[2], a[3],b[3], a[4],b[4], a[5],b[5], a[6],b[6],
00893 a[7],b[7], a[8],b[8], a[9],b[9], a[10],b[10], a[11],b[11]);
00894 }
00895
00896
00897 else {
00898 opserr << "Warning: invalid plastic flow: " << argv[0] << endln;
00899 exit (1);
00900 }
00901
00902 cleanup(argv);
00903 return PF;
00904 }
00905
00906
00907
00908 ScalarEvolution** EvaluateSE(ClientData clientData, Tcl_Interp *interp, TCL_Char *tclString)
00909 {
00910 int argc;
00911 TCL_Char **argv;
00912
00913
00914 if (Tcl_SplitList(interp, tclString, &argc, &argv) != TCL_OK) {
00915 exit (1);
00916 }
00917
00918 int loc = 0;
00919 ScalarEvolution** ISS = NULL;
00920
00921 if (n_is > 0) {
00922 ISS = new ScalarEvolution* [n_is];
00923 if ( ISS == NULL) {
00924 opserr << "Warning: TclNewTemplate3Dep - invalid input " << endln;
00925 exit (1);
00926 }
00927 }
00928 else
00929 return NULL;
00930
00931 for(int i = 0; i < n_is; i++) {
00932
00933
00934 if ( strcmp(argv[loc],"Linear") == 0 ) {
00935 int a1 = 0;
00936 loc++;
00937 if (Tcl_GetInt(interp, argv[loc], &a1) != TCL_OK) {
00938 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[loc] << endln;
00939 exit (1);
00940 }
00941 ISS[i] = new Linear_Eeq(a1);
00942 loc++;
00943 }
00944
00945
00946 else if ( strcmp(argv[0],"Cam-Clay") == 0 ) {
00947 int a[4] = {0,0,0,0};
00948 for (int j = 0; j < 4; j++) {
00949 loc++;
00950 if (Tcl_GetInt(interp, argv[loc], &a[j]) != TCL_OK) {
00951 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[loc] << endln;
00952 exit (1);
00953 }
00954 }
00955 ISS[i] = new CC_Ev(a[0], a[1], a[2], a[4]);
00956 loc++;
00957 }
00958
00959
00960 else {
00961 opserr << "Warning: TclNewTemplate3Dep - unknown scalar evolution: " << argv[loc] << endln;
00962 exit (1);
00963 }
00964
00965 }
00966
00967 cleanup(argv);
00968 return ISS;
00969 }
00970
00971
00972 TensorEvolution** EvaluateTE(ClientData clientData, Tcl_Interp *interp, TCL_Char *tclString)
00973 {
00974 int argc;
00975 TCL_Char **argv;
00976
00977
00978 if (Tcl_SplitList(interp, tclString, &argc, &argv) != TCL_OK) {
00979 exit (1);
00980 }
00981
00982 int loc = 0;
00983 TensorEvolution** ITT = NULL;
00984
00985 if (n_it > 0) {
00986 ITT = new TensorEvolution* [n_is];
00987 if ( ITT == NULL) {
00988 opserr << "Warning: TclNewTemplate3Dep - invalid input " << endln;
00989 exit (1);
00990 }
00991 }
00992 else
00993 return NULL;
00994
00995 for(int i = 0; i < n_it; i++) {
00996
00997
00998 if ( strcmp(argv[loc],"Linear") == 0 ) {
00999 int a1 = 0;
01000 loc++;
01001 if (Tcl_GetInt(interp, argv[loc], &a1) != TCL_OK) {
01002 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[loc] << endln;
01003 exit (1);
01004 }
01005 ITT[i] = new Linear_Eij(a1);
01006 loc++;
01007 }
01008
01009
01010 else if ( strcmp(argv[0],"Armstrong-Frederick") == 0 ) {
01011 int a[3] = {0,0,0};
01012 for (int j = 0; j < 3; j++) {
01013 loc++;
01014 if (Tcl_GetInt(interp, argv[loc], &a[j]) != TCL_OK) {
01015 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[loc] << endln;
01016 exit (1);
01017 }
01018 }
01019 ITT[i] = new AF_Eij(a[0], a[1], a[2]);
01020 loc++;
01021 }
01022
01023
01024 else if ( strcmp(argv[loc],"Dafalias-Manzari") == 0 ) {
01025 int a[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
01026 for (int j = 0; j < 14; j++) {
01027 loc++;
01028 if (Tcl_GetInt(interp, argv[loc], &a[j]) != TCL_OK) {
01029 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[loc] << endln;
01030 exit (1);
01031 }
01032 }
01033 ITT[i] = new DM04_alpha_Eij(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13]);
01034 loc++;
01035 }
01036
01037
01038 else if ( strcmp(argv[loc],"Dafalias-Manzari-fabric") == 0 ) {
01039 int a[5] = {0,0,0,0,0};
01040 for (int j = 0; j < 5; j++) {
01041 loc++;
01042 if (Tcl_GetInt(interp, argv[loc], &a[j]) != TCL_OK) {
01043 opserr << "Warning: TclNewTemplate3Dep - invalid input " << argv[loc] << endln;
01044 exit (1);
01045 }
01046 }
01047 ITT[i] = new DM04_z_Eij(a[0], a[1], a[2], a[3], a[4]);
01048 loc++;
01049 }
01050
01051
01052 else {
01053 opserr << "Warning: TclNewTemplate3Dep - unknown tensor evolution: " << argv[loc] << endln;
01054 exit (1);
01055 }
01056
01057 }
01058
01059 cleanup(argv);
01060 return ITT;
01061 }