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
00027
00028
00029 #include <stdlib.h>
00030 #include <string.h>
00031 #include <Domain.h>
00032
00033 #include <ErrorHandler.h>
00034 #include <TwentyNodeBrick.h>
00035 #include <TwentyNodeBrick_u_p_U.h>
00036 #include <TclModelBuilder.h>
00037
00038 extern void printCommand(int argc, TCL_Char **argv);
00039
00040 int
00041 TclModelBuilder_addTwentyNodeBrick_u_p_U(ClientData clientData, Tcl_Interp *interp, int argc,
00042 TCL_Char **argv, Domain *theTclDomain,
00043 TclModelBuilder *theTclBuilder, int eleArgStart)
00044 {
00045
00046 if (theTclBuilder == 0) {
00047 opserr << "command: element Brick20N_u_p_U - no modelbuilder\n";
00048 return TCL_ERROR;
00049 }
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 if ((argc-eleArgStart) < 35) {
00061 opserr << "command: element Brick20N_u_p_U - insufficient args - want " <<
00062 "element Brick20N_u_p_U eleTag? node1? node2? .. node20? matTag? bforce1? bforce2? bforce3?\n" <<
00063 "porosity? alpha? solidDensity? fluidDensity? \n" <<
00064 "permeability_in_x_dir? permeability_in_y_dir? permeability_in_z_dir?" <<
00065 "solid_bulk_modulus, fluid_bulk_modulus? pressure?\n";
00066 return TCL_ERROR;
00067 }
00068
00069
00070 int eleID, matID;
00071 int nodes[20];
00072 double bodyforces[3], porosity, alpha, solidDensity, fluidDensity;
00073 double perm_x, perm_y, perm_z,kks, kkf;
00074
00075
00076
00077 if (Tcl_GetInt(interp, argv[1+eleArgStart], &eleID) != TCL_OK) {
00078 opserr << "command: element Brick20N_u_p_U - invalid integer tag " << argv[1+eleArgStart] << "\n";
00079
00080
00081 return TCL_ERROR;
00082 }
00083
00084
00085 int i;
00086 for (i=0; i<20; i++) {
00087 if (Tcl_GetInt(interp, argv[2+i+eleArgStart], &nodes[i]) != TCL_OK) {
00088 opserr << "command: element Brick20N_u_p_U " << eleID << " - invalid integer tag " << argv[2+i+eleArgStart] << endln;
00089 return TCL_ERROR;
00090 }
00091 }
00092
00093
00094 if (Tcl_GetInt(interp, argv[22+eleArgStart], &matID) != TCL_OK) {
00095 opserr << "command: element Brick20N_u_p_U " << eleID << " - invalid matID tag " << argv[22+eleArgStart] << "\n";
00096 return TCL_ERROR;
00097 }
00098
00099 NDMaterial *theMaterial = theTclBuilder->getNDMaterial(matID);
00100
00101 if (theMaterial == 0) {
00102 opserr << "command: element Brick20N_u_p_U " << eleID << " - no NDMaterial with tag " << argv[22+eleArgStart] << " exists\n";
00103 return TCL_ERROR;
00104 }
00105
00106
00107
00108
00109 for (i=0; i<3; i++) {
00110 if (Tcl_GetDouble(interp, argv[23+i+eleArgStart], &bodyforces[i]) != TCL_OK) {
00111 opserr << "command: element Brick20N_u_p_U " << eleID << " - invalid bodyforces tag " << argv[23+i+eleArgStart] << "\n";
00112 return TCL_ERROR;
00113 }
00114 }
00115
00116
00117 if (Tcl_GetDouble(interp, argv[26+eleArgStart], &porosity) != TCL_OK) {
00118 opserr << "command: element Brick20N_u_p_U " << eleID << " - invalid porosity " << argv[26+eleArgStart] << endln;
00119 return TCL_ERROR;
00120 }
00121
00122
00123 if (Tcl_GetDouble(interp, argv[27+eleArgStart], &alpha) != TCL_OK) {
00124 opserr << "command: element Brick20N_u_p_U " << eleID << " - invalid alpha " << argv[27+eleArgStart] << endln;
00125 return TCL_ERROR;
00126 }
00127
00128
00129 if (Tcl_GetDouble(interp, argv[28+eleArgStart], &solidDensity) != TCL_OK) {
00130 opserr << "command: element Brick20N_u_p_U " << eleID << " - invalid solidDensity " << argv[28+eleArgStart] << endln;
00131 return TCL_ERROR;
00132 }
00133
00134
00135 if (Tcl_GetDouble(interp, argv[29+eleArgStart], &fluidDensity) != TCL_OK) {
00136 opserr << "command: element Brick20N_u_p_U " << eleID << " - invalid fluidDensity " << argv[29+eleArgStart] << endln;
00137 return TCL_ERROR;
00138 }
00139
00140 if (Tcl_GetDouble(interp, argv[30+eleArgStart], &perm_x) != TCL_OK) {
00141 opserr << "command: element Brick20N_u_p_U " << eleID << " - invalid permeability in x direction " << argv[30+eleArgStart] << endln;
00142 return TCL_ERROR;
00143 }
00144
00145 if (Tcl_GetDouble(interp, argv[31+eleArgStart], &perm_y) != TCL_OK) {
00146 opserr << "command: element Brick20N_u_p_U " << eleID << " - invalid permeability in y direction " << argv[31+eleArgStart] << endln;
00147 return TCL_ERROR;
00148 }
00149
00150 if (Tcl_GetDouble(interp, argv[32+eleArgStart], &perm_z) != TCL_OK) {
00151 opserr << "command: element Brick20N_u_p_U " << eleID << " - invalid permeability in z direction " << argv[32+eleArgStart] << endln;
00152 return TCL_ERROR;
00153 }
00154
00155 if (Tcl_GetDouble(interp, argv[33+eleArgStart], &kks) != TCL_OK) {
00156 opserr << "command: element Brick8_u_p_U " << eleID << " - invalid bulk modulus of solid " << argv[33+eleArgStart] << endln;
00157 return TCL_ERROR;
00158 }
00159
00160 if (Tcl_GetDouble(interp, argv[34+eleArgStart], &kkf) != TCL_OK) {
00161 opserr << "command: element Brick8_u_p_U " << eleID << " - invalid bulk modulus of fluid " << argv[34+eleArgStart] << endln;
00162 return TCL_ERROR;
00163 }
00164
00165
00166 TwentyNodeBrick_u_p_U *theEle = new TwentyNodeBrick_u_p_U(eleID, nodes[ 0], nodes [1], nodes[ 2], nodes[ 3], nodes[ 4],
00167 nodes[ 5], nodes [6], nodes[ 7], nodes[ 8], nodes[ 9],
00168 nodes[10], nodes[11], nodes[12], nodes[13], nodes[14],
00169 nodes[15], nodes[16], nodes[17], nodes[18], nodes[19],
00170 theMaterial, bodyforces[0], bodyforces[1], bodyforces[2],
00171 porosity, alpha, solidDensity, fluidDensity,
00172 perm_x, perm_y, perm_z, kks, kkf, 0.0);
00173
00174 if (theEle == 0) {
00175 opserr << "command: element Brick20N_u_p_U " << eleID << " - out of memory\n";
00176 return TCL_ERROR;
00177 }
00178
00179 if (theTclDomain->addElement(theEle) == false) {
00180 opserr << "command: element Brick20N_u_p_U " << eleID << " - could not add ele to domain\n";
00181 delete theEle;
00182 return TCL_ERROR;
00183 }
00184
00185
00186 return TCL_OK;
00187 }
00188
00189
00190