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 #include <tcl.h>
00028 #include <OPS_Globals.h>
00029
00030 #include <Domain.h>
00031
00032 #include <ErrorHandler.h>
00033 #include <TclModelBuilder.h>
00034
00035 #include <NeoHookeanCompressible3D.h>
00036 #include <FDdecoupledElastic3D.h>
00037
00038 #include <W.h>
00039 #include <LogWEnergy.h>
00040 #include <MooneyRivlinWEnergy.h>
00041 #include <NeoHookeanWEnergy.h>
00042 #include <OgdenWEnergy.h>
00043 #include <SimoPisterWEnergy.h>
00044 #include <OgdenSimoWEnergy.h>
00045 #include <MooneyRivlinSimoWEnergy.h>
00046
00047
00048
00049
00050
00051
00052 FiniteDeformationElastic3D *
00053 TclModelBuilder_addFiniteDeformationElastic3D(ClientData clientData, Tcl_Interp *interp, int argc,
00054 TCL_Char **argv, TclModelBuilder *theTclBuilder, int eleArgStart)
00055 {
00056
00057
00058
00059 int tag = 0;
00060
00061 int loc = eleArgStart;
00062
00063 FiniteDeformationElastic3D *theMaterial = 0;
00064
00065 if (Tcl_GetInt(interp, argv[loc+1], &tag) != TCL_OK) {
00066 opserr << "Warning: nDMaterial FiniteDeformationElastic3D - invalid tag " << argv[loc+1] << "\n";
00067 exit (-1);
00068 }
00069
00070
00071 if ( (strcmp(argv[loc+2],"NeoHookean3D") == 0) || (strcmp(argv[loc+2],"NeoHookeanCompressible3D") == 0) ) {
00072
00073 double rho_in = 0.0;
00074 double K_in = 0.0;
00075 double G_in = 0.0;
00076
00077 if (argc < 7) {
00078 opserr << "Warning: NeoHookeanCompressible3D -insufficient number of arguments\n";
00079 exit (-1);
00080 }
00081
00082 if (Tcl_GetDouble(interp, argv[loc+3], &K_in) != TCL_OK) {
00083 opserr << "nDMaterial NeoHookeanCompressible3D - invalid K " << argv[loc+3] << "\n";
00084 exit (-1);
00085 }
00086
00087 if (Tcl_GetDouble(interp, argv[loc+4], &G_in) != TCL_OK) {
00088 opserr << "Warning: nDMaterial NeoHookeanCompressible3D - invalid G " << argv[loc+4] << "\n";
00089 exit (-1);
00090 }
00091
00092 if (Tcl_GetDouble(interp, argv[loc+5], &rho_in) != TCL_OK) {
00093 opserr << "Warning: nDMaterial NeoHookeanCompressible3D - invalid rho " << argv[loc+5] << "\n";
00094 exit (-1);
00095 }
00096
00097 theMaterial = new NeoHookeanCompressible3D(tag, K_in, G_in, rho_in);
00098 }
00099
00100
00101 else if ( (strcmp(argv[loc+2],"DecoupledLog3D") == 0) || (strcmp(argv[loc+2],"DecoupledLogarithmic3D") == 0) ) {
00102
00103 double K_in = 0.0;
00104 double G_in = 0.0;
00105 double rho_in = 0.0;
00106 WEnergy *wenergy =0;
00107
00108 if (argc < 7) {
00109 opserr << "Warning: DecoupledLogarithmic3D -insufficient number of arguments\n";
00110 exit (-1);
00111 }
00112
00113 if (Tcl_GetDouble(interp, argv[loc+3], &K_in) != TCL_OK) {
00114 opserr << "Warning: nDMaterial DecoupledLogarithmic3D - invalid K " << argv[loc+3] << "\n";
00115 exit (-1);
00116 }
00117
00118 if (Tcl_GetDouble(interp, argv[loc+4], &G_in) != TCL_OK) {
00119 opserr << "Warning: nDMaterial DecoupledLogarithmic3D - invalid G " << argv[loc+4] << "\n";
00120 exit (-1);
00121 }
00122
00123 if (Tcl_GetDouble(interp, argv[loc+5], &rho_in) != TCL_OK) {
00124 opserr << "Warning: nDMaterial DecoupledLogarithmic3D - invalid rho " << argv[loc+5] << "\n";
00125 exit (-1);
00126 }
00127
00128 wenergy = new LogWEnergy(K_in, G_in);
00129
00130 if ( wenergy != 0 ) {
00131 theMaterial = new FDdecoupledElastic3D(tag, wenergy, rho_in);
00132 }
00133 else {
00134 opserr << "Error: nDMaterial DecoupledLogarithmic3D -invalid material model\n";
00135 exit (-1);
00136 }
00137
00138 }
00139
00140
00141 else if ( (strcmp(argv[loc+2],"DecoupledNeoHookean3D") == 0) || (strcmp(argv[loc+2],"DecoupledNH3D") == 0) ) {
00142
00143 double K_in = 0.0;
00144 double G_in = 0.0;
00145 double rho_in = 0.0;
00146 WEnergy *wenergy =0;
00147
00148 if (argc < 7) {
00149 opserr << "Warning: DecoupledNeoHookean3D -insufficient number of arguments\n";
00150 exit (-1);
00151 }
00152
00153 if (Tcl_GetDouble(interp, argv[loc+3], &K_in) != TCL_OK) {
00154 opserr << "Warning: nDMaterial DecoupledNeoHookean3D - invalid K " << argv[loc+3] << "\n";
00155 exit (-1);
00156 }
00157
00158 if (Tcl_GetDouble(interp, argv[loc+4], &G_in) != TCL_OK) {
00159 opserr << "Warning: nDMaterial DecoupledNeoHookean3D - invalid G " << argv[loc+4] << "\n";
00160 exit (-1);
00161 }
00162
00163 if (Tcl_GetDouble(interp, argv[loc+5], &rho_in) != TCL_OK) {
00164 opserr << "Warning: nDMaterial DecoupledNeoHookean3D - invalid rho " << argv[loc+5] << "\n";
00165 exit (-1);
00166 }
00167
00168 wenergy = new NeoHookeanWEnergy(K_in, G_in);
00169
00170 if ( wenergy != 0 ) {
00171 theMaterial = new FDdecoupledElastic3D(tag, wenergy, rho_in);
00172 }
00173 else {
00174 opserr << "Error: nDMaterial DecoupledNeoHookean3D -invalid material model\n";
00175 exit (-1);
00176 }
00177
00178 }
00179
00180
00181 else if ( (strcmp(argv[loc+2],"DecoupledMooneyRivlinSimo3D") == 0) || (strcmp(argv[loc+2],"DecoupledMRS3D") == 0) ) {
00182
00183 double c1_in = 0.0;
00184 double c2_in = 0.0;
00185 double K_in = 0.0;
00186 double rho_in = 0.0;
00187 WEnergy *wenergy =0;
00188
00189 if (argc < 8) {
00190 opserr << "Warning: DecoupledNeoHookean3D -insufficient number of arguments\n";
00191 exit (-1);
00192 }
00193
00194 if (Tcl_GetDouble(interp, argv[loc+3], &c1_in) != TCL_OK) {
00195 opserr << "Warning: nDMaterial DecoupledNeoHookean3D - invalid c1 " << argv[loc+3] << "\n";
00196 exit (-1);
00197 }
00198
00199 if (Tcl_GetDouble(interp, argv[loc+4], &c2_in) != TCL_OK) {
00200 opserr << "Warning: nDMaterial DecoupledNeoHookean3D - invalid c2 " << argv[loc+4] << "\n";
00201 exit (-1);
00202 }
00203
00204 if (Tcl_GetDouble(interp, argv[loc+5], &K_in) != TCL_OK) {
00205 opserr << "Warning: nDMaterial DecoupledNeoHookean3D - invalid K " << argv[loc+5] << "\n";
00206 exit (-1);
00207 }
00208
00209 if (Tcl_GetDouble(interp, argv[loc+6], &rho_in) != TCL_OK) {
00210 opserr << "Warning: nDMaterial DecoupledNeoHookean3D - invalid rho " << argv[loc+6] << "\n";
00211 exit (-1);
00212 }
00213
00214 wenergy = new MooneyRivlinSimoWEnergy(c1_in, c2_in, K_in);
00215
00216 if ( wenergy != 0 ) {
00217 theMaterial = new FDdecoupledElastic3D(tag, wenergy, rho_in);
00218 }
00219 else {
00220 opserr << "Error: nDMaterial DecoupledMooneyRivlinSimo3D -invalid material model\n";
00221 exit (-1);
00222 }
00223
00224 }
00225
00226
00227 else if ( (strcmp(argv[loc+2],"DecoupledOgdenSimo3D") == 0) || (strcmp(argv[loc+2],"DecoupledOS3D") == 0) ) {
00228
00229 int N_in = 0;
00230 double K_in = 0.0;
00231 double rho_in = 0.0;
00232 WEnergy *wenergy =0;
00233
00234 if (argc > 2*N_in+5) {
00235 if (Tcl_GetInt(interp, argv[loc+3], &N_in) != TCL_OK) {
00236 opserr << "Warning: invalid vector parameter number for Ogden Strain Energy Function\n";
00237 exit (-1);
00238 }
00239
00240 double *cr_in = new double[N_in];
00241 double *mur_in = new double[N_in];
00242
00243 for (int i=0; i<N_in; i++) {
00244 if (Tcl_GetDouble(interp, argv[loc+4+i], &cr_in[i]) != TCL_OK) {
00245 opserr << "Warning: invalid parameter for Ogden Strain Energy Function\n";
00246 exit (-1);
00247 }
00248 if (Tcl_GetDouble(interp, argv[loc+4+N_in+i], &mur_in[i]) != TCL_OK) {
00249 opserr << "Warning: invalid parameter for Ogden Strain Energy Function\n";
00250 exit (-1);
00251 }
00252 }
00253
00254 if (Tcl_GetDouble(interp, argv[loc+2*N_in+4], &K_in) != TCL_OK) {
00255 opserr << "Warning: invalid Bulk Modulus number for Ogden Strain Energy Function\n";
00256 exit (-1);
00257 }
00258
00259 if (Tcl_GetDouble(interp, argv[loc+2*N_in+5], &rho_in) != TCL_OK) {
00260 opserr << "Warning: nDMaterial DecoupledSimoPister3D - invalid rho\n";
00261 exit (-1);
00262 }
00263
00264 wenergy = new OgdenSimoWEnergy(N_in, cr_in, mur_in, K_in);
00265
00266 if ( wenergy != 0 ) {
00267 theMaterial = new FDdecoupledElastic3D(tag, wenergy, rho_in);
00268
00269
00270 }
00271 else {
00272 opserr << "Error: nDMaterial DecoupledOgdenSimo3D -invalid material model\n";
00273 exit (-1);
00274 }
00275
00276 }
00277 }
00278
00279
00280 else if ( (strcmp(argv[loc+2],"DecoupledMooneyRivlin3D") == 0) || (strcmp(argv[loc+2],"DecoupledMR3D") == 0) ) {
00281
00282 double c1_in = 0.0;
00283 double c2_in = 0.0;
00284 double rho_in = 0.0;
00285 WEnergy *wenergy =0;
00286
00287 if (argc < 7) {
00288 opserr << "Warning: DecoupledNeoHookean3D -insufficient number of arguments\n";
00289 exit (-1);
00290 }
00291
00292 if (Tcl_GetDouble(interp, argv[loc+3], &c1_in) != TCL_OK) {
00293 opserr << "Warning: nDMaterial DecoupledNeoHookean3D - invalid c1 " << argv[loc+3] << "\n";
00294 exit (-1);
00295 }
00296
00297 if (Tcl_GetDouble(interp, argv[loc+4], &c2_in) != TCL_OK) {
00298 opserr << "Warning: nDMaterial DecoupledNeoHookean3D - invalid c2 " << argv[loc+4] << "\n";
00299 exit (-1);
00300 }
00301
00302 if (Tcl_GetDouble(interp, argv[loc+5], &rho_in) != TCL_OK) {
00303 opserr << "Warning: nDMaterial DecoupledNeoHookean3D - invalid rho " << argv[loc+5] << "\n";
00304 exit (-1);
00305 }
00306
00307 wenergy = new MooneyRivlinWEnergy(c1_in, c2_in);
00308
00309 if ( wenergy != 0 ) {
00310 theMaterial = new FDdecoupledElastic3D(tag, wenergy, rho_in);
00311 }
00312 else {
00313 opserr << "Error: nDMaterial DecoupledMooneyRivlin3D -invalid material model\n";
00314 exit (-1);
00315 }
00316
00317 }
00318
00319
00320 else if ( (strcmp(argv[loc+2],"DecoupledOgden3D") == 0) ) {
00321
00322 int N_in = 0;
00323 double rho_in = 0.0;
00324 WEnergy *wenergy =0;
00325
00326 if (argc > 2*N_in+4) {
00327 if (Tcl_GetInt(interp, argv[loc+3], &N_in) != TCL_OK) {
00328 opserr << "Warning: invalid vector parameter number for Ogden Strain Energy Function\n";
00329 exit (-1);
00330 }
00331
00332 double *cr_in = new double[N_in];
00333 double *mur_in = new double[N_in];
00334
00335 for (int i=0; i<N_in; i++) {
00336 if (Tcl_GetDouble(interp, argv[loc+4+i], &cr_in[i]) != TCL_OK) {
00337 opserr << "Warning: invalid parameter for Ogden Strain Energy Function\n";
00338 exit (-1);
00339 }
00340 if (Tcl_GetDouble(interp, argv[loc+4+N_in+i], &mur_in[i]) != TCL_OK) {
00341 opserr << "Warning: invalid parameter for Ogden Strain Energy Function\n";
00342 exit (-1);
00343 }
00344 }
00345
00346 if (Tcl_GetDouble(interp, argv[loc+2*N_in+4], &rho_in) != TCL_OK) {
00347 opserr << "Warning: nDMaterial Ogden - invalid rho\n";
00348 exit (-1);
00349 }
00350
00351 wenergy = new OgdenWEnergy(N_in, cr_in, mur_in);
00352
00353 if ( wenergy != 0 ) {
00354 theMaterial = new FDdecoupledElastic3D(tag, wenergy, rho_in);
00355
00356
00357 }
00358 else {
00359 opserr << "Error: nDMaterial DecoupledOgden3D -invalid material model\n";
00360 exit (-1);
00361 }
00362
00363 }
00364 }
00365
00366
00367 else if ( (strcmp(argv[loc+2],"DecoupledSimoPister3D") == 0) || (strcmp(argv[loc+2],"DecoupledSP3D") == 0) ) {
00368
00369 double K_in = 0.0;
00370 double rho_in = 0.0;
00371 WEnergy *wenergy =0;
00372
00373 if (argc < 6) {
00374 opserr << "Warning: DecoupledSimoPister3D -insufficient number of arguments\n";
00375 exit (-1);
00376 }
00377
00378 if (Tcl_GetDouble(interp, argv[loc+3], &K_in) != TCL_OK) {
00379 opserr << "Warning: nDMaterial DecoupledSimoPister3D - invalid K " << argv[loc+3] << "\n";
00380 exit (-1);
00381 }
00382
00383 if (Tcl_GetDouble(interp, argv[loc+4], &rho_in) != TCL_OK) {
00384 opserr << "Warning: nDMaterial DecoupledSimoPister3D - invalid rho " << argv[loc+4] << "\n";
00385 exit (-1);
00386 }
00387
00388 wenergy = new SimoPisterWEnergy(K_in);
00389
00390 if ( wenergy != 0 ) {
00391 theMaterial = new FDdecoupledElastic3D(tag, wenergy, rho_in);
00392 }
00393 else {
00394 opserr << "Error: nDMaterial DecoupledSimoPister3D -invalid material model\n";
00395 exit (-1);
00396 }
00397
00398 }
00399
00400
00401 else {
00402 opserr << "Error: nDMaterial - unknown FiniteDeformationElastic3D material model\n";
00403 exit (-1);
00404 }
00405
00406
00407
00408 return theMaterial;
00409
00410 }
00411
00412
00413
00414