TclEightNodeBrick_u_p_U.cpp

Go to the documentation of this file.
00001 
00002 //
00003 // COPYRIGHT (C):     :-))
00004 // PROJECT:           Object Oriented Finite Element Program
00005 // FILE:             
00006 // CLASS:            
00007 // MEMBER FUNCTIONS:
00008 //
00009 // MEMBER VARIABLES
00010 //
00011 // PURPOSE:           Finite Element Class for coupled system
00012 // RETURN:
00013 // VERSION:
00014 // LANGUAGE:          C++.ver >= 3.0
00015 // TARGET OS:         DOS || UNIX || . . .
00016 // DESIGNER:          Boris Jeremic, Xiaoyan Wu
00017 // PROGRAMMER:        Boris Jeremic, Xiaoyan Wu
00018 // DATE:              Sept. 2001
00019 //
00020 //  "Coupled system": Solid and fluid coexist.
00021 //                    u-- Solid displacement
00022 //                    p-- Pore pressure
00023 //                    U-- Absolute fluid displacement
00024 //
00025 //
00027 
00028 #include <stdlib.h>
00029 #include <string.h>
00030 #include <Domain.h>
00031 
00032 #include <ErrorHandler.h>
00033 #include <EightNodeBrick_u_p_U.h>
00034 #include <TclModelBuilder.h>
00035 
00036 extern void printCommand(int argc, TCL_Char **argv);
00037 
00038 int
00039 TclModelBuilder_addEightNodeBrick_u_p_U(ClientData clientData, Tcl_Interp *interp,  int argc, 
00040                                         TCL_Char **argv, Domain *theTclDomain,
00041                                         TclModelBuilder *theTclBuilder, int eleArgStart)
00042 {
00043   // ensure the destructor has not been called - 
00044   if (theTclBuilder == 0) {
00045       opserr << "command: element Brick8_u_p_U - no modelbuilder\n";
00046       return TCL_ERROR;
00047   }
00048 
00049   // check the number of arguments is correct
00050  
00051   //  element  Brick20N_u_p_U eleTag?  node1? node2? .. node8?  matTag?   bforce1?  bforce2?  bforce3?\n
00052   //  argv[0]   argv[1]       argv[2] argv[3]                  argv[11]  argv[12]  argv[13]  argv[14]
00053   //  porosity?  alpha?  solidDensity? fluidDensity?  x_permeability? y_permeability? z_permeability? 
00054   //  argv[15]  argv[16]   argv[17]      argv[18]        argv[19]          argv[20]      argv[21]     
00055   //  solid_bulk_modulus? fluid_bulk_modulus?   pressure?
00056   //       argv[22]            argv[23]          argv[24] 
00057   // Xiaoyan added this comments. 01/07/2002
00058 
00059   if ((argc-eleArgStart) < 23) {
00060       opserr << "command: element Brick8_u_p_U - insufficient args - want %s",
00061           "element Brick8_u_p_U eleTag? node1? node2? ... node8? matTag? bforce1? bforce2? bforce3? \n"
00062           " porosity? alpha? solidDensity? fluidDensity? \n"
00063           "permeability_in_x_dir? permeability_in_y_dir? permeability_in_z_dir?"
00064           "solid_bulk_modulus? fluid_bulk_modulus? pressure?\n";
00065       return TCL_ERROR;
00066   }    
00067 
00068   // get the id and end nodes 
00069   int eleID, matID;
00070   int nodes[8];                                   
00071   double bodyforces[3], porosity, alpha, solidDensity, fluidDensity;
00072   double perm_x, perm_y, perm_z, kks, kkf;
00073   //char *type;
00074   
00075   // read the eleTag
00076   if (Tcl_GetInt(interp, argv[1+eleArgStart], &eleID) != TCL_OK) {
00077       opserr << "command: element Brick8_u_p_U - invalid integer tag " <<      
00078         argv[1+eleArgStart] << endln;
00079 
00080       return TCL_ERROR;
00081   }
00082   
00083   // read the 8 node tags
00084   int i;
00085   for (i=0; i<8; i++) {
00086     if (Tcl_GetInt(interp, argv[2+i+eleArgStart], &nodes[i]) != TCL_OK) {
00087       opserr << "command: element Brick8_u_p_U " << eleID << " - invalid integer tag " <<      
00088         argv[2+i+eleArgStart] << endln;
00089       return TCL_ERROR;
00090     }
00091   }
00092   
00093   // read in material tag & check the material exists in the model builder
00094   if (Tcl_GetInt(interp, argv[10+eleArgStart], &matID) != TCL_OK) {
00095     opserr << "command: element Brick8_u_p_U " << eleID << " - invalid matID tag " <<      
00096       argv[10+eleArgStart] << endln;      
00097     return TCL_ERROR;
00098   }
00099   
00100   NDMaterial *theMaterial = theTclBuilder->getNDMaterial(matID);
00101   
00102   if (theMaterial == 0) {
00103     opserr << "command: element Brick8_u_p_U " << eleID << " - no NDMaterial with tag %s exists" <<
00104       argv[10+eleArgStart] << endln;      
00105     return TCL_ERROR;      
00106   }
00107   
00108   //type = argv[11+eleArgStart];
00109   
00110   // read the 3 bodyforce accel's 
00111   for (i=0; i<3; i++) {
00112     if (Tcl_GetDouble(interp, argv[11+i+eleArgStart], &bodyforces[i]) != TCL_OK) {
00113       opserr << "command: element Brick8_u_p_U " << eleID << " - invalid bodyforces tag " <<      
00114         argv[11+i+eleArgStart] << endln;
00115       return TCL_ERROR;
00116     }
00117   }
00118   
00119   // now get the porosity
00120   if (Tcl_GetDouble(interp, argv[14+eleArgStart], &porosity) != TCL_OK) {              // wxy added 01/07/2002
00121     opserr << "command: element Brick8_u_p_U " << eleID << " - invalid porosity " <<      
00122       argv[14+eleArgStart] << endln;      
00123     return TCL_ERROR;
00124   }  
00125   
00126   // now get the alpha
00127   if (Tcl_GetDouble(interp, argv[15+eleArgStart], &alpha) != TCL_OK) {        // wxy added 01/07/2002
00128     opserr << "command: element Brick8_u_p_U " << eleID << " - invalid alpha " <<      
00129       argv[15+eleArgStart] << endln;      
00130     return TCL_ERROR;
00131   }  
00132   
00133   // now get the soldDensity
00134   
00135   if (Tcl_GetDouble(interp, argv[16+eleArgStart], &solidDensity) != TCL_OK) {         // wxy added 01/07/2002
00136     opserr << "command: element Brick8_u_p_U " << eleID << " - invalid solidDensity " <<      
00137       argv[16+eleArgStart] << endln;      
00138     return TCL_ERROR;
00139   }    
00140   
00141   // now get the fludiDensity
00142   if (Tcl_GetDouble(interp, argv[17+eleArgStart], &fluidDensity) != TCL_OK) {        // wxy added 01/07/2002
00143     opserr << "command: element Brick8_u_p_U " << eleID << " - invalid fluidDensity " <<      
00144       argv[17+eleArgStart] << endln;      
00145     return TCL_ERROR;
00146   }  
00147   
00148   
00149   // now get the permeability in x direction
00150   if (Tcl_GetDouble(interp, argv[18+eleArgStart], &perm_x) != TCL_OK) {        // wxy added 01/07/2002
00151     opserr << "command: element Brick8_u_p_U " << eleID << " - invalid permeability in x direction " <<      
00152       argv[18+eleArgStart] << endln;      
00153     return TCL_ERROR;
00154   }  
00155   // now get the permeability in y direction
00156   if (Tcl_GetDouble(interp, argv[19+eleArgStart], &perm_y) != TCL_OK) {        // wxy added 01/07/2002
00157     opserr << "command: element Brick8_u_p_U " << eleID << " - invalid permeability in y direction " <<      
00158       argv[19+eleArgStart] << endln;      
00159     return TCL_ERROR;
00160   }  
00161   // now get the permeability in z direction
00162   if (Tcl_GetDouble(interp, argv[20+eleArgStart], &perm_z) != TCL_OK) {        // wxy added 01/07/2002
00163     opserr << "command: element Brick8_u_p_U " << eleID << " - invalid permeability in z direction " <<      
00164       argv[20+eleArgStart] << endln;      
00165     return TCL_ERROR;
00166   }  
00167   
00168   // now get the bulk modulus of solid
00169   if (Tcl_GetDouble(interp, argv[21+eleArgStart], &kks) != TCL_OK) {        // wxy added 01/07/2002
00170     opserr << "command: element Brick8_u_p_U " << eleID << " - invalid bulk modulus of solid " <<      
00171       argv[21+eleArgStart] << endln;      
00172     return TCL_ERROR;
00173   }  
00174   
00175   // now get the bulk modulus of fluid
00176   if (Tcl_GetDouble(interp, argv[22+eleArgStart], &kkf) != TCL_OK) {        // wxy added 01/07/2002
00177     opserr << "command: element Brick8_u_p_U " << eleID << " - invalid bulk modulus of fluid " <<      
00178       argv[21+eleArgStart] << endln;      
00179     return TCL_ERROR;
00180   }  
00181   // now create the EightNodeBrick and add it to the Domain
00182   EightNodeBrick_u_p_U *theEle = new EightNodeBrick_u_p_U(eleID,nodes[0], nodes[1], nodes[2], nodes[3], nodes[4],
00183                                                           nodes[5],nodes[6], nodes[7], theMaterial, 
00184                                                           bodyforces[0], bodyforces[1], bodyforces[2], 
00185                                                           porosity, alpha, solidDensity, fluidDensity, 
00186                                                           perm_x, perm_y, perm_z, kks, kkf,0.0);
00187   
00188   if (theEle == 0) {
00189     opserr << "command: element Brick8_u_p_U " << eleID << " - out of memory\n";
00190     return TCL_ERROR;
00191   }
00192   
00193   if (theTclDomain->addElement(theEle) == false) {
00194     opserr << "command: element Brick8_u_p_U " << eleID << " - could not add ele to domain\n";
00195     delete theEle;
00196     return TCL_ERROR;
00197   }
00198 
00199   // if get here we have sucessfully created the node and added it to the domain
00200   return TCL_OK;
00201 }
00202 
00203 
00204 

Generated on Mon Oct 23 15:05:12 2006 for OpenSees by doxygen 1.5.0