TclTwentyNodeBrick_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 //
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   // ensure the destructor has not been called - 
00046   if (theTclBuilder == 0) {
00047       opserr << "command: element Brick20N_u_p_U - no modelbuilder\n";
00048       return TCL_ERROR;
00049   }
00050 
00051   // check the number of arguments is correct
00052   // should have 36 arguments.  
00053   //  element  Brick20N_u_p_U eleTag?  node1? node2? .. node20?  matTag?   bforce1?  bforce2?  bforce3?\n
00054   //  argv[0]   argv[1]       argv[2] argv[3]                    argv[23]  argv[24]  argv[25]  argv[26]
00055   //  porosity?  alpha?  solidDensity? fluidDensity? x_permeability? y_permeability? z_permeability?
00056   //  argv[27]  argv[28]   argv[29]      argv[30]       argv[31]          argv[32]      argv[33]
00057   //  solid_bulk_modulus? fluid_bulk_modulus?   pressure?
00058   //       argv[34]            argv[35]          argv[36] 
00059   // Xiaoyan added this comments. 01/07/2002
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   // get the id and end nodes 
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   //char *type;
00075   
00076   // read the eleTag
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   // read the 20 node tags
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   // read in material tag & check the material exists in the model builder
00094   if (Tcl_GetInt(interp, argv[22+eleArgStart], &matID) != TCL_OK) {          // argv[23]  Xiaoyan 01/07/2002
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   //type = argv[11+eleArgStart];
00107 
00108   // read the 3 bodyforce accel's 
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   // now get the porosity
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   // now get the alpha for solid alpha=1.0
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    // now get the solidDensity
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    // now get the fluidDensity
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   // permeability in x direction
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   // permeability in y direction
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   // permeability in z direction
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   // now get the bulk modulus of solid
00155   if (Tcl_GetDouble(interp, argv[33+eleArgStart], &kks) != TCL_OK) {        // wxy added 01/07/2002
00156     opserr << "command: element Brick8_u_p_U " << eleID << "  - invalid bulk modulus of solid " << argv[33+eleArgStart] << endln;      
00157     return TCL_ERROR;
00158   }  
00159   // now get the bulk modulus of fluid
00160   if (Tcl_GetDouble(interp, argv[34+eleArgStart], &kkf) != TCL_OK) {        // wxy added 01/07/2002
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   // now create the EightNodeBrick and add it to the Domain
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   // if get here we have sucessfully created the node and added it to the domain
00186   return TCL_OK;
00187 }
00188 
00189 
00190 

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