EightNodeBrick.cpp

Go to the documentation of this file.
00001 
00002 //
00003 // COPYLEFT (C):     :-))
00004 //``This  source code is Copyrighted in U.S., by the The Regents of the University
00005 //of California, for an indefinite period, and anybody caught using it without our
00006 //permission,  will  be  mighty  good friends of ourn, cause we don't give a darn.
00007 //Hack  it.  Compile it. Debug it. Run it. Yodel it. Enjoy it. We wrote it, that's
00008 //all we wanted to do.'' bj
00009 // PROJECT:           Object Oriented Finite Element Program
00010 // FILE:              EightNodeBrick.cpp
00011 // CLASS:             EightNodeBrick
00012 // MEMBER FUNCTIONS:
00013 //
00014 // MEMBER VARIABLES
00015 //
00016 // PURPOSE:           Finite Element Class
00017 // RETURN:
00018 // VERSION:
00019 // LANGUAGE:          C++
00020 // TARGET OS:         DOS || UNIX || . . .
00021 // DESIGNER:          Boris Jeremic, Zhaohui Yang and Xiaoyan Wu
00022 // PROGRAMMER:        Boris Jeremic, Zhaohui Yang  and Xiaoyan Wu
00023 // DATE:              Aug. 2000
00024 // UPDATE HISTORY:    Modified from Brick3D and FourNodeQuad.hh  07/06/00
00025 //                    Sept. - Oct 2000 connected to OpenSees by Zhaohui
00026 //                    Sept 2001 optimized to some extent (static tensors...)
00027 //                    May 2004 Guanzhou added update()
00028 //                    Mar2005 Guanzhou fixes EightNodeBrick::update(void)
00029 //
00030 //
00032 //
00033 
00034 #ifndef EIGHTNODEBRICK_CPP
00035 #define EIGHTNODEBRICK_CPP
00036 
00037 #include <EightNodeBrick.h>
00038 #define FixedOrder 2
00039 
00040 Matrix EightNodeBrick::K(24, 24);      
00041 Matrix EightNodeBrick::C(24, 24);      
00042 Matrix EightNodeBrick::M(24, 24);      
00043 Vector EightNodeBrick::P(24);         
00044 Vector InfoP(FixedOrder*FixedOrder*FixedOrder*4+1); //Plastic info(coor+pls) 32+1 2X2X2
00045 Vector InfoP1(FixedOrder*FixedOrder*FixedOrder+1); //Plastic info, no Gauss point coordinates
00046 Vector InfoS(FixedOrder*FixedOrder*FixedOrder*6+1); //Stress 8*6+1  2X2X2
00047 Vector InfoSpq(2); //p and q of count/2
00048 Vector InfoSpq_all(2*FixedOrder*FixedOrder*FixedOrder+4); //p and q of all GS points + Sig11-33 +Strain_plastic_vv +psi
00049 Vector Gsc8(FixedOrder*FixedOrder*FixedOrder*3+1); //Gauss point coordinates
00050 
00051 //====================================================================
00052 //Reorganized constructor ____ Zhaohui 02-10-2000
00053 //====================================================================
00054 
00055 EightNodeBrick::EightNodeBrick(int element_number,
00056                                int node_numb_1, int node_numb_2, int node_numb_3, int node_numb_4,
00057                                int node_numb_5, int node_numb_6, int node_numb_7, int node_numb_8,
00058                                NDMaterial * Globalmmodel, double b1, double b2,double b3,
00059              double r, double p)
00060                    
00061   :Element(element_number, ELE_TAG_EightNodeBrick ),
00062   connectedExternalNodes(8), Ki(0), Q(24), bf(3), 
00063   rho(r), pressure(p)
00064   {
00065 //BJ//BJ
00066 //BJ    opserr << "\n\n\n\n Print in EightNodeBrick::EightNodeBrick" <<endln; this->Print(opserr);
00067 //BJ//BJ
00068     //elem_numb = element_number;
00069     bf(0) = b1;
00070     bf(1) = b2;
00071     bf(2) = b3;
00072 
00073     determinant_of_Jacobian = 0.0;
00074     
00075     //r_integration_order = r_int_order; 
00076     //s_integration_order = s_int_order; 
00077     //t_integration_order = t_int_order; 
00078     r_integration_order = FixedOrder; // Gauss-Legendre integration order in r direction
00079     s_integration_order = FixedOrder; // Gauss-Legendre integration order in s direction
00080     t_integration_order = FixedOrder; // Gauss-Legendre integration order in t direction
00081     //Not needed. Right now we have one NDMaterial for each material point
00082     //mmodel = Globalmmodel->getCopy( type ); // One global mat model
00083 
00084     int total_number_of_Gauss_points = r_integration_order*s_integration_order*t_integration_order;
00085     
00086 
00087     if ( total_number_of_Gauss_points != 0 )
00088       {
00089          matpoint  = new MatPoint3D * [total_number_of_Gauss_points];
00090       }
00091     else
00092       {
00093   //GPstress = 0;//GPiterative_stress = 0;//GPq_ast_iterative  = 0; //GPstrain = 0;//GPtangent_E = 0;
00094         matpoint  = 0;
00095     }
00097     //dakle posto:
00099     //onda oni vec postoje u memoriji i samo im treba dodeliti prave
00100     //vrednosti iz onog modela koji je prenesen unutra. Znaci onInitializxe funkcija
00101     //sa modelom kao argumentom Initialize(taj_Model).
00102     //za stresstensor i straintensor isto to napravi
00103     //tu Initialize funkciju pa da uzima argument i da samo
00104     //koristi njegove vrednosti pa stavi u vec postojece mesto
00105     //u memoriji ove vrednsoti. Takodje unutar brick3d napravi ih
00106     //( te stresstensor , straintensor i mmodel ) static da ostanu tu
00107     //da se ne pozove destructor . . .
00108 
00109     short where = 0;
00110 
00111     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
00112       {
00113         double r = get_Gauss_p_c( r_integration_order, GP_c_r );
00114         double rw = get_Gauss_p_w( r_integration_order, GP_c_r );
00115 
00116         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
00117           {
00118             double s = get_Gauss_p_c( s_integration_order, GP_c_s );
00119             double sw = get_Gauss_p_w( s_integration_order, GP_c_s );
00120 
00121             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
00122               {
00123                 double t = get_Gauss_p_c( t_integration_order, GP_c_t );
00124                 double tw = get_Gauss_p_w( t_integration_order, GP_c_t );
00125 
00126                 // this short routine is supposed to calculate position of
00127                 // Gauss point from 3D array of short's
00128                 where =
00129                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
00130 
00131                 //DB::printf("\n\nBefore Initialization **************** where = %d \n",where);
00132                 //DB::printf("GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
00133                 //DB            GP_c_r,GP_c_s,GP_c_t);
00134                 //DB
00135                 //DBGPstress[where].reportshort("stress within before Initialization");
00136                 //DBGPstrain[where].reportshort("strain within before Initialization");
00137                 //DB
00138                 //DB// I suspect that [] should be overloaded so that compiler knows which
00139                 //DB// material model is returning a pointer and fot the purpose
00140                 //DB//matpoint[where].report("mmodel within before Initialization");
00141                 //DB//matpoint[where].report("mmodel within before Initialization"); // operator[] overloaded
00142                 //DB(matpoint)->operator[](where).report("mmodel within before Initialization"); // operator[] overloaded
00143                 //DB                                                               // for NDMaterial and
00144                 //DB                                                               // derived types!
00145 
00146     // Zhaohui  09-30-2000
00147                 //GPtangent_E[where].Initialize_all(*IN_tangent_E);
00148                 //GPstress[where].Initialize(*INstress);
00149                 //GPiterative_stress[where].Initialize(*INiterative_stress);
00150                 //GPq_ast_iterative[where] = IN_q_ast_iterative[where];
00151                 //GPstrain[where].Initialize(*INstrain);
00152                 
00153                 // Already assigned the copy of Globalmmodel to each element of matpoint
00154     //(matpoint)->operator[](where).Initialize(*Globalmmodel);
00155 
00156                 //NDMaterial *NMD = Globalmmodel->getCopy();
00157     //if (strcmp( Globalmmodel->getType(), "Template3Dep" ) == 0)
00158      //   NMD = 0;
00159 
00160                 //opserr << "where = " << where << endlnn;
00161     matpoint[where] = new MatPoint3D(GP_c_r,
00162                                          GP_c_s,
00163                                          GP_c_t,
00164                                          r, s, t,
00165                                          rw, sw, tw,
00166                                          //InitEPS, 
00167            Globalmmodel);
00168            //NMD);
00169            //&( GPstress[where] ), //&( GPiterative_stress[where] ), //IN_q_ast_iterative[where] ,//&( GPstrain[where] ),  //&( GPtangent_E[where] ),
00170                                          //&( (matpoint)->operator[](where) )
00171                                          // ugly syntax but it works! Still don't know what's wrong   // with the old style matpoint[where]
00172               }                
00173           }
00174       }
00175   
00176       // Set connected external node IDs
00177       connectedExternalNodes(0) = node_numb_1;
00178       connectedExternalNodes(1) = node_numb_2;
00179       connectedExternalNodes(2) = node_numb_3;
00180       connectedExternalNodes(3) = node_numb_4;
00181 
00182       connectedExternalNodes(4) = node_numb_5;
00183       connectedExternalNodes(5) = node_numb_6;
00184       connectedExternalNodes(6) = node_numb_7;
00185       connectedExternalNodes(7) = node_numb_8;
00186 
00187       nodes_in_brick = 8;
00188       
00189       // zero node pointers
00190       for (int i=0; i<8; i++)
00191   theNodes[i] = 0;
00192 }
00193 
00194 //====================================================================
00195 EightNodeBrick::EightNodeBrick ():Element(0, ELE_TAG_EightNodeBrick ),
00196 connectedExternalNodes(8), Ki(0), Q(24), bf(3), rho(0.0), pressure(0.0), mmodel(0)
00197 {
00198      matpoint = 0;
00199 
00200      // zero node pointers
00201      for (int i=0; i<8; i++)
00202        theNodes[i] = 0;
00203 }   
00204 
00205 
00206 // Initialize
00207 // default constructor
00208 // this one takes only one material model and forwards it to all
00209 // Gauss points.
00210 //#############################################################################
00211 //
00212 //int EightNodeBrick::Initialize(int element_number,
00213 //                                int node_numb_1, int node_numb_2, int node_numb_3, int node_numb_4,
00214 //                                int node_numb_5, int node_numb_6, int node_numb_7, int node_numb_8,
00215 //                                NDMaterial * Globalmmodel,  double b1, double b2, double b3,
00216 //                                double p, double r
00217 //        //, EPState * InitEPS  const char * type,
00218 //              //tensor       * IN_tangent_E,//stresstensor * INstress, //stresstensor * INiterative_stress, //double  * IN_q_ast_iterative, //straintensor * INstrain
00219 //              )   
00220 //  {
00221 //    //elem_numb = element_number;
00222 //    bf(0) = b1;
00223 //    bf(1) = b2;
00224 //    bf(2) = b3;
00225 //    rho = r;
00226 //    pressure = p;
00227 //    // r_integration_order = r_int_order; 
00228 //    // s_integration_order = s_int_order; 
00229 //    // t_integration_order = t_int_order; 
00230 //    r_integration_order = FixedOrder; // Gauss-Legendre integration order in r direction
00231 //    s_integration_order = FixedOrder; // Gauss-Legendre integration order in s direction
00232 //    t_integration_order = FixedOrder; // Gauss-Legendre integration order in t direction
00233 //
00234 //    //mmodel = Globalmmodel->getCopy(); // One global mat model
00235 //
00236 //    int total_number_of_Gauss_points = r_integration_order*
00237 //                                       s_integration_order*
00238 //                                       t_integration_order;
00239 //
00240 //    //matpoint = Globalmmodel->new_mm(total_number_of_Gauss_points);
00241 //    //matpoint = Globalmmodel->getCopy(total_number_of_Gauss_points);
00242 //    
00243 //    //GPstress = new stresstensor[total_number_of_Gauss_points];
00244 //    //GPiterative_stress = new stresstensor[total_number_of_Gauss_points];
00245 //    //GPq_ast_iterative  = new double[total_number_of_Gauss_points];
00246 //    //GPstrain = new straintensor[total_number_of_Gauss_points];
00247 //    //GPtangent_E = new tensor[total_number_of_Gauss_points];
00248 //    //matpoint  = new MatPoint3D[total_number_of_Gauss_points];
00249 //
00250 //    matpoint = new MatPoint3D * [total_number_of_Gauss_points];
00251 //
00252 //    ////////////////////////////////////////////////////////////////////
00253 //    //dakle posto:
00254 //    //// according to ARM pp.61 default constructor will be called!!
00255 //    //onda oni vec postoje u memoriji i samo im treba dodeliti prave
00256 //    //vrednosti iz onog modela koji je prenesen unutra. Znaci onInitializxe funkcija
00257 //    //sa modelom kao argumentom Initialize(taj_Model).
00258 //    //za stresstensor i straintensor isto to napravi
00259 //    //tu Initialize funkciju pa da uzima argument i da samo
00260 //    //koristi njegove vrednosti pa stavi u vec postojece mesto
00261 //    //u memoriji ove vrednsoti. Takodje unutar brick3d napravi ih
00262 //    //( te stresstensor , straintensor i mmodel ) static da ostanu tu
00263 //    //da se ne pozove destructor . . .
00264 //
00265 //    short where = 0;
00266 //
00267 //    for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
00268 //      {
00269 //        double r = get_Gauss_p_c( r_integration_order, GP_c_r );
00270 //        double rw = get_Gauss_p_w( r_integration_order, GP_c_r );
00271 //
00272 //        for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
00273 //          {
00274 //            double s = get_Gauss_p_c( s_integration_order, GP_c_s );
00275 //            double sw = get_Gauss_p_w( s_integration_order, GP_c_s );
00276 //
00277 //            for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
00278 //              {
00279 //                double t = get_Gauss_p_c( t_integration_order, GP_c_t );
00280 //                double tw = get_Gauss_p_w( t_integration_order, GP_c_t );
00281 //
00282 //                // this short routine is supposed to calculate position of
00283 //                // Gauss point from 3D array of short's
00284 //                where =
00285 //                ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
00286 //
00287 //                //DB::printf("\n\nBefore Initialization **************** where = %d \n",where);
00288 //                //DB::printf("GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
00289 //                //DB            GP_c_r,GP_c_s,GP_c_t);
00290 //                //DB
00291 //                //DBGPstress[where].reportshort("stress within before Initialization");
00292 //                //DBGPstrain[where].reportshort("strain within before Initialization");
00293 //                //DB
00294 //                //DB// I suspect that [] should be overloaded so that compiler knows which
00295 //                //DB// material model is returning a pointer and fot the purpose
00296 //                //DB//matpoint[where].report("mmodel within before Initialization");
00297 //                //DB//matpoint[where].report("mmodel within before Initialization"); // operator[] overloaded
00298 //                //DB(matpoint)->operator[](where).report("mmodel within before Initialization"); // operator[] overloaded
00299 //                //DB                                                               // for NDMaterial and
00300 //                //DB                                                               // derived types!
00301 //                
00302 //                //.matpoint[where].Initialize(GP_c_r,
00303 //                //.                         GP_c_s,
00304 //                //.                         GP_c_t,
00305 //                //.                         r, s, t,
00306 //                //.                         rw, sw, tw,
00307 //                //.                         &( GPstress[where] ),
00308 //                //.                         &( GPstrain[where] ),
00309 //                //.                         &( (matpoint)->operator[](where) )
00310 //                //.                        );      // ugly syntax but it works!
00311 //                //.                                // still don't know what's wrong
00312 //                //.                                // with the old style matpoint[where]
00313 //                // Initialize it with the elastic stiffness tensor at the begining
00314 //                //````double Ey = (matpoint)->operator[](where).E();
00315 //                //````double nu = (matpoint)->operator[](where).nu();
00316 //                //````tensor Constitutive = (matpoint)->operator[](where).StiffnessTensorE(Ey,nu);
00317 //                //````
00318 //                //````GPtangent_E[where].Initialize_all(Constitutive);
00319 //                
00320 //    //GPtangent_E[where].Initialize_all(*IN_tangent_E);                
00321 //                //GPstress[where].Initialize(*INstress);                
00322 //                //GPiterative_stress[where].Initialize(*INiterative_stress);
00323 //                //GPq_ast_iterative[where] = IN_q_ast_iterative[where];    
00324 //                //GPstrain[where].Initialize(*INstrain);
00325 //                
00326 //    //(matpoint)->operator[](where).Initialize(*Globalmmodel);
00327 //    // Already initialized using Globalmmodel in getCopy() --Zhaohui 09-29-2000
00328 //
00329 //                //NDMaterial *NMD = Globalmmodel->getCopy();
00330 //    //if (strcmp( Globalmmodel->getType(), "Template3Dep" ) == 0)
00331 //     //   NMD = 0;
00332 //
00333 //                //matpoint[where].Initialize(GP_c_r,
00334 //                matpoint[where] = new MatPoint3D(GP_c_r,
00335 //                                           GP_c_s,
00336 //                                           GP_c_t,
00337 //                                           r, s, t,
00338 //                                           rw, sw, tw,
00339 //                                           //InitEPS,
00340 //             Globalmmodel);
00341 //             //NMD );
00342 //                                           // &( GPstress[where] ), //&( GPiterative_stress[where] ), // IN_q_ast_iterative[where],
00343 //                                           // &( GPstrain[where] ),  //&( GPtangent_E[where] ),  // ZHaohui 09-29-2000
00344 //                                           // &( (matpoint)->operator[](where) )
00345 //                                           // ugly syntax but it works! // still don't know what's wrong   // with the old style matpoint[where]
00346 //              }                                 
00347 //          }
00348 //      }
00349 //
00350 //      // Set connected external node IDs
00351 //      connectedExternalNodes(0) = node_numb_1;
00352 //      connectedExternalNodes(1) = node_numb_2;
00353 //      connectedExternalNodes(2) = node_numb_3;
00354 //      connectedExternalNodes(3) = node_numb_4;
00355 //      connectedExternalNodes(4) = node_numb_5;
00356 //      connectedExternalNodes(5) = node_numb_6;
00357 //      connectedExternalNodes(6) = node_numb_7;
00358 //      connectedExternalNodes(7) = node_numb_8;
00359 //      
00360 //      //G_N_numbs[0] = node_numb_1;
00361 //      //G_N_numbs[1] = node_numb_2;
00362 //      //G_N_numbs[2] = node_numb_3;
00363 //      //G_N_numbs[3] = node_numb_4;
00364 //      //G_N_numbs[4] = node_numb_5;
00365 //      //G_N_numbs[5] = node_numb_6;
00366 //      //G_N_numbs[6] = node_numb_7;
00367 //      //G_N_numbs[7] = node_numb_8;
00368 //      
00369 //      //nodes = GlobalNodes;
00370 //
00371 //      // loop nodes 9-20 and :
00372 //      //  1) put the right coordinates on place,
00373 //      //  2) calculate the total number of nodes
00374 //      // loop nodes 9-20 and :
00375 //      //  1) put the right coordinates on place,
00376 //      //  2) calculate the total number of nodes
00377 //      nodes_in_brick = 8;
00378 //      //    for ( int i=8 ; i<20 ; i++ )
00379 //      //      {
00380 //      //        if (G_N_numbs[i] == 0 )
00381 //      //          {
00382 //      //                   node_existance[i-8] = 0;
00383 //      //          }
00384 //      //        else
00385 //      //          {
00386 //      //            nodes_in_brick++;
00387 //      //            node_existance[i-8] = 1;
00388 //      //          }
00389 //      //      }
00390 //      //    Node * N = new Node[nodes_in_brick];
00391 //      //  // Xiaoyan comment for only 8 nodes  07/11/00
00392 //      return 0;
00393 //  }
00394 
00395 //#############################################################################
00396 
00397 
00398 
00399 EightNodeBrick::~EightNodeBrick ()
00400 {
00401     
00402     int total_number_of_Gauss_points = r_integration_order*s_integration_order*t_integration_order;
00403     
00404     for (int i = 0; i < total_number_of_Gauss_points; i++) 
00405     {
00406   // Delete the NDMaterials at each integration point
00407   if (matpoint[i])
00408       delete matpoint[i];      
00409     }  
00410     
00411     // Delete the array of pointers to NDMaterial pointer arrays
00412     if (matpoint)
00413       delete [] matpoint;
00414 
00415     if (Ki != 0)
00416       delete Ki;
00417     
00418     //if (mmodel)
00419     //  delete [] mmodel;
00420         
00421 }
00422 
00423 
00424 void EightNodeBrick::incremental_Update()
00425   {
00426     
00427 //BJ//BJ
00428 //BJ    opserr << "\n\n\n\n Print in EightNodeBrick::incremental_Update()" <<endln; this->Print(opserr);
00429 //BJ//BJ
00430     
00431     double r  = 0.0;
00432     // double rw = 0.0;
00433     double s  = 0.0;
00434     // double sw = 0.0;
00435     double t  = 0.0;
00436     // double tw = 0.0;
00437 
00438     short where = 0;
00439     //,,,,,    double weight = 0.0;
00440     
00441     //double this_one_PP = (matpoint)->operator[](where).IS_Perfect_Plastic();
00442 
00443     int dh_dim[] = {8,3};   //Xiaoyan changed from {20,3} to {8,3}  07/12/00
00444     tensor dh(2, dh_dim, 0.0);
00445 
00446 //    tensor Constitutive( 4, def_dim_4, 0.0);
00447 
00448     //    double det_of_Jacobian = 0.0;
00449 
00450     static int disp_dim[] = {8,3}; //Xiaoyan changed from {20,3} to {8,3}  07/12/00
00451     tensor incremental_displacements(2,disp_dim,0.0);
00452 
00453     straintensor incremental_strain;
00454 //    straintensor total_strain_at_GP;
00455 
00456     tensor Jacobian;
00457     tensor JacobianINV;
00458     tensor dhGlobal;
00459 
00460     //....    int number_of_subincrements = 1;
00461     //....    double this_one_PP = 1.0; // if set to 0.0 -> perfectly plastic
00462     //....                              // if set to 1.0 -> elasto plastic
00463 
00464 //    stresstensor final_stress_after_integration;
00465     
00467     // tensor of incremental displacements taken from node objects
00468     incremental_displacements = incr_disp();
00469 
00470     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
00471       {
00472         r = get_Gauss_p_c( r_integration_order, GP_c_r );
00473         //--        rw = get_Gauss_p_w( r_integration_order, GP_c_r );
00474         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
00475           {
00476             s = get_Gauss_p_c( s_integration_order, GP_c_s );
00477             //--            sw = get_Gauss_p_w( s_integration_order, GP_c_s );
00478             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
00479             {
00480                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
00481                 //--                tw = get_Gauss_p_w( t_integration_order, GP_c_t );
00482                 // this short routine is supposed to calculate position of
00483                 // Gauss point from 3D array of short's
00484                 where =
00485                    ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
00486                 // derivatives of local coordiantes with respect to local coordiantes
00487                 dh = dh_drst_at(r,s,t);
00488                 // Jacobian tensor ( matrix )
00489                 Jacobian = Jacobian_3D(dh);
00490                 //....                Jacobian.print("J");
00491                 // Inverse of Jacobian tensor ( matrix )
00492                 JacobianINV = Jacobian_3Dinv(dh);
00493                 //....                JacobianINV.print("JINV");
00494                 // determinant of Jacobian tensor ( matrix )
00495                 //--                det_of_Jacobian  = Jacobian.determinant();
00496                 //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
00497                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
00498                 //dhGlobal = dh("ij") * JacobianINV("jk"); //Zhaohui Yang 09-02-2001
00499                 dhGlobal = dh("ij") * JacobianINV("kj");
00500                 //....                dhGlobal.print("dh","dhGlobal");
00501                 //weight
00502                 //                weight = rw * sw * tw * det_of_Jacobian;
00503                 //::::::   ::printf("\n\nIN THE STIFFNESS TENSOR INTEGRATOR ----**************** where = %d \n", where);
00504                 //::::::   ::printf(" void EightNodeBrick::incremental_Update()\n");
00505                 //::::::   ::printf(" GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d    --->>>  where = %d \n",
00506                 //::::::                      GP_c_r,GP_c_s,GP_c_t,where);
00507                 //::::::   ::printf("WEIGHT = %f", weight);
00508                 //::::::   ::printf("determinant of Jacobian = %f", determinant_of_Jacobian);
00509                 //::::::   matpoint[where].report("Gauss Point\n");
00510                 // incremental straines at this Gauss point
00511                 // now in Update we know the incremental displacements so let's find
00512                 // the incremental strain
00513                 incremental_strain =
00514                     (dhGlobal("ib")*incremental_displacements("ia")).symmetrize11();
00515                 incremental_strain.null_indices();
00516                 //incremental_strain.reportshort("\n incremental_strain tensor at GAUSS point\n");
00517 
00518                 // here comes the final_stress calculation actually on only needs to copy stresses
00519                 // from the iterative data . . .
00520                 //(GPstress+where)->reportshortpqtheta("\n stress START GAUSS \n");
00521 
00522     // Getting final_stress_after_integration is  Done inside CDriver on EPState____ZHaohui 
00523     //final_stress_after_integration = GPiterative_stress[where];
00524     //(matpoint)->operator[](where).kappa_set(final_stress_after_integration,
00525                 //                                 GPq_ast_iterative[where]);
00526                 
00527     //....         final_stress_after_integration =
00528                 //....           (matpoint)->operator[](where).FinalStress(*(GPstress+where),
00529                 //....                                                     incremental_strain,
00530                 //....                                                     (matpoint)->operator[](where),
00531                 //....                                                     number_of_subincrements,
00532                 //....                                                     this_one_PP);
00533                 //....//final_stress_after_integration.reportshortpqtheta("\n final_stress_after_integration GAUSS \n");
00534                 // calculate the constitutive tensor
00535 
00536                 // We do not need: final_stress_after_integration
00537 
00538           
00539           //Constitutive =
00540                 //  (matpoint)->operator[](where).ConstitutiveTensor(final_stress_after_integration,
00541                 //                                                   *(GPstress+where),
00542                 //                                                   incremental_strain,
00543                 //                                                   (matpoint)->operator[](where),
00544                 //                                                   this_one_PP);
00545           
00546     // ZHaohui modified __09-29-2000
00547                 
00548           // Now no EPState  but NDMaterial for each MatPoint
00549     //EPState *tmp_eps = (matpoint[where]).getEPS();
00550           //NDMaterial *tmp_ndm = (matpoint[where]).getNDMat();
00551 
00552     //if ( tmp_eps ) { //if there is an EPState for the MatPoint3D
00553     //  mmodel->setEPS( *tmp_eps );
00554     
00555     if ( ( (matpoint[where]->matmodel)->setTrialStrainIncr( incremental_strain)) )
00556       opserr << "EightNodeBrick::incremental_Update (tag: " << this->getTag() << "), not converged\n";
00557           
00558     //matpoint[where].setEPS( mmodel->getEPS() );
00559     //}
00560     
00561     //else if ( tmp_ndm ) 
00562     //  (matpoint[where].p_matmodel)->setTrialStrainIncr( incremental_strain );
00563     //else {
00564                  //   g3ErrorHandler->fatal("EightNodeBrick::incremental_Update (tag: %d), no strain or stress state vars", this->getTag());
00565     //   exit(1);
00566     //}
00567                  
00568     //Constitutive = trialEPS.getEep();          
00569           
00570     //::::::                   Constitutive.print("C","\n\n C tensor \n");
00571           // this is update of constitutive tensor at this Gauss point
00572                 
00573     // All done in EPState when calling setTrialStrainIncr and converged
00574     //GPtangent_E[where].Initialize(Constitutive);
00575           //GPtangent_E[where].print("\n tangent E at GAUSS point \n");
00576           
00577                 //total_strain_at_GP.Initialize(*(GPstrain+where));
00578                 //total_strain_at_GP.reportshort("\n total_strain tensor at GAUSS point \n");
00579                 //total_strain_at_GP = total_strain_at_GP + incremental_strain;
00580                 //total_strain_at_GP.reportshort("\n total_strain tensor at GAUSS point AFTER\n");
00581                 //GPstress[where].Initialize(final_stress_after_integration);
00582                 //GPstress[where].reportshortpqtheta("\n stress at GAUSS point \n");
00583                 
00584     //GPstrain[where].Initialize(total_strain_at_GP);
00585                 
00586     //GPstrain[where].reportshort("\n strain at GAUSS point \n");
00587             }
00588           }
00589       }
00590   }
00591 
00592 //#############################################################################
00593 //#############################################################################
00594 //***************************************************************
00595 tensor EightNodeBrick::H_3D(double r1, double r2, double r3)
00596   {
00597 
00598     int dimension[] = {24,3}; // Xiaoyan changed from {60,3} to {24,3} for 8 nodes
00599                               // 3*8=24  07/12/00
00600     tensor H(2, dimension, 0.0);
00601 
00602     // influence of the node number 8
00603     H.val(22,1)=(1.0+r1)*(1.0-r2)*(1.0-r3)*0.125;// - (H.val(43,1)+H.val(48,3)+H.val(60,3))/2.0;
00604     H.val(23,2)= H.val(22,1); //(1.0+r1)*(1.0-r2)*(1.0-r3)*0.125;// - (H.val(43,1)+H.val(48,3)+H.val(60,3))/2.0;
00605     H.val(24,3)= H.val(22,1); //(1.0+r1)*(1.0-r2)*(1.0-r3)*0.125;// - (H.val(43,1)+H.val(48,3)+H.val(60,3))/2.0;
00606     // influence of the node number 7
00607     H.val(19,1)=(1.0-r1)*(1.0-r2)*(1.0-r3)*0.125;// - (H.val(42,3)+H.val(43,1)+H.val(57,3))/2.0;
00608     H.val(20,2)=H.val(19,1); //(1.0-r1)*(1.0-r2)*(1.0-r3)*0.125;// - (H.val(42,3)+H.val(43,1)+H.val(57,3))/2.0;
00609     H.val(21,3)=H.val(19,1); //(1.0-r1)*(1.0-r2)*(1.0-r3)*0.125;// - (H.val(42,3)+H.val(43,1)+H.val(57,3))/2.0;
00610     // influence of the node number 6
00611     H.val(16,1)=(1.0-r1)*(1.0+r2)*(1.0-r3)*0.125;//- (H.val(39,3)+H.val(42,3)+H.val(54,3))/2.0;
00612     H.val(17,2)=H.val(16,1); //(1.0-r1)*(1.0+r2)*(1.0-r3)*0.125;//- (H.val(39,3)+H.val(42,3)+H.val(54,3))/2.0;
00613     H.val(18,3)=H.val(16,1); //(1.0-r1)*(1.0+r2)*(1.0-r3)*0.125;//- (H.val(39,3)+H.val(42,3)+H.val(54,3))/2.0;
00614     // influence of the node number 5
00615     H.val(13,1)=(1.0+r1)*(1.0+r2)*(1.0-r3)*0.125;//- (H.val(39,3)+H.val(48,3)+H.val(51,3))/2.0;
00616     H.val(14,2)=H.val(13,1); //(1.0+r1)*(1.0+r2)*(1.0-r3)*0.125;//- (H.val(39,3)+H.val(48,3)+H.val(51,3))/2.0;
00617     H.val(15,3)=H.val(13,1); //(1.0+r1)*(1.0+r2)*(1.0-r3)*0.125;//- (H.val(39,3)+H.val(48,3)+H.val(51,3))/2.0;
00618 
00619     // influence of the node number 4
00620     H.val(10,1)=(1.0+r1)*(1.0-r2)*(1.0+r3)*0.125;//- (H.val(33,3)+H.val(36,3)+H.val(60,3))/2.0;
00621     H.val(11,2)=H.val(10,1); //(1.0+r1)*(1.0-r2)*(1.0+r3)*0.125;//- (H.val(33,3)+H.val(36,3)+H.val(60,3))/2.0;
00622     H.val(12,3)=H.val(10,1); //(1.0+r1)*(1.0-r2)*(1.0+r3)*0.125;//- (H.val(33,3)+H.val(36,3)+H.val(60,3))/2.0;
00623     // influence of the node number 3            
00624     H.val(7,1)=(1.0-r1)*(1.0-r2)*(1.0+r3)*0.125;//- (H.val(30,3)+H.val(33,3)+H.val(57,3))/2.0;
00625     H.val(8,2)=H.val(7,1); //(1.0-r1)*(1.0-r2)*(1.0+r3)*0.125;//- (H.val(30,3)+H.val(33,3)+H.val(57,3))/2.0;
00626     H.val(9,3)=H.val(7,1); //(1.0-r1)*(1.0-r2)*(1.0+r3)*0.125;//- (H.val(30,3)+H.val(33,3)+H.val(57,3))/2.0;
00627     // influence of the node number 2
00628     H.val(4,1)=(1.0-r1)*(1.0+r2)*(1.0+r3)*0.125;//- (H.val(30,3)+H.val(54,3)+H.val(27,3))/2.0;
00629     H.val(5,2)=H.val(4,1); //(1.0-r1)*(1.0+r2)*(1.0+r3)*0.125;//- (H.val(30,3)+H.val(54,3)+H.val(27,3))/2.0;
00630     H.val(6,3)=H.val(4,1); //(1.0-r1)*(1.0+r2)*(1.0+r3)*0.125;//- (H.val(30,3)+H.val(54,3)+H.val(27,3))/2.0;
00631     // influence of the node number 1
00632     H.val(1,1)=(1.0+r1)*(1.0+r2)*(1.0+r3)*0.125;//- (H.val(36,3)+H.val(51,3)+H.val(27,3))/2.0;
00633     H.val(2,2)=H.val(1,1); //(1.0+r1)*(1.0+r2)*(1.0+r3)*0.125;//- (H.val(36,3)+H.val(51,3)+H.val(27,3))/2.0;
00634     H.val(3,3)=H.val(1,1); //(1.0+r1)*(1.0+r2)*(1.0+r3)*0.125;//- (H.val(36,3)+H.val(51,3)+H.val(27,3))/2.0;
00635 
00636                  // The second part were commented by Xiaoyan
00637     //         double sum = 0;
00638     // 
00639     //   for (int i=1; i<=60 ; i++)
00640     //           {
00641     // //        sum+=H.cval(i,1);
00642     //       for (int j=1; j<= 1; j++)
00643     //          {
00644     //                    sum+=H.cval(i,1);
00645     //             ::printf( "  %+9.2e", H.cval(i,j) );
00646     //           }
00647     //            // ::printf( "  %d \n", i);
00648     //      }
00649     //       ::printf( " \n sum= %+6.2e\n", sum );
00650     
00651 
00652     //    printf("r1 = %lf, r2 = %lf, r3 = %lf\n", r1, r2, r3);
00653     //    H.print("h");
00654 
00655     return H;
00656   }
00657 
00658 //#############################################################################
00659 //***************************************************************
00660 tensor EightNodeBrick::interp_poli_at(double r1, double r2, double r3)
00661   {
00662 
00663     int dimension[] = {8};  // Xiaoyan changed from {20} to {8} for 8 nodes 07/12
00664     tensor h(1, dimension, 0.0);
00665      
00666 
00667     // Commented by Xiaoyan
00668 
00669     // influence of the node number 8
00670     h.val(8)=(1.0+r1)*(1.0-r2)*(1.0-r3)/8.0;// - (h.val(15)+h.val(16)+h.val(20))/2.0;
00671     // influence of the node number 7
00672     h.val(7)=(1.0-r1)*(1.0-r2)*(1.0-r3)/8.0;// - (h.val(14)+h.val(15)+h.val(19))/2.0;
00673     // influence of the node number 6
00674     h.val(6)=(1.0-r1)*(1.0+r2)*(1.0-r3)/8.0;// - (h.val(13)+h.val(14)+h.val(18))/2.0;
00675     // influence of the node number 5
00676     h.val(5)=(1.0+r1)*(1.0+r2)*(1.0-r3)/8.0;// - (h.val(13)+h.val(16)+h.val(17))/2.0;
00677 
00678     // influence of the node number 4
00679     h.val(4)=(1.0+r1)*(1.0-r2)*(1.0+r3)/8.0;// - (h.val(11)+h.val(12)+h.val(20))/2.0;
00680     // influence of the node number 3
00681     h.val(3)=(1.0-r1)*(1.0-r2)*(1.0+r3)/8.0;// - (h.val(10)+h.val(11)+h.val(19))/2.0;
00682     // influence of the node number 2
00683     h.val(2)=(1.0-r1)*(1.0+r2)*(1.0+r3)/8.0;// - (h.val(10)+h.val(18)+h.val(9))/2.0;
00684     // influence of the node number 1
00685     h.val(1)=(1.0+r1)*(1.0+r2)*(1.0+r3)/8.0;// - (h.val(12)+h.val(17)+h.val(9))/2.0;
00686 
00687     return h;
00688   }
00689 
00690 
00691 
00692 tensor EightNodeBrick::dh_drst_at(double r1, double r2, double r3)
00693   {
00694 
00695     int dimensions[] = {8,3};  // Changed from{20,3} to {8,3} Xiaoyan 07/12
00696     tensor dh(2, dimensions, 0.0);
00697 
00698 
00699     // influence of the node number 8
00700     dh.val(8,1)= (1.0-r2)*(1.0-r3)*0.125; 
00701     dh.val(8,2)=-(1.0+r1)*(1.0-r3)*0.125; 
00702     dh.val(8,3)=-(1.0+r1)*(1.0-r2)*0.125; 
00703     // influence of the node number 7
00704     dh.val(7,1)=-(1.0-r2)*(1.0-r3)*0.125; 
00705     dh.val(7,2)=-(1.0-r1)*(1.0-r3)*0.125; 
00706     dh.val(7,3)=-(1.0-r1)*(1.0-r2)*0.125; 
00707     // influence of the node number 6
00708     dh.val(6,1)=-(1.0+r2)*(1.0-r3)*0.125; 
00709     dh.val(6,2)= (1.0-r1)*(1.0-r3)*0.125; 
00710     dh.val(6,3)=-(1.0-r1)*(1.0+r2)*0.125; 
00711     // influence of the node number 5
00712     dh.val(5,1)= (1.0+r2)*(1.0-r3)*0.125; 
00713     dh.val(5,2)= (1.0+r1)*(1.0-r3)*0.125; 
00714     dh.val(5,3)=-(1.0+r1)*(1.0+r2)*0.125; 
00715 
00716     // influence of the node number 4
00717     dh.val(4,1)= (1.0-r2)*(1.0+r3)*0.125; 
00718     dh.val(4,2)=-(1.0+r1)*(1.0+r3)*0.125; 
00719     dh.val(4,3)= (1.0+r1)*(1.0-r2)*0.125; 
00720     // influence of the node number 3
00721     dh.val(3,1)=-(1.0-r2)*(1.0+r3)*0.125; 
00722     dh.val(3,2)=-(1.0-r1)*(1.0+r3)*0.125; 
00723     dh.val(3,3)= (1.0-r1)*(1.0-r2)*0.125; 
00724     // influence of the node number 2
00725     dh.val(2,1)=-(1.0+r2)*(1.0+r3)*0.125; 
00726     dh.val(2,2)= (1.0-r1)*(1.0+r3)*0.125; 
00727     dh.val(2,3)= (1.0-r1)*(1.0+r2)*0.125; 
00728     // influence of the node number 1
00729     dh.val(1,1)= (1.0+r2)*(1.0+r3)*0.125; 
00730     dh.val(1,2)= (1.0+r1)*(1.0+r3)*0.125; 
00731     dh.val(1,3)= (1.0+r1)*(1.0+r2)*0.125; 
00732                // Commented by Xiaoyan
00733     return dh;
00734   }
00735 
00737 EightNodeBrick & EightNodeBrick::operator[](int subscript)
00738   {
00739     return ( *(this+subscript) );
00740   }
00741 
00742 //Finite_Element & EightNodeBrick::operator[](short subscript)
00743 //  {
00744 //    return ( *(this+subscript) );
00745 //  }
00746 
00747 //Finite_Element & EightNodeBrick::operator[](unsigned subscript)
00748 //  {
00749 //    return ( *(this+subscript) );
00750 //  }
00751 
00752 
00754 tensor EightNodeBrick::getStiffnessTensor(void)
00755   {
00756 
00757 
00758 //BJ//BJ
00759 //BJ    opserr << "\n\n\n\n Print in tensor EightNodeBrick::getStiffnessTensor(void) " <<endln; this->Print(opserr);
00760 //BJ//BJ
00761 
00762     int K_dim[] = {8,3,3,8};  // Xiaoyan changed from {20,3,3,20} to {8,3,3,8} 
00763             // for 8 nodes      07/12
00764     tensor Kk(4,K_dim,0.0);
00765     tensor Kkt(4,K_dim,0.0);
00766 
00767     //debugging
00768     matrix Kmat;
00769 
00770     double r  = 0.0;
00771     double rw = 0.0;
00772     double s  = 0.0;
00773     double sw = 0.0;
00774     double t  = 0.0;
00775     double tw = 0.0;
00776 
00777     short where = 0;
00778     double weight = 0.0;
00779 
00780     int dh_dim[] = {8,3};  // Xiaoyan changed from {20,3} to {8,3}
00781     tensor dh(2, dh_dim, 0.0);
00782 
00783     //    tensor Constitutive( 4, def_dim_4, 0.0);
00784     tensor Constitutive;
00785 
00786     double det_of_Jacobian = 0.0;
00787 
00788     static int disp_dim[] = {8,3};   // Xiaoyan changed from {20,3} to {8,3}
00789     tensor incremental_displacements(2,disp_dim,0.0); // \Delta u
00790 
00791     straintensor incremental_strain;
00792 //    straintensor total_strain_at_GP;
00793 
00794     tensor Jacobian;
00795     tensor JacobianINV;
00796     tensor JacobianINVtemp;
00797     tensor dhGlobal;
00798 
00799     //double tmp= 0;
00800 
00801     
00802     // tensor of incremental displacements taken from node objects
00803     //incremental_displacements = incr_disp();
00804     //opserr << "\n=======" << getTag() << "===========\n";
00805     //incremental_displacements.print("incr_disp");
00806 
00807     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
00808       {
00809         r = get_Gauss_p_c( r_integration_order, GP_c_r );
00810         rw = get_Gauss_p_w( r_integration_order, GP_c_r );
00811         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
00812           {
00813             s = get_Gauss_p_c( s_integration_order, GP_c_s );
00814             sw = get_Gauss_p_w( s_integration_order, GP_c_s );
00815             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
00816               {
00817                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
00818                 tw = get_Gauss_p_w( t_integration_order, GP_c_t );
00819                 // this short routine is supposed to calculate position of
00820                 // Gauss point from 3D array of short's
00821                 where =
00822                    ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
00823                 // derivatives of local coordinates with respect to local coordinates
00824                 dh = dh_drst_at(r,s,t);
00825     //dh.print("dh");
00826                 // Jacobian tensor ( matrix )
00827                 Jacobian = Jacobian_3D(dh);
00828                 //Jacobian.print("J");
00829 
00830     // Inverse of Jacobian tensor ( matrix )
00831                 //JacobianINV = Jacobian_3Dinv(dh);
00832                 JacobianINV = Jacobian.inverse();
00833     //JacobianINVtemp = JacobianINVtemp - JacobianINV;
00834     //JacobianINV.print();
00835        //JacobianINVtemp.print();
00836 
00837                 //JacobianINV = Jacobian.inverse(); //Zhaohui 08-31-2001
00838 
00839 
00840                 // determinant of Jacobian tensor ( matrix )
00841                 det_of_Jacobian  = Jacobian.determinant();
00842                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
00843                 dhGlobal = dh("ij") * JacobianINV("kj");
00844                 //        ::fprintf(stdout," # %d \n\n\n\n\n\n\n\n", El_count);
00845     //dhGlobal.print("dhGlobal");
00846                 //weight
00847                 weight = rw * sw * tw * det_of_Jacobian;
00848                 //::::::
00849                 //printf("\n\nIN THE STIFFNESS TENSOR INTEGRATOR ----**************** where = %d \n", where);
00850                 //printf("  Stifness_Tensor \n");
00851                 //printf("                    GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
00852                 //                            GP_c_r,GP_c_s,GP_c_t);
00853                 //printf("WEIGHT = %f", weight);
00854                 //Jacobian.print("J");
00855                 //JacobianINV.print("JINV");
00856                 //JacobianINVtemp.print("JINVtemp");
00857                 //tensor I = JacobianINV("ij")*Jacobian("jk");
00858                 //I.print("I");
00859 
00860                 //printf("determinant of Jacobian = %.6e", det_of_Jacobian);
00861                 //matpoint[where].report("Gauss Point\n");
00862 
00863                 // incremental straines at this Gauss point
00864                 //GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor1\n");
00865                 
00866     //incremental_strain =
00867                 //     (dhGlobal("ib")*incremental_displacements("ia")).symmetrize11();
00868                 
00869     //incremental_strain.null_indices();
00870                 //incremental_strain.report("\n incremental_strain tensor at GAUSS point\n");
00871                 
00872     // incremental_strain.reportshort("\n incremental_strain tensor at GAUSS point\n");
00873                 //----   GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor2\n");
00874                 // intialize total strain with the strain at this Gauss point before
00875                 // adding this increments strains!
00876                 //                total_strain_at_GP.Initialize(*(GPstrain+where));
00877                 //total_strain_at_GP.reportshort("\n total_strain tensor at GAUSS point BEFORE\n");
00878                 // this is the addition of incremental strains to the previous strain state at
00879                 // this Gauss point
00880                 //                total_strain_at_GP = total_strain_at_GP + incremental_strain;
00881                 //total_strain_at_GP.reportshort("\n total_strain tensor at GAUSS point AFTER\n");
00882                 //..   dakle ovde posalji strain_increment jer se stari stress cuva u okviru svake
00883                 //..   Gauss tacke a samo saljes strain_increment koji ce da se prenese
00884                 //..   u integracionu rutinu pa ce ta da vrati krajnji napon i onda moze da
00885                 //..   se pravi ConstitutiveStiffnessTensor.
00886                 // here comes the final_stress calculation
00887                 // this final stress after integration is used ONLY to obtain Constitutive tensor
00888                 // at this Gauss point.
00889                 
00890                 //final_stress_after_integration =
00891                 //    (matpoint)->operator[](where).FinalStress(*(GPstress+where),
00892                 //                                 incremental_strain,
00893                 //                                 (matpoint)->operator[](where),
00894                 //                                 number_of_subincrements,
00895                 //                                 this_one_PP);
00896                 //final_stress_after_integration.reportshortpqtheta("\n final_stress_after_integration in stiffness_tensor5\n");
00897 
00898                 //----   GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor3\n");
00899                 //final_stress_after_integration.reportshortpqtheta("\n final_stress_after_integration GAUSS \n");
00900                 //----   GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor4\n");
00901 
00902                 // this final stress after integration is used ONLY to obtain Constitutive tensor
00903                 // at this Gauss point AND to set up the iterative_stress that is used in calculting
00904                 // internal forces during iterations!!
00905 
00906                 //GPiterative_stress[where].Initialize(final_stress_after_integration);
00907                 //GPiterative_stress[where].reportshortpqtheta("\n iterative_stress at GAUSS point in stiffness_tensor5\n");
00908 
00909 
00910                 // Stress state at Gauss point will be updated ( in the
00911                 // sense of updating stresses ( integrating them ) ) in function Update (...) ! ! ! ! !
00912                 // calculate the constitutive tensor
00913                 //......         Constitutive =  GPtangent_E[where];
00914 
00915     //Constitutive =  (matpoint)->operator[](where).ConstitutiveTensor(final_stress_after_integration,
00916                 //                                         *(GPstress+where),
00917                 //                                          incremental_strain,
00918                 //                                          (matpoint)->operator[](where),
00919                 //                                          this_one_PP);
00920                 //Constitutive.print("C","\n\n C tensor \n");
00921                 
00922           //EPState *tmp_eps = (matpoint[where]).getEPS();
00923           //NDMaterial *tmp_ndm = (matpoint[where]).getNDMat();
00924 
00925     //if ( tmp_eps ) {     //Elasto-plastic case
00926     //    mmodel->setEPS( *tmp_eps );
00927     
00928     //int err = ( matpoint[where]->matmodel )->setTrialStrainIncr( incremental_strain);
00929     //if ( err)
00930                  //   opserr << "EightNodeBrick::getStiffnessTensor (tag: %d), not converged",
00931     //         this->getTag());
00932     
00933     Constitutive = (matpoint[where]->matmodel)->getTangentTensor();
00934                 //Constitutive.print("C","\n\n C tensor \n");
00935          
00936     //    matpoint[where].setEPS( mmodel->getEPS() );
00937     //}
00938     //else if ( tmp_ndm ) { //Elastic case
00939     //    (matpoint[where].p_matmodel)->setTrialStrainIncr( incremental_strain );
00940     //    Constitutive = (matpoint[where].p_matmodel)->getTangentTensor();
00941     //}
00942     //else {
00943                  //   g3ErrorHandler->fatal("EightNodeBrick::incremental_Update (tag: %d), could not getTangentTensor", this->getTag());
00944     //   exit(1);
00945     //}
00946         
00947     //printf("Constitutive.trace = %12.6e\n", Constitutive.trace());
00948                 //Kmat = this->stiffness_matrix(Constitutive);
00949                 //printf("Constitutive tensor max:= %10.3e\n", Kmat.mmax());
00950 
00951                 //----   GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor5\n");
00952                 // this is update of constitutive tensor at this Gauss point
00953                 //GPtangent_E[where].Initialize(Constitutive);
00954                 //....GPtangent_E[where].print(" tangent E at GAUSS point");
00955 
00956                 //GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor6\n");
00957 
00958                 //K = K + temp2;
00959                 
00960     Kkt = dhGlobal("ib")*Constitutive("abcd");
00961     Kkt = Kkt("aicd")*dhGlobal("jd")*weight;
00962        Kk = Kk + Kkt;
00963     
00964     //Kk = Kk + dhGlobal("ib")*Constitutive("abcd")*dhGlobal("jd")*weight;
00965                 //....K.print("K","\n\n K tensor \n"); 
00966 
00967     //Kmat = this->stiffness_matrix(Kkt);
00968                 //Kmat.print("Kmat");
00969 
00970     //printf("K tensor max= %10.3e\n", Kmat.mmax());
00971 
00972                 //convert constitutive and K to matrix and find min and max and print!
00973 
00974 
00975 
00976               }
00977           }
00978       }
00979     //Kk.print("K","\n\n K tensor \n"); 
00980     //K = Kk;
00981     return Kk;
00982   }
00983 
00984 
00985 //#############################################################################
00986 
00987 void EightNodeBrick::set_strain_stress_tensor(FILE *fp, double * u)
00988   {
00989 
00990 //BJ//BJ
00991 //BJ    opserr << "\n\n\n\n Print in void EightNodeBrick::set_strain_stress_tensor" <<endln; this->Print(opserr);
00992 //BJ//BJ
00993 
00994     int dh_dim[] = {8,3};   // Xiaoyan changed from {20,3} to {8,3}
00995     tensor dh(2, dh_dim, 0.0);
00996 
00997 //    tensor Constitutive( 4, def_dim_4, 0.0);
00998     tensor Constitutive;
00999     double r  = 0.0;
01000     double s  = 0.0;
01001     double t  = 0.0;
01002     int where = 0;
01003 
01004     double det_of_Jacobian;
01005 
01006     straintensor strain;
01007     stresstensor stress;
01008 
01009     tensor Jacobian;
01010     tensor JacobianINV;
01011     tensor dhGlobal;
01012 
01013 
01014     static int disp_dim[] = {8,3};    // Xiaoyan changed from {20,3} to {8,3}
01015     tensor total_displacements(2,disp_dim,0.0); //
01016 
01017     total_displacements = total_disp(fp, u);
01018 
01019     ::printf("\n  displacement(x-y-z) at GAUSS pt %d \n\n", where+1);
01020     for (int ii=1; ii<=8;ii++)
01021      {
01022       ::printf("Global# %d Local#%d  %+0.5e %+0.5e %+0.5e\n",
01023                      //G_N_numbs[ii-1], 
01024          connectedExternalNodes(ii-1),
01025          ii,total_displacements.val(ii,1),
01026                total_displacements.val(ii,2),
01027          total_displacements.val(ii,3));
01028      }                        
01029     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
01030       {
01031         r = get_Gauss_p_c( r_integration_order, GP_c_r );
01032         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
01033           {
01034             s = get_Gauss_p_c( s_integration_order, GP_c_s );
01035             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
01036               {
01037                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
01038                 // this short routine is supposed to calculate position of
01039                 // Gauss point from 3D array of short's
01040                 where =
01041                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
01042                 // derivatives of local coordinates with respect to local coordinates
01043                 dh = dh_drst_at(r,s,t);
01044                 // Jacobian tensor ( matrix )
01045                 Jacobian = Jacobian_3D(dh);
01046                 // Inverse of Jacobian tensor ( matrix )
01047                 JacobianINV = Jacobian_3Dinv(dh);
01048                 // determinant of Jacobian tensor ( matrix )
01049                 det_of_Jacobian  = Jacobian.determinant();
01050                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
01051                 dhGlobal = dh("ij") * JacobianINV("kj");
01052                 //weight
01053                 // straines at this Gauss point from displacement
01054                 strain = (dhGlobal("ib")*total_displacements("ia")).symmetrize11();
01055                 strain.null_indices();
01056                 // here comes the final_stress calculation
01057                 // at this Gauss point.
01058 
01059                 //Constitutive =  GPtangent_E[where];
01060                 //Constitutive =  (matpoint->getEPS() )->getEep();
01061                 // if set total displ, then it should be elstic material
01062     Constitutive =  ( matpoint[where]->matmodel)->getTangentTensor();
01063 
01064            stress = Constitutive("ijkl") * strain("kl");   //<<<<<<<<<<<<<<<
01065                 stress.null_indices();
01066 
01067                 ::printf("\n  strain tensor at GAUSS point %d \n", where+1);
01068                 strain.reportshort("");
01069                 ::printf("\n  stress tensor at GAUSS point %d \n", where+1);
01070                 stress.reportshort("");
01071                 
01072                                
01073               }
01074           }
01075       }
01076   }
01077 
01078 
01080 //  tensor EightNodeBrick::mass_tensor(Elastic  mmodel)
01081 tensor EightNodeBrick::getMassTensor(void)
01082   {
01083     //int M_dim[] = {8,3,3,8}; 
01084     int M_dim[] = {24,24};    
01085     tensor Mm(2,M_dim,0.0);
01086 
01087     double r  = 0.0;
01088     double rw = 0.0;
01089     double s  = 0.0;
01090     double sw = 0.0;
01091     double t  = 0.0;
01092     double tw = 0.0;
01093 
01094     short where = 0;
01095     double weight = 0.0;
01096 
01097     int dh_dim[] = {8,3};    // Xiaoyan changed from {20,3} to {8,3}
01098 
01099     tensor dh(2, dh_dim, 0.0);
01100 
01101     int h_dim[] = {24,3};  // Xiaoyan changed from {60,3} to {24,3}
01102     //int h_dim[] = {8,3};  // Xiaoyan changed from {60,3} to {24,3}
01103     //int h_dim[] = {20,3};
01104     tensor H(2, h_dim, 0.0);
01105 
01106     double det_of_Jacobian = 0.0;
01107 
01108     tensor Jacobian;
01109 
01110     double RHO;
01111     RHO= rho;    //global
01112 
01113     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
01114       {
01115         r = get_Gauss_p_c( r_integration_order, GP_c_r );
01116         rw = get_Gauss_p_w( r_integration_order, GP_c_r );
01117         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
01118           {
01119             s = get_Gauss_p_c( s_integration_order, GP_c_s );
01120             sw = get_Gauss_p_w( s_integration_order, GP_c_s );
01121             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
01122               {
01123                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
01124                 tw = get_Gauss_p_w( t_integration_order, GP_c_t );
01125                 // this short routine is supposed to calculate position of
01126                 // Gauss point from 3D array of short's
01127                 where =
01128                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
01129                 // derivatives of local coordinates with respect to local coordinates
01130                 dh = dh_drst_at(r,s,t);
01131                 // Jacobian tensor ( matrix )
01132                 Jacobian = Jacobian_3D(dh);
01133                 //     Jacobian.print("J","Jacobian");
01134                 // Inverse of Jacobian tensor ( matrix )
01135                 //                JacobianINV = Jacobian_3Dinv(dh);
01136                 // determinant of Jacobian tensor ( matrix )
01137                 det_of_Jacobian  = Jacobian.determinant();
01138                 //     printf("det_of_Jacobian = %6.2e \n",det_of_Jacobian);
01139                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
01140                 //                dhGlobal = dh("ij") * JacobianINV("kj");
01141                 // derivatives of local coordinates with respect to local coordinates
01142 
01143 
01144                 // printf("\n\nIN THE MASS TENSOR INTEGRATOR ----**************** where = %d \n", where);
01145                 // printf("  Mass_Tensor \n");
01146                 // printf("                    GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
01147                 //                             GP_c_r,GP_c_s,GP_c_t);
01148                 // 
01149                 H = H_3D(r,s,t);
01150 
01151                 //  double sum = 0.0;
01152                 //  for (int i=1; i<=60 ; i++)
01153                 //           {
01154                 // //        sum+=H.cval(i,1);
01155                 //       for (int j=1; j<= 3; j++)
01156                 //          {
01157                 //                    sum+=H.cval(i,j);
01158                 //             ::printf( "  %+9.2e", H.cval(i,j) );
01159                 //           }
01160                 //             ::printf( "  %d \n", i);
01161                 //      }
01162                 //       ::printf( " \n sum= %+6.2e\n", sum );
01163 
01164 
01165      
01166 
01167                 // matpoint GaPo = MatPoint3D::GP()+where;
01168 
01169     // if it's elasto-plastic, then use the rho at each integration point
01170     //if ( matpoint[where] ) //need to refine possible bug
01171     //  RHO= matpoint[where]->getrho();  
01172 
01173     //printf("RHO = %10.3e",RHO);
01174                 //    getchar();
01175 
01176                 //weight
01177                 weight = rw * sw * tw * RHO * det_of_Jacobian;
01178             //  printf("weight = %6.2e \n",weight);
01179 
01180     //M.print("M","BEFORE");
01181                 
01182           //  tensor temp = H("ib")*H("kb");
01183     //temp.print("t","temporary tensor H(\"ib\")*H(\"kb\") \n\n" );
01184 
01185     Mm = Mm + H("ib")*H("kb")*weight;
01186          //  printf("\n +++++++++++++++++++++++++ \n\n");
01187           //Mm.printshort("M");
01188               }
01189           }
01190       }
01191     //M = Mm;
01192     //Mm.printshort("M");
01193     return Mm;
01194   }
01195 
01196 
01197 
01199 
01200 tensor EightNodeBrick::stiffness_matrix(const tensor & K)
01201   {
01202 //BJ/BJ
01203 //BJ    opserr << "\n\n\n\n Print in tensor EightNodeBrick::stiffness_matrix" <<endln; this->Print(opserr);
01204 //BJ//BJ
01205 //    int K_dim[] = {20,3,3,20};
01206 //    tensor K(4,K_dim,0.0);
01207     matrix Kmatrix(24,24,0.0);   // Xiaoyan changed from (60,60,0,0) to (24,24,0,0)
01208 
01209     int Ki=0;
01210     int Kj=0;
01211 
01212     for ( int i=1 ; i<=8 ; i++ )  // Xiaoyan changed from i<=20 to i<=8 for 8 nodes
01213       {
01214         for ( int j=1 ; j<=8 ; j++ )  // Xiaoyan changed from i<=20 to i<=8 for 8 nodes
01215           {
01216             for ( int k=1 ; k<=3 ; k++ )
01217               {
01218                 for ( int l=1 ; l<=3 ; l++ )
01219                   {
01220                     Ki = k+3*(i-1);
01221                     Kj = l+3*(j-1);
01222                     //::printf("i=%d k=%d  Ki=%d       j=%d l=%d  Kj=%d\n",i,k,Ki,j,l,Kj);
01223 
01224                     Kmatrix.val( Ki , Kj ) = K.cval(i,k,l,j);
01225                   }
01226               }
01227           }
01228       }
01229     return Kmatrix;
01230   }
01231 
01232 //#############################################################################
01233 
01235 // Constructing mass matrix from mass tensor ___Zhaohui 07-05-99
01236 tensor EightNodeBrick::mass_matrix(const tensor & M)
01237   {
01238     //    int K_dim[] = {20,3,3,20};
01239     //    tensor K(4,K_dim,0.0);
01240     matrix Mmatrix(24,24,0.0);  // Xiaoyan changed from (60,60,0,0) to (24,24,0,0) for 8 nodes
01241 
01242     for ( int i=1 ; i<=24 ; i++ )   // Xiaoyan changed from i<=60 to i<=24 for 8 nodes
01243       {
01244         for ( int j=1 ; j<=24 ; j++ ) // Xiaoyan changed from i<=60 to i<=24 for 8 nodes
01245           {
01246              Mmatrix.val( i , j ) = M.cval(i,j);
01247              //  ::printf("Mi Mj %d %d %+6.2e ",Mi,Mj,Mmatrix.val( Mi , Mj ) );
01248           }
01249       }
01250     return Mmatrix;
01251   }
01253 
01255 tensor EightNodeBrick::Jacobian_3D(tensor dh)
01256   {                       
01257      //       dh ( 20*3)  // dh(8*3) Xiaoyan
01258      tensor N_C = Nodal_Coordinates(); // 20*3    // 8*3 Xiaoyan
01259      tensor Jacobian_3D = dh("ij") * N_C("ik");
01260      return Jacobian_3D;
01261   }
01262 
01263 //#############################################################################
01264 tensor EightNodeBrick::Jacobian_3Dinv(tensor dh)
01265   {                       
01266      //       dh ( 20*3)    // dh(8*3) Xiaoyan  
01267      tensor N_C = Nodal_Coordinates(); // 20*3        // 8*3 Xiaoyan   
01268      tensor Jacobian_3Dinv = (dh("ij") * N_C("ik")).inverse();
01269      return Jacobian_3Dinv;
01270   }
01271 
01272 
01274 tensor EightNodeBrick::Nodal_Coordinates(void)
01275   {
01276     const int dimensions[] = {8,3};  // Xiaoyan changed from {20,3} to {8,3} for 8 nodes
01277     tensor N_coord(2, dimensions, 0.0);
01278 
01279     //for ( int i=0 ; i<8 ; i++ )    // Xiaoyan changed from 20 to 8 for 8 nodes
01280     //  {
01281     //    //        N_coord.val(i+1,1) = nodes[ G_N_numbs[i] ].x_coordinate();
01282     //    //        N_coord.val(i+1,2) = nodes[ G_N_numbs[i] ].y_coordinate();
01283     //    //        N_coord.val(i+1,3) = nodes[ G_N_numbs[i] ].z_coordinate();
01284     //    // Xiaoyan changed to the following:  09/27/00
01285     //    /// LOOK WITH DDD
01286     //  Vector Coordinates = nodes[ G_N_numbs[i] ].getCrds();
01287     //    N_coord.val(i+1,1) = Coordinates(0);
01288     //    N_coord.val(i+1,2) = Coordinates(1);
01289     //    N_coord.val(i+1,3) = Coordinates(2);
01290     //  }
01291     
01292     //Zhaohui using node pointers, which come from the Domain
01293     const Vector &nd1Crds = theNodes[0]->getCrds();
01294     const Vector &nd2Crds = theNodes[1]->getCrds();
01295     const Vector &nd3Crds = theNodes[2]->getCrds();
01296     const Vector &nd4Crds = theNodes[3]->getCrds();
01297     const Vector &nd5Crds = theNodes[4]->getCrds();
01298     const Vector &nd6Crds = theNodes[5]->getCrds();
01299     const Vector &nd7Crds = theNodes[6]->getCrds();
01300     const Vector &nd8Crds = theNodes[7]->getCrds();
01301     
01302     N_coord.val(1,1)=nd1Crds(0); N_coord.val(1,2)=nd1Crds(1); N_coord.val(1,3)=nd1Crds(2);
01303     N_coord.val(2,1)=nd2Crds(0); N_coord.val(2,2)=nd2Crds(1); N_coord.val(2,3)=nd2Crds(2);
01304     N_coord.val(3,1)=nd3Crds(0); N_coord.val(3,2)=nd3Crds(1); N_coord.val(3,3)=nd3Crds(2);
01305     N_coord.val(4,1)=nd4Crds(0); N_coord.val(4,2)=nd4Crds(1); N_coord.val(4,3)=nd4Crds(2);
01306     N_coord.val(5,1)=nd5Crds(0); N_coord.val(5,2)=nd5Crds(1); N_coord.val(5,3)=nd5Crds(2);
01307     N_coord.val(6,1)=nd6Crds(0); N_coord.val(6,2)=nd6Crds(1); N_coord.val(6,3)=nd6Crds(2);
01308     N_coord.val(7,1)=nd7Crds(0); N_coord.val(7,2)=nd7Crds(1); N_coord.val(7,3)=nd7Crds(2);
01309     N_coord.val(8,1)=nd8Crds(0); N_coord.val(8,2)=nd8Crds(1); N_coord.val(8,3)=nd8Crds(2);
01310 
01311     //N_coord.print();
01312 
01313     return N_coord;
01314   }
01315 
01317 tensor EightNodeBrick::incr_disp(void)
01318   {
01319     const int dimensions[] = {8,3};  // Xiaoyan changed from {20,3} to {8,3} for 8 nodes
01320     tensor increment_disp(2, dimensions, 0.0);
01321 
01322     //for ( int i=0 ; i<8 ; i++ )   // Xiaoyan changed from 20 to 8 for 8 nodes
01323     //
01324     //  {
01325     //    // increment_disp.val(i+1,1) = nodes[ G_N_numbs[i] ].incremental_translation_x();
01326     //    // increment_disp.val(i+1,2) = nodes[ G_N_numbs[i] ].incremental_translation_y();
01327     //    // increment_disp.val(i+1,3) = nodes[ G_N_numbs[i] ].incremental_translation_z();
01328     //    // Xiaoyan changed to the following 09/27/00
01329     //    Vector IncremenDis = nodes[ G_N_numbs[i] ].getIncrDisp();
01330     //
01331     //    increment_disp.val(i+1,1) = IncremenDis(0);
01332     //    increment_disp.val(i+1,2) = IncremenDis(1); 
01333     //    increment_disp.val(i+1,3) = IncremenDis(2);
01334     //  
01335     //  }
01336     
01337     //Zhaohui using node pointers, which come from the Domain
01338     //const Vector &TotDis1 = theNodes[0]->getTrialDisp();
01339     //const Vector &incrdelDis1 = theNodes[0]->getIncrDisp();
01340     //Have to get IncrDeltaDisp, not IncrDisp for cumulation of incr_disp
01341     
01342     const Vector &IncrDis1 = theNodes[0]->getIncrDeltaDisp();
01343     const Vector &IncrDis2 = theNodes[1]->getIncrDeltaDisp();
01344     const Vector &IncrDis3 = theNodes[2]->getIncrDeltaDisp();
01345     const Vector &IncrDis4 = theNodes[3]->getIncrDeltaDisp();
01346     const Vector &IncrDis5 = theNodes[4]->getIncrDeltaDisp();
01347     const Vector &IncrDis6 = theNodes[5]->getIncrDeltaDisp();
01348     const Vector &IncrDis7 = theNodes[6]->getIncrDeltaDisp();
01349     const Vector &IncrDis8 = theNodes[7]->getIncrDeltaDisp();
01350 
01351     //if ( getTag() == 486 || getTag() == 566 || getTag() == 956)
01352     //{
01353     //opserr <<" \n\n element " << getTag() << endlnn;
01354     //opserr<<"\n tot node " << theNodes[0]->getTag() <<" x "<< TotDis1(0) <<" y "<< TotDis1(1) << " z "<< TotDis1(2);
01355     //
01356     //opserr<<"\n incr node " << theNodes[0]->getTag() <<" x "<< incrdelDis1(0) <<" y "<< incrdelDis1(1) << " z "<< incrdelDis1(2);
01357     //
01358     //opserr << "\nincr del node " << theNodes[0]->getTag() << " x " << IncrDis1(0) <<" y "<< IncrDis1(1) << " z "<< IncrDis1(2) << endlnn;
01359     //
01360     //opserr << " incr del node " << theNodes[1]->getTag() << " x " << IncrDis2(0) <<" y "<< IncrDis2(1) << " z "<< IncrDis2(2) << endlnn;
01361     //
01362     //opserr << " incr del node " << theNodes[2]->getTag() << " x " << IncrDis3(0) <<" y "<< IncrDis3(1) << " z "<< IncrDis3(2) << endlnn;
01363     //
01364     //opserr << " incr del node " << theNodes[3]->getTag() << " x " << IncrDis4(0) <<" y "<< IncrDis4(1) << " z "<< IncrDis4(2) << endlnn;
01365     //
01366     //opserr << " incr del node " << theNodes[4]->getTag() << " x " << IncrDis5(0) <<" y "<< IncrDis5(1) << " z "<< IncrDis5(2) << endlnn;
01367     //opserr << " incr del node " << theNodes[5]->getTag() << " x " << IncrDis6(0) <<" y "<< IncrDis6(1) << " z "<< IncrDis6(2) << endlnn;
01368     //opserr << " incr del node " << theNodes[6]->getTag() << " x " << IncrDis7(0) <<" y "<< IncrDis7(1) << " z "<< IncrDis7(2) << endlnn;
01369     //opserr << " incr del node " << theNodes[7]->getTag() << " x " << IncrDis8(0) <<" y "<< IncrDis8(1) << " z "<< IncrDis8(2) << endlnn;
01370     //}
01371 
01372     increment_disp.val(1,1)=IncrDis1(0); increment_disp.val(1,2)=IncrDis1(1);increment_disp.val(1,3)=IncrDis1(2);
01373     increment_disp.val(2,1)=IncrDis2(0); increment_disp.val(2,2)=IncrDis2(1);increment_disp.val(2,3)=IncrDis2(2);
01374     increment_disp.val(3,1)=IncrDis3(0); increment_disp.val(3,2)=IncrDis3(1);increment_disp.val(3,3)=IncrDis3(2);
01375     increment_disp.val(4,1)=IncrDis4(0); increment_disp.val(4,2)=IncrDis4(1);increment_disp.val(4,3)=IncrDis4(2);
01376     increment_disp.val(5,1)=IncrDis5(0); increment_disp.val(5,2)=IncrDis5(1);increment_disp.val(5,3)=IncrDis5(2);
01377     increment_disp.val(6,1)=IncrDis6(0); increment_disp.val(6,2)=IncrDis6(1);increment_disp.val(6,3)=IncrDis6(2);
01378     increment_disp.val(7,1)=IncrDis7(0); increment_disp.val(7,2)=IncrDis7(1);increment_disp.val(7,3)=IncrDis7(2);
01379     increment_disp.val(8,1)=IncrDis8(0); increment_disp.val(8,2)=IncrDis8(1);increment_disp.val(8,3)=IncrDis8(2);
01380     
01381     return increment_disp;
01382   }
01383 
01385 tensor EightNodeBrick::total_disp(void)
01386   {
01387     const int dimensions[] = {8,3};  // Xiaoyan changed from {20,3} to {8,3} for 8 nodes
01388     tensor total_disp(2, dimensions, 0.0);
01389       
01390     //Zhaohui using node pointers, which come from the Domain
01391     const Vector &TotDis1 = theNodes[0]->getTrialDisp();
01392 //    opserr<<"\ntot node " << theNodes[0]->getTag() <<" x "<< TotDis1(0) <<" y "<< TotDis1(1) << " z "<< TotDis1(2) << endln;
01393     const Vector &TotDis2 = theNodes[1]->getTrialDisp();                        
01394 //    opserr << "tot node " << theNodes[1]->getTag() << " x " << TotDis2(0) <<" y "<< TotDis2(1) << " z "<< TotDis2(2) << endln;
01395     const Vector &TotDis3 = theNodes[2]->getTrialDisp();                        
01396 //    opserr << "tot node " << theNodes[2]->getTag() << " x " << TotDis3(0) <<" y "<< TotDis3(1) << " z "<< TotDis3(2) << endln;
01397     const Vector &TotDis4 = theNodes[3]->getTrialDisp();                        
01398 //    opserr << "tot node " << theNodes[3]->getTag() << " x " << TotDis4(0) <<" y "<< TotDis4(1) << " z "<< TotDis4(2) << endln;
01399     const Vector &TotDis5 = theNodes[4]->getTrialDisp();                        
01400 //    opserr << "tot node " << theNodes[4]->getTag() << " x " << TotDis5(0) <<" y "<< TotDis5(1) << " z "<< TotDis5(2) << endln;
01401     const Vector &TotDis6 = theNodes[5]->getTrialDisp();                        
01402 //    opserr << "tot node " << theNodes[5]->getTag() << " x " << TotDis6(0) <<" y "<< TotDis6(1) << " z "<< TotDis6(2) << endln;
01403     const Vector &TotDis7 = theNodes[6]->getTrialDisp();                        
01404 //    opserr << "tot node " << theNodes[6]->getTag() << " x " << TotDis7(0) <<" y "<< TotDis7(1) << " z "<< TotDis7(2) << endln;
01405     const Vector &TotDis8 = theNodes[7]->getTrialDisp();                        
01406 //    opserr << "tot node " << theNodes[7]->getTag() << " x " << TotDis8(0) <<" y "<< TotDis8(1) << " z "<< TotDis8(2) << endln;
01407     
01408     total_disp.val(1,1)=TotDis1(0); total_disp.val(1,2)=TotDis1(1);total_disp.val(1,3)=TotDis1(2);
01409     total_disp.val(2,1)=TotDis2(0); total_disp.val(2,2)=TotDis2(1);total_disp.val(2,3)=TotDis2(2);
01410     total_disp.val(3,1)=TotDis3(0); total_disp.val(3,2)=TotDis3(1);total_disp.val(3,3)=TotDis3(2);
01411     total_disp.val(4,1)=TotDis4(0); total_disp.val(4,2)=TotDis4(1);total_disp.val(4,3)=TotDis4(2);
01412     total_disp.val(5,1)=TotDis5(0); total_disp.val(5,2)=TotDis5(1);total_disp.val(5,3)=TotDis5(2);
01413     total_disp.val(6,1)=TotDis6(0); total_disp.val(6,2)=TotDis6(1);total_disp.val(6,3)=TotDis6(2);
01414     total_disp.val(7,1)=TotDis7(0); total_disp.val(7,2)=TotDis7(1);total_disp.val(7,3)=TotDis7(2);
01415     total_disp.val(8,1)=TotDis8(0); total_disp.val(8,2)=TotDis8(1);total_disp.val(8,3)=TotDis8(2);
01416 
01417     return total_disp;
01418   }
01419 
01420 
01422 tensor EightNodeBrick::total_disp(FILE *fp, double * u)
01423   {
01424     const int dimensions[] = {8,3};  // Xiaoyan changed from {20,3} to {8,3} for 8 nodes
01425     tensor total_disp(2, dimensions, 0.0);
01426     //    double totalx, totaly, totalz;
01427     //    totalx=0;
01428     //    totaly=0;
01429     //    totalz=0;
01430 
01431     //for ( int i=0 ; i<8 ; i++ )  // Xiaoyan changed from 20 to 8 for 8 nodes
01432     //
01433     //  {
01434     //    // total_disp.val(i+1,1) = nodes[ G_N_numbs[i] ].total_translation_x(u);
01435     //    // total_disp.val(i+1,2) = nodes[ G_N_numbs[i] ].total_translation_y(u);
01436     //    // total_disp.val(i+1,3) = nodes[ G_N_numbs[i] ].total_translation_z(u);
01437     //    // Xiaoyan changed to the following 09/27/00
01438     //    Vector TotalTranDis = nodes[ G_N_numbs[i] ].getDisp();
01439     //
01440     //    total_disp.val(i+1,1) = TotalTranDis(0);
01441     //  total_disp.val(i+1,2) = TotalTranDis(1);
01442     //    total_disp.val(i+1,3) = TotalTranDis(2);
01443     //
01444     //  }
01445       
01446     //Zhaohui using node pointers, which come from the Domain
01447     const Vector &TotDis1 = theNodes[0]->getTrialDisp();
01448     const Vector &TotDis2 = theNodes[1]->getTrialDisp();
01449     const Vector &TotDis3 = theNodes[2]->getTrialDisp();
01450     const Vector &TotDis4 = theNodes[3]->getTrialDisp();
01451     const Vector &TotDis5 = theNodes[4]->getTrialDisp();
01452     const Vector &TotDis6 = theNodes[5]->getTrialDisp();
01453     const Vector &TotDis7 = theNodes[6]->getTrialDisp();
01454     const Vector &TotDis8 = theNodes[7]->getTrialDisp();
01455     
01456     total_disp.val(1,1)=TotDis1(0); total_disp.val(1,2)=TotDis1(1);total_disp.val(1,3)=TotDis1(2);
01457     total_disp.val(2,1)=TotDis2(0); total_disp.val(2,2)=TotDis2(1);total_disp.val(2,3)=TotDis2(2);
01458     total_disp.val(3,1)=TotDis3(0); total_disp.val(3,2)=TotDis3(1);total_disp.val(3,3)=TotDis3(2);
01459     total_disp.val(4,1)=TotDis4(0); total_disp.val(4,2)=TotDis4(1);total_disp.val(4,3)=TotDis4(2);
01460     total_disp.val(5,1)=TotDis5(0); total_disp.val(5,2)=TotDis5(1);total_disp.val(5,3)=TotDis5(2);
01461     total_disp.val(6,1)=TotDis6(0); total_disp.val(6,2)=TotDis6(1);total_disp.val(6,3)=TotDis6(2);
01462     total_disp.val(7,1)=TotDis7(0); total_disp.val(7,2)=TotDis7(1);total_disp.val(7,3)=TotDis7(2);
01463     total_disp.val(8,1)=TotDis8(0); total_disp.val(8,2)=TotDis8(1);total_disp.val(8,3)=TotDis8(2);
01464 
01465     return total_disp;
01466   }
01467 
01468 
01470 int EightNodeBrick::get_global_number_of_node(int local_node_number)
01471 {
01472   //return G_N_numbs[local_node_number];  
01473   return connectedExternalNodes(local_node_number);
01474 }
01475 
01477 int  EightNodeBrick::get_Brick_Number(void)
01478 {
01479   //return elem_numb;
01480   return this->getTag();
01481 }
01482 
01484 int * EightNodeBrick::get_LM(void)
01485   {
01486     return LM;
01487   }
01488 
01490 // returns nodal forces for given stress field in an element
01491 tensor EightNodeBrick::nodal_forces(void)
01492   {
01493 
01494 //BJ//BJ
01495 //BJ    opserr << "\n\n\n\n Print in tensor EightNodeBrick::nodal_forces(" <<endln; this->Print(opserr);
01496 //BJ//BJ
01497 
01498     int force_dim[] = {8,3};  // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
01499 
01500     tensor nodal_forces(2,force_dim,0.0);
01501 
01502     double r  = 0.0;
01503     double rw = 0.0;
01504     double s  = 0.0;
01505     double sw = 0.0;
01506     double t  = 0.0;
01507     double tw = 0.0;
01508 
01509     short where = 0;
01510     double weight = 0.0;
01511 
01512     int dh_dim[] = {8,3};  // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
01513 
01514     tensor dh(2, dh_dim, 0.0);
01515 
01516     stresstensor stress_at_GP(0.0);
01517 
01518     double det_of_Jacobian = 0.0;
01519 
01520     straintensor incremental_strain;
01521 
01522     static int disp_dim[] = {8,3};   // Xiaoyan changed from {20,3} to {8,3}
01523     tensor incremental_displacements(2,disp_dim,0.0); // \Delta u
01524 
01525     incremental_displacements = incr_disp();
01526 
01527     tensor Jacobian;
01528     tensor JacobianINV;
01529     tensor dhGlobal;
01530 
01531     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
01532       {
01533         r = get_Gauss_p_c( r_integration_order, GP_c_r );
01534         rw = get_Gauss_p_w( r_integration_order, GP_c_r );
01535 
01536         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
01537           {
01538             s = get_Gauss_p_c( s_integration_order, GP_c_s );
01539             sw = get_Gauss_p_w( s_integration_order, GP_c_s );
01540 
01541             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
01542               {
01543                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
01544                 tw = get_Gauss_p_w( t_integration_order, GP_c_t );
01545 
01546                 // this short routine is supposed to calculate position of
01547                 // Gauss point from 3D array of short's
01548                 where =
01549                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
01550 
01551                 // derivatives of local coordiantes with respect to local coordiantes
01552                 dh = dh_drst_at(r,s,t);
01553 
01554                 // Jacobian tensor ( matrix )
01555                 Jacobian = Jacobian_3D(dh);
01556                 //....                Jacobian.print("J");
01557 
01558                 // Inverse of Jacobian tensor ( matrix )
01559                 JacobianINV = Jacobian_3Dinv(dh);
01560                 //....                JacobianINV.print("JINV");
01561 
01562                 // determinant of Jacobian tensor ( matrix )
01563                 det_of_Jacobian  = Jacobian.determinant();
01564                 //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
01565 
01566                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
01567                 dhGlobal = dh("ij") * JacobianINV("kj");
01568 
01569                 //weight
01570                 weight = rw * sw * tw * det_of_Jacobian;
01571     //opserr << " UCD det_of_Jacobian "<< det_of_Jacobian << endln;
01572                 //..::printf("\n\nIN THE nodal forces ----**************** where = %d \n", where);
01573                 //..::printf("                    GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
01574                 //..                           GP_c_r,GP_c_s,GP_c_t);
01575                 //..::printf("WEIGHT = %f", weight);
01576                 //..::printf("determinant of Jacobian = %f", det_of_Jacobian);
01577                 //..matpoint[where].report("Gauss Point\n");
01578 
01579                 //..   // samo jos odredi ovaj tensor E i to za svaku gauss tacku drugaciji !!!!!!!!!!!!
01580                 //..   ovde negde bi trebalo da se na osnovu inkrementalnih pomeranja
01581                 //..   nadje inkrementalna deformacija ( strain_increment ) pa sa njom dalje:
01582                 //..
01584                 //                incremental_displacements = incr_disp();
01585                 //
01587                 //                incremental_strain =
01588                 //                  (dhGlobal("ib")*incremental_displacements("ia")).symmetrize11();
01589                 //
01590                 //                incremental_strain.null_indices();
01592                 //
01595 
01596                 //..   dakle ovde posalji strain_increment jer se stari stress cuva u okviru svake
01597                 //..   Gauss tacke a samo saljes strain_increment koji ce da se prenese
01598                 //..   u integracionu rutinu pa ce ta da vrati krajnji napon i onda moze da
01599                 //..   se pravi ConstitutiveStiffnessTensor.
01600                 //.. Ustvari posalji sve sto imas ( incremental_strain, start_stress,
01601                 //.. number_of_subincrements . . . u ovu Constitutive_tensor funkciju
01602                 //.. pa ona nek ide, u zavisnosti od modela koji se koristi i neka
01603                 //.. onda tamo u svakoj posebnoj modelskoj funkciji vrati sta treba
01604                 //.. ( recimo Elastic odmah vraca Eelastic a recimo MRS_Lade prvo
01605                 //.. pita koji nacin integracije da koristi pa onda u zvisnosti od toga
01606                 //.. zove funkcuju koja integrali za taj algoritam ( ForwardEuler, BakcwardEuler,
01607                 //.. SemiBackwardEuler, . . . ) i onda kada funkcija vrati napon onda
01608                 //.. se opet pita koji je tip integracije bio u pitanju pa pravi odgovarajuci
01609                 //.. ConstitutiveTensor i vraca ga nazad!
01610 
01611                 //                   stress_at_GP = (GPstress)->operator[](where);
01612                 //stress_at_GP = GPstress[where];
01613 
01614           //EPState *tmp_eps = (matpoint[where]->matmodel)->getEPS();
01615     //stress_at_GP = tmp_eps->getStress();
01616     //opserr << "tmp_eps" << (*tmp_eps);
01617 
01618           //NDMaterial *tmp_ndm = (matpoint[where]).getNDMat();
01619     
01620     //if ( tmp_eps ) {     //Elasto-plastic case
01621      
01622     //stress_at_GP = (matpoint[where].matmodel->getEPS())->getStress();
01623     
01624     //   EPState *tmp_eps = (matpoint[where]->matmodel)->getEPS();
01625     //   stress_at_GP = tmp_eps->getStress();
01626 
01627     
01628     
01629 //Guanzhou out 5-6-2004    incremental_strain =
01630 //Guanzhou out 5-6-2004                     (dhGlobal("ib")*incremental_displacements("ia")).symmetrize11();
01631 //Guanzhou out 5-6-2004//    if (where == 0)
01632 //Guanzhou out 5-6-2004//       //opserr << " In nodal_force delta_incremental_strain tag "<< getTag() <<"  " <<incremental_strain << endln;
01633 //Guanzhou out 5-6-2004////    opserr << " el tag = "<< getTag();
01634 //Guanzhou out 5-6-2004//    
01635 //Guanzhou out 5-6-2004    int err = ( matpoint[where]->matmodel )->setTrialStrainIncr( incremental_strain);
01636 //Guanzhou out 5-6-2004    if ( err)
01637 //Guanzhou out 5-6-2004      opserr << "EightNodeBrick::getStiffnessTensor (tag: " << this->getTag() << "), not converged\n";
01638          
01639 
01640     //char *test = matpoint[where]->matmodel->getType();
01641     // fmk - changing if so if into else block must be Template3Dep
01642 //    if (strcmp(matpoint[where]->matmodel->getType(),"Template3Dep") != 0)
01643        stress_at_GP = matpoint[where]->getStressTensor();
01644 
01645 //         stress_at_GP.report("PROBLEM");
01646 //         getchar();
01647 
01648 //    else
01649 //    {
01650 //             //Some thing funny happened when getting stress directly from matpoint[where], i have to do it this way!
01651 //       EPState *tmp_eps = ((Template3Dep *)(matpoint[where]->matmodel))->getEPS();
01652 //       stress_at_GP = tmp_eps->getStress();
01653 //       //delete tmp_eps;
01654 //           }
01655     
01656              //double  p = stress_at_GP.p_hydrostatic();
01657                 //if ( p < 0.0 ) 
01658           //{
01659           //  opserr << getTag();
01660           //  opserr << " ***p  =    " << p << endln;
01661           //}
01662 
01663     //opserr << " nodal_force ::: stress_at_GP " << stress_at_GP << endln;
01664     
01665     //}
01666     //else if ( tmp_ndm ) { //Elastic case
01667                //    stress_at_GP = (matpoint[where].getNDMat())->getStressTensor();
01668     //}
01669     //else {
01670                  //   g3ErrorHandler->fatal("EightNodeBrick::nodal_forces (tag: %d), could not getStress", this->getTag());
01671     //   exit(1);
01672     //}
01673 
01674                 //stress_at_GP.report("\n stress_at_GPtensor at GAUSS point for nodal forces \n");
01675 
01676                 // nodal forces See Zienkievicz part 1 pp 108
01677                 nodal_forces =
01678                      nodal_forces + dhGlobal("ib")*stress_at_GP("ab")*weight;
01679                 //nodal_forces.print("nf","\n\n Nodal Forces \n");
01680  
01681               }
01682           }
01683       }
01684 
01685     //opserr << "\n element no. " << getTag() << endln;
01686     //nodal_forces.print("nf","\n Nodal Forces \n");
01687     return nodal_forces;
01688 
01689   }
01690 
01692 // returns nodal forces for given ITERATIVE stress field in an element
01693 tensor EightNodeBrick::iterative_nodal_forces(void)
01694   {
01695 
01696 //BJ//BJ
01697 //BJ    opserr << "\n\n\n\n Print in tensor EightNodeBrick::iterative_nodal_forces(void)" <<endln; this->Print(opserr);
01698 //BJ//BJ
01699 
01700     int force_dim[] = {8,3}; // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
01701 
01702     tensor nodal_forces(2,force_dim,0.0);
01703 
01704     double r  = 0.0;
01705     double rw = 0.0;
01706     double s  = 0.0;
01707     double sw = 0.0;
01708     double t  = 0.0;
01709     double tw = 0.0;
01710 
01711     short where = 0;
01712     double weight = 0.0;
01713 
01714     int dh_dim[] = {8,3};   // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
01715 
01716     tensor dh(2, dh_dim, 0.0);
01717 
01718     stresstensor stress_at_GP(0.0);
01719 
01720     double det_of_Jacobian = 0.0;
01721 
01722     tensor Jacobian;
01723     tensor JacobianINV;
01724     tensor dhGlobal;
01725 
01726     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
01727       {
01728         r = get_Gauss_p_c( r_integration_order, GP_c_r );
01729         rw = get_Gauss_p_w( r_integration_order, GP_c_r );
01730 
01731         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
01732           {
01733             s = get_Gauss_p_c( s_integration_order, GP_c_s );
01734             sw = get_Gauss_p_w( s_integration_order, GP_c_s );
01735 
01736             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
01737               {
01738                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
01739                 tw = get_Gauss_p_w( t_integration_order, GP_c_t );
01740 
01741                 // this short routine is supposed to calculate position of
01742                 // Gauss point from 3D array of short's
01743                 where =
01744                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
01745                 //.....
01746                 //.....::printf("EightNodeBrick::iterative_nodal_forces(void)  ----**************** where = %d \n", where);
01747                 //.....::printf("UPDATE ");
01748                 //.....::printf("   GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
01749                 //.....                           GP_c_r,GP_c_s,GP_c_t);
01750                 // derivatives of local coordiantes with respect to local coordiantes
01751                 dh = dh_drst_at(r,s,t);
01752 
01753                 // Jacobian tensor ( matrix )
01754                 Jacobian = Jacobian_3D(dh);
01755                 //....                Jacobian.print("J");
01756 
01757                 // Inverse of Jacobian tensor ( matrix )
01758                 JacobianINV = Jacobian_3Dinv(dh);
01759                 //....                JacobianINV.print("JINV");
01760 
01761                 // determinant of Jacobian tensor ( matrix )
01762                 det_of_Jacobian  = Jacobian.determinant();
01763                 //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
01764     
01765                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
01766                 dhGlobal = dh("ij") * JacobianINV("kj");
01767 
01768                 //weight
01769                 weight = rw * sw * tw * det_of_Jacobian;
01770 
01771                 //                   stress_at_GP = (GPstress)->operator[](where);
01772                 //stress_at_GP = GPiterative_stress[where];
01773                 
01774     //stress_at_GP = ( matpoint[where].getTrialEPS() )->getStress();
01775                 stress_at_GP = matpoint[where]->getStressTensor();
01776                 stress_at_GP.reportshortpqtheta("\n iterative_stress at GAUSS point in iterative_nodal_force\n");
01777 
01778                 // nodal forces See Zienkievicz part 1 pp 108
01779                 nodal_forces =
01780                   nodal_forces + dhGlobal("ib")*stress_at_GP("ab")*weight;
01781                 //nodal_forces.print("nf","\n EightNodeBrick::iterative_nodal_forces Nodal Forces ~~~~\n");
01782 
01783               }
01784           }
01785       }
01786 
01787 
01788     return nodal_forces;
01789 
01790   }
01791 
01793 // returns nodal forces for given constant stress field in the element
01794 tensor EightNodeBrick::nodal_forces_from_stress(stresstensor & stress)
01795   {
01796 
01797 
01798 //BJ//BJ
01799 //BJ    opserr << "\n\n\n\n Print in tensor EightNodeBrick::nodal_forces_from_stress(stresstensor & stress)" <<endln; this->Print(opserr);
01800 //BJ//BJ
01801 
01802     int force_dim[] = {8,3};  // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
01803 
01804     tensor nodal_forces(2,force_dim,0.0);
01805 
01806     double r  = 0.0;
01807     double rw = 0.0;
01808     double s  = 0.0;
01809     double sw = 0.0;
01810     double t  = 0.0;
01811     double tw = 0.0;
01812 
01813     double weight = 0.0;
01814 
01815     int dh_dim[] = {8,3}; // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
01816 
01817     tensor dh(2, dh_dim, 0.0);
01818   
01819     double det_of_Jacobian = 0.0;
01820 
01821     tensor Jacobian;
01822     tensor JacobianINV;
01823     tensor dhGlobal;
01824 
01825     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
01826       {
01827         r = get_Gauss_p_c( r_integration_order, GP_c_r );
01828         rw = get_Gauss_p_w( r_integration_order, GP_c_r );
01829 
01830         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
01831           {
01832             s = get_Gauss_p_c( s_integration_order, GP_c_s );
01833             sw = get_Gauss_p_w( s_integration_order, GP_c_s );
01834 
01835             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
01836               {
01837                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
01838                 tw = get_Gauss_p_w( t_integration_order, GP_c_t );
01839 
01840                 // this short routine is supposed to calculate position of
01841                 // Gauss point from 3D array of short's
01842                 //--                where =
01843                 //--                ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
01844                 //.....
01845                 //.....::printf("EightNodeBrick::iterative_nodal_forces(void)  ----**************** where = %d \n", where);
01846                 //.....::printf("UPDATE ");
01847                 //.....::printf("   GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
01848                 //.....                           GP_c_r,GP_c_s,GP_c_t);
01849                 // derivatives of local coordiantes with respect to local coordiantes
01850                 dh = dh_drst_at(r,s,t);
01851 
01852                 // Jacobian tensor ( matrix )
01853                 Jacobian = Jacobian_3D(dh);
01854                 //....                Jacobian.print("J");
01855 
01856                 // Inverse of Jacobian tensor ( matrix )
01857                 JacobianINV = Jacobian_3Dinv(dh);
01858                 //....                JacobianINV.print("JINV");
01859 
01860                 // determinant of Jacobian tensor ( matrix )
01861                 det_of_Jacobian  = Jacobian.determinant();
01862                 //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
01863 
01864                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
01865                 dhGlobal = dh("ij") * JacobianINV("kj");
01866 
01867                 //weight
01868                 weight = rw * sw * tw * det_of_Jacobian;
01869 
01870                 //                   stress_at_GP = (GPstress)->operator[](where);
01871                 //                stress_at_GP = GPiterative_stress[where];
01872                 //GPiterative_stress[where].reportshortpqtheta("\n iterative_stress at GAUSS point in iterative_nodal_force\n");
01873 
01874                 // nodal forces See Zienkievicz part 1 pp 108
01875                 nodal_forces =
01876                   nodal_forces + dhGlobal("ib")*stress("ab")*weight;
01877                 //nodal_forces.print("nf","\n EightNodeBrick::iterative_nodal_forces Nodal Forces ~~~~\n");
01878 
01879               }
01880           }
01881       }
01882 
01883     return nodal_forces;
01884 
01885   }
01886 
01887 
01889 // returns nodal forces for given incremental strain field in an element
01890 // by using the linearized constitutive tensor from the begining of the step !
01891 tensor EightNodeBrick::linearized_nodal_forces(void)
01892   {
01893     int force_dim[] = {8,3};  // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
01894 
01895     tensor linearized_nodal_forces(2,force_dim,0.0);
01896 
01897     double r  = 0.0;
01898     double rw = 0.0;
01899     double s  = 0.0;
01900     double sw = 0.0;
01901     double t  = 0.0;
01902     double tw = 0.0;
01903 
01904     short where = 0;
01905     double weight = 0.0;
01906 
01907     int dh_dim[] = {8,3};  // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
01908 
01909     tensor dh(2, dh_dim, 0.0);
01910 
01911     tensor Constitutive( 4, def_dim_4, 0.0);
01912 
01913     double det_of_Jacobian = 0.0;
01914 
01915     static int disp_dim[] = {8,3};  // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
01916 
01917     tensor incremental_displacements(2,disp_dim,0.0);
01918 
01919     straintensor incremental_strain;
01920 
01921     tensor Jacobian;
01922     tensor JacobianINV;
01923     tensor dhGlobal;
01924 
01925     stresstensor final_linearized_stress;
01926     //    stresstensor incremental_stress;
01927     // tensor of incremental displacements taken from node objects for this element !
01928     incremental_displacements = incr_disp();
01929     //incremental_displacements.print("disp","\n incremental_displacements tensor at GAUSS point in iterative_Update\n");
01930 
01931     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
01932       {
01933         r = get_Gauss_p_c( r_integration_order, GP_c_r );
01934         rw = get_Gauss_p_w( r_integration_order, GP_c_r );
01935 
01936         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
01937           {
01938             s = get_Gauss_p_c( s_integration_order, GP_c_s );
01939             sw = get_Gauss_p_w( s_integration_order, GP_c_s );
01940 
01941             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
01942               {
01943                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
01944                 tw = get_Gauss_p_w( t_integration_order, GP_c_t );
01945 
01946                 // this short routine is supposed to calculate position of
01947                 // Gauss point from 3D array of short's
01948                 where =
01949                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
01950 
01951                 // derivatives of local coordiantes with respect to local coordiantes
01952                 dh = dh_drst_at(r,s,t);
01953 
01954                 // Jacobian tensor ( matrix )
01955                 Jacobian = Jacobian_3D(dh);
01956                 //....                Jacobian.print("J");
01957 
01958                 // Inverse of Jacobian tensor ( matrix )
01959                 JacobianINV = Jacobian_3Dinv(dh);
01960                 //....                JacobianINV.print("JINV");
01961 
01962                 // determinant of Jacobian tensor ( matrix )
01963                 det_of_Jacobian  = Jacobian.determinant();
01964                 //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
01965 
01966                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
01967                 dhGlobal = dh("ij") * JacobianINV("kj");
01968 
01969                 //weight
01970                 weight = rw * sw * tw * det_of_Jacobian;
01971                 //..::printf("\n\nIN THE nodal forces ----**************** where = %d \n", where);
01972                 //..::printf("                    GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
01973                 //..                           GP_c_r,GP_c_s,GP_c_t);
01974                 //..::printf("WEIGHT = %f", weight);
01975                 //..::printf("determinant of Jacobian = %f", det_of_Jacobian);
01976                 // incremental straines at this Gauss point
01977                 // now in Update we know the incremental displacements so let's find
01978                 // the incremental strain
01979                 incremental_strain =
01980                  (dhGlobal("ib")*incremental_displacements("ia")).symmetrize11();
01981                 incremental_strain.null_indices();
01982                 //incremental_strain.reportshort("\n incremental_strain tensor at GAUSS point in iterative_Update\n");
01983 
01984                 //Constitutive = GPtangent_E[where];
01985                 
01986           //EPState *tmp_eps = (matpoint[where]).getEPS();
01987           //NDMaterial *tmp_ndm = (matpoint[where]).getNDMat();
01988 
01989     //if ( tmp_eps ) {     //Elasto-plastic case
01990     //    mmodel->setEPS( *tmp_eps );
01991     if ( ! (matpoint[where]->matmodel)->setTrialStrainIncr( incremental_strain)  )
01992       opserr << "EightNodeBrick::linearized_nodal_forces (tag: " << this->getTag() << "), not converged\n";
01993 
01994     Constitutive = (matpoint[where]->matmodel)->getTangentTensor();
01995           //    matpoint[where].setEPS( mmodel->getEPS() ); //Set the new EPState back
01996     //}
01997     //else if ( tmp_ndm ) { //Elastic case
01998     //    (matpoint[where].p_matmodel)->setTrialStrainIncr( incremental_strain );
01999     //    Constitutive = (matpoint[where].p_matmodel)->getTangentTensor();
02000     //}
02001     //else {
02002                  //   g3ErrorHandler->fatal("EightNodeBrick::incremental_Update (tag: %d), could not getTangentTensor", this->getTag());
02003     //   exit(1);
02004     //}
02005     
02006     //Constitutive = ( matpoint[where].getEPS() )->getEep();
02007                 //..//GPtangent_E[where].print("\n tangent E at GAUSS point \n");
02008 
02009                 final_linearized_stress =
02010                   Constitutive("ijkl") * incremental_strain("kl");
02011 
02012                 // nodal forces See Zienkievicz part 1 pp 108
02013                 linearized_nodal_forces = linearized_nodal_forces +
02014                           dhGlobal("ib")*final_linearized_stress("ab")*weight;
02015                 //::::::                   nodal_forces.print("nf","\n\n Nodal Forces \n");
02016 
02017               }
02018           }
02019       }
02020 
02021 
02022     return linearized_nodal_forces;
02023 
02024   }
02025 
02026 //#############################################################################
02027 void EightNodeBrick::report(char * msg)
02028   {
02029     if ( msg ) ::printf("** %s",msg);
02030     ::printf("\n Element Number = %d\n", this->getTag() );
02031     ::printf("\n Number of nodes in a EightNodebrick = %d\n",
02032                                               nodes_in_brick);
02033     ::printf("\n Determinant of Jacobian (! ==0 before comp.) = %f\n",
02034                                                   determinant_of_Jacobian);
02035 
02036     ::printf("Node numbers \n");
02037     ::printf(
02038 ".....1.....2.....3.....4.....5.....6.....7.....8.....9.....0.....1.....2\n");
02039            for ( int i=0 ; i<8 ; i++ ) 
02040       //::printf("%6d",G_N_numbs[i]);
02041       ::printf("%6d",connectedExternalNodes(i));
02042     ::printf("\n");
02043     //           for ( int j=8 ; j<20 ; j++ )
02044     //             ::printf("%6d",G_N_numbs[j]);     // Commented by Xiaoyan
02045     ::printf("\n\n");
02046 
02047     //    ::printf("Node existance array \n");
02048     //           for ( int k=0 ; k<12 ; k++ )
02049     //             ::printf("%6d",node_existance[k]);
02050     //           ::printf("\n\n");          // Commented by Xiaoyan
02051 
02052 
02053     int total_number_of_Gauss_points = r_integration_order*
02054                                        s_integration_order*
02055                                        t_integration_order;
02056     if ( total_number_of_Gauss_points != 0 )
02057       {
02058            // report from Node class
02059            //for ( int in=0 ; in<8 ; in++ )
02060            //             (nodes[G_N_numbs[in]]).report("nodes from within element (first 8)\n");
02061            //Xiaoyan changed .report to . Print in above line 09/27/00
02062      //  (nodes[G_N_numbs[in]]).Print(opserr);
02063 
02064      theNodes[0]->Print(opserr);
02065      theNodes[1]->Print(opserr);
02066      theNodes[2]->Print(opserr);
02067      theNodes[3]->Print(opserr);
02068      theNodes[4]->Print(opserr);
02069      theNodes[5]->Print(opserr);
02070            theNodes[6]->Print(opserr);
02071      theNodes[7]->Print(opserr);
02072 
02073      //           for ( int jn=8 ; jn<20 ; jn++ )
02074            //             (nodes[G_N_numbs[jn]]).report("nodes from within element (last 12)\n");
02075            // Commented by Xiaoyan
02076       }
02077 
02078     ::printf("\n\nGauss-Legendre integration order\n");
02079     ::printf("Integration order in r direction = %d\n",r_integration_order);
02080     ::printf("Integration order in s direction = %d\n",s_integration_order);
02081     ::printf("Integration order in t direction = %d\n\n",t_integration_order);
02082 
02083 
02084 
02085     for( int GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
02086       {
02087         for( int GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
02088           {
02089             for( int GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
02090               {
02091                 // this short routine is supposed to calculate position of
02092                 // Gauss point from 3D array of short's
02093                 short where =
02094                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
02095 
02096                 ::printf("\n\n----------------**************** where = %d \n", where);
02097                 ::printf("                    GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
02098                             GP_c_r,GP_c_s,GP_c_t);
02099                 matpoint[where]->report("Material Point\n");
02100                 //GPstress[where].reportshort("stress at Gauss Point");
02101                 //GPstrain[where].reportshort("strain at Gauss Point");
02102                 //matpoint[where].report("Material model  at Gauss Point");
02103               }
02104           }
02105       }
02106 
02107   }
02108 
02109 
02110 //#############################################################################
02111 void EightNodeBrick::reportshort(char * msg)
02112   {
02113     if ( msg ) ::printf("** %s",msg);
02114     ::printf("\n Element Number = %d\n", this->getTag() );
02115     ::printf("\n Number of nodes in a EightNodeBrick = %d\n",
02116                                               nodes_in_brick);
02117     ::printf("\n Determinant of Jacobian (! ==0 before comp.) = %f\n",
02118                                                   determinant_of_Jacobian);
02119 
02120     ::printf("Node numbers \n");
02121     ::printf(
02122 ".....1.....2.....3.....4.....5.....6.....7.....8.....9.....0.....1.....2\n");
02123            for ( int i=0 ; i<8 ; i++ )
02124              //::printf("%6d",G_N_numbs[i]);
02125              ::printf( "%6d",connectedExternalNodes(i) );
02126            
02127      ::printf("\n");
02128            //           for ( int j=8 ; j<20 ; j++ )
02129            //             ::printf("%6d",G_N_numbs[j]);   //// Commented by Xiaoyan
02130            ::printf("\n\n");
02131 
02132            //    ::printf("Node existance array \n");
02133            //           for ( int k=0 ; k<12 ; k++ )
02134            //             ::printf("%6d",node_existance[k]);     // Commented by Xiaoyan
02135            ::printf("\n\n");
02136              
02137   }
02138 
02139 
02140 
02141 
02142 //#############################################################################
02143 void EightNodeBrick::reportPAK(char * msg)
02144   {
02145     if ( msg ) ::printf("%s",msg);
02146     ::printf("%10d   ",  this->getTag());
02147            for ( int i=0 ; i<8 ; i++ )
02148              ::printf( "%6d",connectedExternalNodes(i) );
02149              //::printf("%6d",G_N_numbs[i]);
02150 
02151     printf("\n");
02152   }
02153 
02154 
02155 //#############################################################################
02156 void EightNodeBrick::reportpqtheta(int GP_numb)
02157   {
02158     short where = GP_numb-1;
02159     matpoint[where]->reportpqtheta("");
02160   }
02161 
02163 //Vector EightNodeBrick::reportLM(char * msg) 
02164 //  {
02165 //    if ( msg ) ::printf("%s",msg);
02166 //    ::printf("Element # %d, LM->", this->get_Brick_Number());
02167 //    for (int count = 0 ; count < 24 ; count++)
02168 //      {
02169 //        ::printf(" %d", LM[count]);
02170 //      }
02171 //    ::printf("\n");
02172 //
02173 //  }
02174 
02175 //#############################################################################
02176 //Compute gauss point coordinates
02177 void EightNodeBrick::computeGaussPoint()
02178   {
02179     //    if ( msg ) ::printf("** %s\n",msg);
02180     
02181     // special case for 8 nodes only
02182     // special case for 8 nodes only
02183     int count;
02184     count = FixedOrder*FixedOrder*FixedOrder;
02185     //Vector Gsc(count*3+1); //+1: number of Gauss point in element
02186     Gsc8(0) = count;
02187 
02188     double r  = 0.0;
02189     double s  = 0.0;
02190     double t  = 0.0;
02191 
02192     short where = 0;
02193 
02194     // special case for 8 nodes only
02195     static const int dim[] = {3, 8}; // static-> see ARM pp289-290
02196     static const int dimM[] = {3,  FixedOrder*FixedOrder*FixedOrder}; // found a bug: dimM depends on Order of Gauss Points Joey Yang March 02, 02
02197     tensor NodalCoord(2, dim, 0.0);
02198     tensor matpointCoord(2, dimM, 0.0);
02199     int h_dim[] = {24,3};   // Xiaoyan changed from {60,3} to {24,3} for 8 nodes
02200     tensor H(2, h_dim, 0.0);
02201 
02202     //for (int ncount = 1 ; ncount <= 8 ; ncount++ )
02204     //  { 
02205     //  //int global_node_number = get_global_number_of_node(ncount-1);
02206     //  // printf("global node num %d",global_node_number);
02207     //
02208     //    //   NodalCoord.val(1,ncount) = nodes[global_node_number].x_coordinate();
02209     //    //   NodalCoord.val(2,ncount) = nodes[global_node_number].y_coordinate();
02210     //    //   NodalCoord.val(3,ncount) = nodes[global_node_number].z_coordinate();
02211     //    // Xiaoyan changed to the following:  09/27/00
02212     //  Vector Coordinates = nodes[global_node_number].getCrds();
02213     //    
02214     //    NodalCoord.val(1,ncount) = Coordinates(0);
02215     //    NodalCoord.val(2,ncount) = Coordinates(1);
02216     //    NodalCoord.val(3,ncount) = Coordinates(2);
02217     //printf("global point %d     x=%+.6e   y=%+.6e   z=%+.6e \n ", global_node_number, 
02218     //                                                      NodalCoord.val(1,ncount),
02219     //                  NodalCoord.val(2,ncount),
02220     //                  NodalCoord.val(3,ncount));
02221     //}
02222     
02223     //Zhaohui using node pointers, which come from the Domain
02224     const Vector &nd1Crds = theNodes[0]->getCrds();
02225     const Vector &nd2Crds = theNodes[1]->getCrds();
02226     const Vector &nd3Crds = theNodes[2]->getCrds();
02227     const Vector &nd4Crds = theNodes[3]->getCrds();
02228     const Vector &nd5Crds = theNodes[4]->getCrds();
02229     const Vector &nd6Crds = theNodes[5]->getCrds();
02230     const Vector &nd7Crds = theNodes[6]->getCrds();
02231     const Vector &nd8Crds = theNodes[7]->getCrds();
02232     
02233     NodalCoord.val(1,1)=nd1Crds(0); NodalCoord.val(2,1)=nd1Crds(1); NodalCoord.val(3,1)=nd1Crds(2);
02234     NodalCoord.val(1,2)=nd2Crds(0); NodalCoord.val(2,2)=nd2Crds(1); NodalCoord.val(3,2)=nd2Crds(2);
02235     NodalCoord.val(1,3)=nd3Crds(0); NodalCoord.val(2,3)=nd3Crds(1); NodalCoord.val(3,3)=nd3Crds(2);
02236     NodalCoord.val(1,4)=nd4Crds(0); NodalCoord.val(2,4)=nd4Crds(1); NodalCoord.val(3,4)=nd4Crds(2);
02237     NodalCoord.val(1,5)=nd5Crds(0); NodalCoord.val(2,5)=nd5Crds(1); NodalCoord.val(3,5)=nd5Crds(2);
02238     NodalCoord.val(1,6)=nd6Crds(0); NodalCoord.val(2,6)=nd6Crds(1); NodalCoord.val(3,6)=nd6Crds(2);
02239     NodalCoord.val(1,7)=nd7Crds(0); NodalCoord.val(2,7)=nd7Crds(1); NodalCoord.val(3,7)=nd7Crds(2);
02240     NodalCoord.val(1,8)=nd8Crds(0); NodalCoord.val(2,8)=nd8Crds(1); NodalCoord.val(3,8)=nd8Crds(2);
02241 
02242 
02243     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
02244       {
02245         r = get_Gauss_p_c( r_integration_order, GP_c_r );
02246         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
02247           {
02248             s = get_Gauss_p_c( s_integration_order, GP_c_s );
02249             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
02250               {
02251                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
02252                 // this short routine is supposed to calculate position of
02253                 // Gauss point from 3D array of short's
02254                 where =
02255                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
02256                 // derivatives of local coordinates with respect to local coordinates
02257 
02258                H = H_3D(r,s,t);
02259 
02260           for (int encount=1 ; encount <= 8 ; encount++ ) 
02261                 //         for (int encount=0 ; encount <= 7 ; encount++ ) 
02262            {
02263                   //  matpointCoord.val(1,where+1) =+NodalCoord.val(1,where+1) * H.val(encount*3-2,1);
02264                   //  matpointCoord.val(2,where+1) =+NodalCoord.val(2,where+1) * H.val(encount*3-1,2);
02265                   //  matpointCoord.val(3,where+1) =+NodalCoord.val(3,where+1) * H.val(encount*3-0,3);
02266                   matpointCoord.val(1,where+1) +=NodalCoord.val(1,encount) * H.val(encount*3-2,1);
02267                   //::printf("-- NO nodal, H_val :%d %+.2e %+.2e %+.5e\n", encount,NodalCoord.val(1,encount),H.val(encount*3-2,1),matpointCoord.val(1,where+1) );
02268                   matpointCoord.val(2,where+1) +=NodalCoord.val(2,encount) * H.val(encount*3-1,2);
02269                   matpointCoord.val(3,where+1) +=NodalCoord.val(3,encount) * H.val(encount*3-0,3);
02270 
02271       }
02272               
02273                //::printf("gauss point# %d   %+.6e %+.6e %+.6e \n", where+1, 
02274                //                                        matpointCoord.val(1,where+1),
02275                //                                        matpointCoord.val(2,where+1),
02276                //                                        matpointCoord.val(3,where+1));
02277          
02278          Gsc8(where*3+1) = matpointCoord.val(1,where+1);
02279          Gsc8(where*3+2) = matpointCoord.val(2,where+1);
02280          Gsc8(where*3+3) = matpointCoord.val(3,where+1);
02281 
02282     //matpoint[where].reportTensor("");
02283 
02284     
02285               }
02286           }
02287       }
02288       //return Gsc8;
02289  }
02290 
02291 
02293 
02294 //#############################################################################
02295 //void EightNodeBrick::reportTensor(char * msg)
02296 // ZHaohui added to print gauss point coord. to file fp
02297 
02298 void EightNodeBrick::reportTensorF(FILE * fp)
02299   {
02300     //if ( msg ) ::printf("** %s\n",msg);
02301 
02302     // special case for 8 nodes only
02303     // special case for 8 nodes only
02304     double r  = 0.0;
02305     double s  = 0.0;
02306     double t  = 0.0;
02307 
02308     short where = 0;
02309 
02310     // special case for 8 nodes only
02311     static const int dim[] = {3, 8}; // static-> see ARM pp289-290
02312     tensor NodalCoord(2, dim, 0.0);
02313     tensor matpointCoord(2, dim, 0.0);
02314     int h_dim[] = {24,3};  // Xiaoyan changed from {60,3} to {24,3} for 8 nodes
02315 
02316     tensor H(2, h_dim, 0.0);
02317 
02318     //for (int ncount = 1 ; ncount <= 8 ; ncount++ )
02319     //  // for (int ncount = 0 ; ncount <= 7 ; ncount++ )
02320     //  { 
02321     //  int global_node_number = get_global_number_of_node(ncount-1);
02322     //  // printf("global node num %d",global_node_number);
02323     //
02324     //    //        NodalCoord.val(1,ncount) = nodes[global_node_number].x_coordinate();
02325     //    //        NodalCoord.val(2,ncount) = nodes[global_node_number].y_coordinate();
02326     //    //        NodalCoord.val(3,ncount) = nodes[global_node_number].z_coordinate();
02327     //    // Xiaoyan changed to the following:  09/27/00
02328     //  Vector Coordinates = nodes[global_node_number].getCrds();
02329     //    NodalCoord.val(1,ncount) = Coordinates(0); 
02330     //    NodalCoord.val(2,ncount) = Coordinates(1); 
02331     //    NodalCoord.val(3,ncount) = Coordinates(2); 
02332     //printf("global point %d     x=%+.6e   y=%+.6e   z=%+.6e \n ", global_node_number, 
02333     //                                                      NodalCoord.val(1,ncount),
02334     //                  NodalCoord.val(2,ncount),
02335     //                  NodalCoord.val(3,ncount));
02336     //  }
02337     
02338     //Zhaohui using node pointers, which come from the Domain
02339     const Vector &nd1Crds = theNodes[0]->getCrds();
02340     const Vector &nd2Crds = theNodes[1]->getCrds();
02341     const Vector &nd3Crds = theNodes[2]->getCrds();
02342     const Vector &nd4Crds = theNodes[3]->getCrds();
02343     const Vector &nd5Crds = theNodes[4]->getCrds();
02344     const Vector &nd6Crds = theNodes[5]->getCrds();
02345     const Vector &nd7Crds = theNodes[6]->getCrds();
02346     const Vector &nd8Crds = theNodes[7]->getCrds();
02347     
02348     NodalCoord.val(1,1)=nd1Crds(0); NodalCoord.val(2,1)=nd1Crds(1); NodalCoord.val(3,1)=nd1Crds(2);
02349     NodalCoord.val(1,2)=nd2Crds(0); NodalCoord.val(2,2)=nd2Crds(1); NodalCoord.val(3,2)=nd2Crds(2);
02350     NodalCoord.val(1,3)=nd3Crds(0); NodalCoord.val(2,3)=nd3Crds(1); NodalCoord.val(3,3)=nd3Crds(2);
02351     NodalCoord.val(1,4)=nd4Crds(0); NodalCoord.val(2,4)=nd4Crds(1); NodalCoord.val(3,4)=nd4Crds(2);
02352     NodalCoord.val(1,5)=nd5Crds(0); NodalCoord.val(2,5)=nd5Crds(1); NodalCoord.val(3,5)=nd5Crds(2);
02353     NodalCoord.val(1,6)=nd6Crds(0); NodalCoord.val(2,6)=nd6Crds(1); NodalCoord.val(3,6)=nd6Crds(2);
02354     NodalCoord.val(1,7)=nd7Crds(0); NodalCoord.val(2,7)=nd7Crds(1); NodalCoord.val(3,7)=nd7Crds(2);
02355     NodalCoord.val(1,8)=nd8Crds(0); NodalCoord.val(2,8)=nd8Crds(1); NodalCoord.val(3,8)=nd8Crds(2);
02356       
02357     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
02358       {
02359         r = get_Gauss_p_c( r_integration_order, GP_c_r );
02360         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
02361           {
02362             s = get_Gauss_p_c( s_integration_order, GP_c_s );
02363             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
02364               {
02365                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
02366                 // this short routine is supposed to calculate position of
02367                 // Gauss point from 3D array of short's
02368                 where =
02369                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
02370                 // derivatives of local coordinates with respect to local coordinates
02371 
02372                H = H_3D(r,s,t);
02373 
02374           for (int encount=1 ; encount <= 8 ; encount++ ) 
02375                 //         for (int encount=0 ; encount <= 7 ; encount++ ) 
02376          {
02377                   //  matpointCoord.val(1,where+1) =+NodalCoord.val(1,where+1) * H.val(encount*3-2,1);
02378                   //  matpointCoord.val(2,where+1) =+NodalCoord.val(2,where+1) * H.val(encount*3-1,2);
02379                   //  matpointCoord.val(3,where+1) =+NodalCoord.val(3,where+1) * H.val(encount*3-0,3);
02380                   matpointCoord.val(1,where+1) +=NodalCoord.val(1,encount) * H.val(encount*3-2,1);
02381                   //::printf("-- NO nodal, H_val :%d %+.2e %+.2e %+.5e\n", encount,NodalCoord.val(1,encount),H.val(encount*3-2,1),matpointCoord.val(1,where+1) );
02382                   matpointCoord.val(2,where+1) +=NodalCoord.val(2,encount) * H.val(encount*3-1,2);
02383                   matpointCoord.val(3,where+1) +=NodalCoord.val(3,encount) * H.val(encount*3-0,3);
02384 
02385          }
02386               
02387     fprintf(fp, "gauss point# %d   %+.6e %+.6e %+.6e \n", where+1, 
02388                                                           matpointCoord.val(1,where+1),
02389                                                           matpointCoord.val(2,where+1),
02390                                                           matpointCoord.val(3,where+1));
02391 
02392     //matpoint[where].reportTensor("");
02393 
02394     
02395               }
02396           }
02397       }
02398 
02399  }
02400 
02401 
02402 
02403 //=============================================================================
02404 int EightNodeBrick::getNumExternalNodes () const
02405 {
02406     return 8;  //changed from 4 to 8 Xiaoyan 07/06/00
02407 }
02408 
02409 
02410 //=============================================================================
02411 const ID& EightNodeBrick::getExternalNodes ()
02412 {
02413     return connectedExternalNodes;
02414 }
02415 
02416 Node ** 
02417 EightNodeBrick::getNodePtrs(void)
02418 {
02419   return theNodes;
02420 }
02421 
02422 //=============================================================================
02423 int EightNodeBrick::getNumDOF ()
02424 {
02425     return 24;       //Changed from 2*4=8 to 3*8=24 Xiaoyan 07/06/00
02426 }
02427 
02428 //=============================================================================
02429 void EightNodeBrick::setDomain (Domain *theDomain)
02430 {
02431     // Check Domain is not null - invoked when object removed from a domain
02432     if (theDomain == 0) {
02433   theNodes[0] = 0;
02434   theNodes[1] = 0;
02435   theNodes[2] = 0;
02436   theNodes[3] = 0;
02437   //Xiaoyan added 5-8  07/06/00
02438   theNodes[4] = 0;
02439   theNodes[5] = 0;
02440   theNodes[6] = 0;
02441   theNodes[7] = 0;
02442     }
02443     //Added if-else for found a bug when trying removeElement from theDomain  07-19-2001 Zhaohui
02444     else { 
02445       int Nd1 = connectedExternalNodes(0);
02446       int Nd2 = connectedExternalNodes(1);
02447       int Nd3 = connectedExternalNodes(2);
02448       int Nd4 = connectedExternalNodes(3);
02449       //Xiaoyan added 5-8  07/06/00
02450       
02451       int Nd5 = connectedExternalNodes(4);
02452       int Nd6 = connectedExternalNodes(5);
02453       int Nd7 = connectedExternalNodes(6);
02454       int Nd8 = connectedExternalNodes(7);
02455       
02456       theNodes[0] = theDomain->getNode(Nd1);
02457       theNodes[1] = theDomain->getNode(Nd2);
02458       theNodes[2] = theDomain->getNode(Nd3);
02459       theNodes[3] = theDomain->getNode(Nd4);
02460               
02461       //Xiaoyan added 5-8  07/06/00
02462       theNodes[4] = theDomain->getNode(Nd5);
02463       theNodes[5] = theDomain->getNode(Nd6);
02464       theNodes[6] = theDomain->getNode(Nd7);
02465       theNodes[7] = theDomain->getNode(Nd8);
02466       
02467       if (theNodes[0] == 0 || theNodes[1] == 0 || theNodes[2] == 0 || theNodes[3] == 0||
02468           theNodes[4] == 0 || theNodes[5] == 0 || theNodes[6] == 0 || theNodes[7] == 0 ) { 
02469         //Xiaoyan added 5-8  07/06/00
02470       
02471         opserr << "FATAL ERROR EightNodeBrick (tag: " << this->getTag() << "), node not found in domain\n";
02472         exit(-1);
02473       }
02474       
02475       int dofNd1 = theNodes[0]->getNumberDOF();
02476       int dofNd2 = theNodes[1]->getNumberDOF();
02477       int dofNd3 = theNodes[2]->getNumberDOF();
02478       int dofNd4 = theNodes[3]->getNumberDOF();
02479       
02480       //Xiaoyan added 5-8  07/06/00
02481       int dofNd5 = theNodes[4]->getNumberDOF();
02482       int dofNd6 = theNodes[5]->getNumberDOF();
02483       int dofNd7 = theNodes[6]->getNumberDOF();
02484       int dofNd8 = theNodes[7]->getNumberDOF();
02485                             
02486       if (dofNd1 != 3 || dofNd2 != 3 || dofNd3 != 3 || dofNd4 != 3 ||  // Changed 2 to 3 Xiaoyan
02487           dofNd5 != 3 || dofNd6 != 3 || dofNd7 != 3 || dofNd8 != 3 ) {
02488         opserr << "FATAL ERROR EightNodeBrick (tag: " << this->getTag() << "), has differing number of DOFs at its nodes\n";
02489   exit(-1);
02490       }
02491       this->DomainComponent::setDomain(theDomain);
02492     }   
02493 }
02494 
02495 //=============================================================================
02496 int EightNodeBrick::commitState ()
02497 {
02498     
02499 //BJ//BJ
02500 //BJ    opserr << "\n\n\n\n Print in int EightNodeBrick::commitState ()" <<endln; this->Print(opserr);
02501 //BJ//BJ
02502     
02503     int retVal = 0;
02504 
02505 
02506     // call element commitState to do any base class stuff
02507     if ((retVal = this->Element::commitState()) != 0) {
02508       opserr << "EightNodeBrick::commitState () - failed in base class";
02509     }    
02510 
02511     // int order = theQuadRule->getOrder();     // Commented by Xiaoyan
02512 
02513     int i;
02514     int plastify = 0;
02515     //int j, k;      // Xiaoyan added k for three dimension           
02516 
02517 
02518     // Loop over the integration points and commit the material states
02519     int count  = r_integration_order* s_integration_order * t_integration_order;
02520     //for (i = 0; i < r_integration_order; i++)        // Xiaoyan chaneged order to
02521     //  for (j = 0; j < s_integration_order; j++)      // r_integration_order,
02522     //                  // s_integration_order, and
02523     //      for (k = 0; k < t_integration_order; k++)      // added t_integration_order,
02524     //         retVal += (GaussPtheMaterial[i][j][k]).commitState();  
02525 
02526     Vector pp = getResistingForce();
02527 
02528     //if ( this->getTag() == 1 || this->getTag() == 700)
02529     //{
02530       for (i = 0; i < count; i++)
02531       //for (i = 0; i < 0; i++)
02532         {
02533           retVal += matpoint[i]->commitState();
02534           //if (i == 4 && strcmp(matpoint[i]->matmodel->getType(),"Template3Dep") == 0)
02535 //          stresstensor st;
02536 //            stresstensor prin; 
02537 //            straintensor stn;
02538 //            straintensor pl_stn;
02539 //            straintensor stnprin;
02540 //           
02541 //           //checking if element plastified
02542 //           pl_stn = matpoint[i]->getPlasticStrainTensor();
02543 //     
02544 //           double  p_plastc = pl_stn.p_hydrostatic();
02545 //           if (  fabs(p_plastc) > 0 ) 
02546 //             { 
02547 //               plastify = 1;
02548 //               break;
02549 //             }
02550 //     
02551 //           st = matpoint[i]->getStressTensor();
02552 //           prin = st.principal();
02553 //           stn = matpoint[i]->getStrainTensor();
02554 //           stnprin = stn.principal();
02555 //           
02556 //  //   opserr << "\nGauss Point: " << i << endln;
02557 //  //   opserr << "sigma11: "<< st.cval(1, 1) << " "<< st.cval(1, 2) << " " << st.cval(1, 3) << endln; 
02558 //  //   opserr << "sigma21: "<< st.cval(2, 1) << " "<< st.cval(2, 2) << " " << st.cval(2, 3) << endln; 
02559 //  //    opserr << "sigma31: "<< st.cval(3, 1) << " "<< st.cval(3, 2) << " " << st.cval(3, 3) << endln << endln; 
02560 //           
02561 //     //opserr << "strain11: "<< stn.cval(1, 1) << " "<< stn.cval(1, 2) << " " << stn.cval(1, 3) << endln; 
02562 //     //opserr << "strain21: "<< stn.cval(2, 1) << " "<< stn.cval(2, 2) << " " << stn.cval(2, 3) << endln; 
02563 //      //opserr << "strain31: "<< stn.cval(3, 1) << " "<< stn.cval(3, 2) << " " << stn.cval(3, 3) << endln; 
02564 //     
02565 //     //double  p = -1*( prin.cval(1, 1)+ prin.cval(2, 2) +prin.cval(3, 3) )/3.0;
02566 //     //double  ev = -1*( stnprin.cval(1, 1)+ stnprin.cval(2, 2) + stnprin.cval(3, 3) )/3.0;
02567 //     //opserr << "   " << p;
02568 //  
02569 //     //if (p < 0)
02570 //     //  opserr  << "gs pnt:" << i << "  p="<< p;
02571 //  
02572 //           
02573 //     double q;
02574 //     //if ( fabs(prin.cval(1, 1) - prin.cval(2, 2) ) <=  0.0001 )
02575 //           if ( fabs(prin.cval(1, 1) - prin.cval(2, 2) ) <=  0.001 )
02576 //           {
02577 //               q = prin.cval(1, 1) - prin.cval(3, 3);
02578 //               //opserr << "1 = 2"; 
02579 //           }
02580 //           else
02581 //               q = prin.cval(3, 3) - prin.cval(1, 1);
02582 //           
02583 //     //Triaxial compr.  fabs
02584 //           //opserr << "     " << st.cval(2, 3); //tau_yz
02585 //     //opserr << "     " << q;         
02586 //     ////----opserr << "     " << fabs(q);
02587 //  
02588 //           //opserr << "     " << ev << endln;
02589 //  
02590 //  //out22Jan2001   if (strcmp(matpoint[i]->matmodel->getType(),"Template3Dep") == 0)
02591 //  //out22Jan2001          {
02592 //  //out22Jan2001           st = ( ((Template3Dep *)(matpoint[i]->matmodel))->getEPS())->getStress();
02593 //  //out22Jan2001           prin = st.principal();
02594 //  //out22Jan2001    }
02595 //  //out22Jan2001    else
02596 //  //out22Jan2001    {
02597 //  //out22Jan2001            st = matpoint[i]->getStressTensor();
02598 //  //out22Jan2001           prin = st.principal();
02599 //  //out22Jan2001    
02600 //  //out22Jan2001    }
02601 //        
02602 //      //double  p = st.p_hydrostatic();
02603 //      //double  p = -1*( prin.cval(1, 1)+ prin.cval(2, 2) +prin.cval(3, 3) )/3.0;
02604 //            //opserr << "\n " << prin.cval(1, 1) << "   " << prin.cval(2, 2) << "  " <<  prin.cval(3, 3) << endln;
02605 //            //if ( getTag() == 960) 
02606 //            //opserr << " El= " << getTag() << " , p    " << p << endln;
02607 //            
02608 //      //printf(stderr, " Gauss Point i = %d ", (i+1));
02609 //      //printf(stderr, " Gauss Point i = %d ", (i+1));
02610 //      
02611 //  
02612 //            //if ( p < 0 ) 
02613 //      //{
02614 //      //  opserr << getTag();
02615 //      //  opserr << " ***p  =    " << p << endln;
02616 //      //}                     
02617 //            //J2D
02618 //            //opserr << "        " << st.q_deviatoric();
02619 //              
02620 //            //double q;    
02621 //            //if ( fabs(prin.cval(1, 1) - prin.cval(2, 2) ) <=  0.0001 )
02622 //            //{
02623 //            //    q = prin.cval(1, 1) - prin.cval(3, 3);
02624 //            //    //opserr << "1 = 2"; 
02625 //            //}
02626 //            //else
02627 //            //    q = prin.cval(3, 3) - prin.cval(1, 1);
02628 //        
02629 //            //Triaxial compr.
02630 //            //opserr << "        " << q;
02631          }
02632       //}
02633         
02634       //opserr << this->getTag() << " " << plastify << endln;
02635          
02636 
02637       //opserr << " at elements " << this->getTag() << endln;    
02638 
02639 
02640       //output nodal force
02641       //opserr << "    " << pp(2) << endln;    
02642     //} 
02643     return retVal;
02644 }
02645 
02646 //=============================================================================
02647 int EightNodeBrick::revertToLastCommit ()
02648 {
02649   //  int order = theQuadRule->getOrder();  // Commented by Xiaoyan
02650     int i;
02651     //int j, k;     // Xiaoyan added k for three dimension  
02652     int retVal = 0;
02653 
02654     // Loop over the integration points and revert to last committed material states
02655     int count  = r_integration_order* s_integration_order * t_integration_order;
02656     //for (i = 0; i < r_integration_order; i++)       // Xiaoyan chaneged order to 
02657     //  for (j = 0; j < s_integration_order; j++)     // r_integration_order,      
02658     //      for (k = 0; k < t_integration_order; k++)     // s_integration_order, and  
02659                        // added t_integration_order,
02660       //retVal += (theMaterial[i][j][k]).revertToLastCommit();
02661 
02662     for (i = 0; i < count; i++)      
02663        retVal += matpoint[i]->revertToLastCommit(); 
02664    
02665 
02666     return retVal;
02667 }
02668 
02669 //=============================================================================
02670 int EightNodeBrick::revertToStart () 
02671 {
02672     int i;     // Xiaoyan added k for three dimension  
02673     int retVal = 0;
02674 
02675     // Loop over the integration points and revert to last committed material states
02676     //for (i = 0; i < r_integration_order; i++)       // Xiaoyan chaneged order to 
02677     //  for (j = 0; j < s_integration_order; j++)     // r_integration_order,      
02678     //      for (k = 0; k < t_integration_order; k++)     // s_integration_order, and  
02679                  // added t_integration_order,
02680     //      retVal += (theMaterial[i][j][k]).revertToLastCommit();
02681 
02682     int count  = r_integration_order* s_integration_order * t_integration_order;
02683            
02684     for (i = 0; i < count; i++)
02685        retVal += matpoint[i]->revertToStart(); 
02686     
02687     
02688     return retVal;
02689 
02690     // Loop over the integration points and revert to initial material states
02691    } 
02692 
02693 
02694 //=============================================================================
02695 const Matrix &EightNodeBrick::getTangentStiff () 
02696 { 
02697 //BJ/BJ
02698 //BJ    opserr << "\n\n\n\n Print in const Matrix &EightNodeBrick::getTangentStiff ()" <<endln; this->Print(opserr);
02699 //BJ//BJ
02700 
02701 
02702 
02703      tensor stifftensor = getStiffnessTensor();
02704      int Ki=0;
02705      int Kj=0;
02706      
02707      for ( int i=1 ; i<=8 ; i++ )  
02708      {
02709         for ( int j=1 ; j<=8 ; j++ )  
02710         {
02711            for ( int k=1 ; k<=3 ; k++ )
02712            {
02713               for ( int l=1 ; l<=3 ; l++ )
02714               {
02715                  Ki = k+3*(i-1);
02716                  Kj = l+3*(j-1);
02717                  K( Ki-1 , Kj-1 ) = stifftensor.cval(i,k,l,j);
02718               }
02719            }
02720         }
02721      }
02722 
02723      //opserr << " K " << K << endln;
02724      //K.Output(opserr);
02725      return K;
02726 }
02727 
02728 //=============================================================================
02729 const Matrix &EightNodeBrick::getInitialStiff () 
02730 {
02731 //BJ//BJ
02732 //BJ    opserr << "\n\n\n\n Print in const Matrix &EightNodeBrick::getInitialStiff ()" <<endln; this->Print(opserr);
02733 //BJ//BJ
02734 
02735 
02736   if (Ki == 0)
02737     Ki = new Matrix(this->getTangentStiff());
02738 
02739   if (Ki == 0) {
02740     opserr << "FATAL fElement::getInitialStiff() -";
02741     opserr << "ran out of memory\n";
02742     exit(-1);
02743   }  
02744     
02745   return *Ki;
02746 }
02747 
02748 
02749 //=============================================================================
02750 //Get lumped mass
02751 //const Matrix &EightNodeBrick::getMass () 
02752 const Matrix &EightNodeBrick::getConsMass () 
02753 {
02754      tensor masstensor = getMassTensor();
02755      //int Ki=0;
02756      //int Kj=0;
02757      
02758      //double tot_mass = 0.0;
02759      //double diag_mass = 0.0;
02760      double column_mass;
02761 
02762      for ( int i=1 ; i<=24 ; i++ )  
02763      {
02764         column_mass = 0.0;
02765   for ( int j=1 ; j<=24 ; j++ )  
02766         {
02767            
02768      //M( i-1 , j-1 ) = masstensor.cval(i,j);
02769      
02770      column_mass += masstensor.cval(i,j);
02771      M( i-1 , j-1 ) = 0;
02772      //tot_mass += M( i-1 , j-1 );
02773      //if (i == j)
02774      //   diag_mass += M( i-1 , j-1 );
02775         }
02776   M( i-1 , i-1 ) = column_mass;
02777 
02778      }
02779 
02780      //opserr << " tot_mass= "<< tot_mass << " column_mass =" << column_mass << " diag_mass= " <<  diag_mass << endln;
02781      //opserr << "" << M.Output(opserr);
02782      //opserr << " M " << M;
02783      
02784      return M;
02785 }
02786 
02787 //=============================================================================
02788 //Get consistent mass
02789 //const Matrix &EightNodeBrick::getConsMass () 
02790 const Matrix &EightNodeBrick::getMass () 
02791 {
02792      tensor masstensor = getMassTensor();
02793      //int Ki=0;
02794      //int Kj=0;
02795      
02796      //double tot_mass = 0.0;
02797      //double diag_mass = 0.0;
02798      //double column_mass;
02799 
02800      for ( int i=1 ; i<=24 ; i++ )  
02801      {
02802         //column_mass = 0.0;
02803   for ( int j=1 ; j<=24 ; j++ )  
02804         {           
02805      M( i-1 , j-1 ) = masstensor.cval(i,j);
02806      
02807      //column_mass += masstensor.cval(i,j);
02808      //M( i-1 , j-1 ) = 0;
02809      //tot_mass += M( i-1 , j-1 );
02810      //if (i == j)
02811      //   diag_mass += M( i-1 , j-1 );
02812         }
02813   //M( i-1 , i-1 ) = column_mass;
02814 
02815      }
02816 
02817      //opserr << " tot_mass= "<< tot_mass << " column_mass =" << column_mass << " diag_mass= " <<  diag_mass << endln;
02818      //opserr << "" << M.Output(opserr);
02819      //opserr << " M " << M;
02820 
02821      return M;
02822 }
02823 
02824 //=============================================================================
02825 void EightNodeBrick::zeroLoad(void)
02826 {
02827      Q.Zero();
02828 }
02829 
02830 
02831 //=============================================================================
02832 int EightNodeBrick::addLoad(ElementalLoad *theLoad, double loadFactor)
02833 {  
02834 
02835 //BJ//BJ
02836 //BJ    opserr << "\n\n\n\n Print in int EightNodeBrick::addLoad(ElementalLoad *theLoad, double loadFactor)" <<endln; this->Print(opserr);
02837 //BJ//BJ
02838 
02839 
02840   //opserr << "EightNodeBrick::addLoad - load type unknown for ele with tag: %d\n",
02841   //        this->getTag());
02842   int type;
02843   const Vector &data = theLoad->getData(type, loadFactor);
02844   
02845   if (type == LOAD_TAG_BrickSelfWeight) {
02846   
02847     Vector bforce(24);  
02848     // Check for a quick return
02849     //opserr << "rho " << rho << endln;
02850     if (rho == 0.0)
02851       return 0;
02852   
02853     Vector ba(24), bfx(3);  
02854     bfx(0) = bf(0) * loadFactor;
02855     bfx(1) = bf(1) * loadFactor;
02856     bfx(2) = bf(2) * loadFactor;
02857   
02858     ba(0) =  bfx(0);
02859     ba(1) =  bfx(1);
02860     ba(2) =  bfx(2);
02861     ba(3) =  bfx(0);
02862     ba(4) =  bfx(1);
02863     ba(5) =  bfx(2);
02864     ba(6) =  bfx(0);
02865     ba(7) =  bfx(1);
02866     ba(8) =  bfx(2);
02867     ba(9) =  bfx(0);
02868     ba(10) = bfx(1);
02869     ba(11) = bfx(2);
02870     ba(12) = bfx(0);
02871     ba(13) = bfx(1);
02872     ba(14) = bfx(2);
02873     ba(15) = bfx(0);
02874     ba(16) = bfx(1);
02875     ba(17) = bfx(2);
02876     ba(18) = bfx(0);
02877     ba(19) = bfx(1);
02878     ba(20) = bfx(2);
02879     ba(21) = bfx(0);
02880     ba(22) = bfx(1);
02881     ba(23) = bfx(2);
02882   
02883     //Form equivalent body force
02884     this->getMass();
02885     bforce.addMatrixVector(0.0, M, ba, 1.0);
02886     Q.addVector(1.0, bforce, 1.0);       
02887   } else  {
02888     opserr << "EightNodeBrick::addLoad() - 8NodeBrick " << this->getTag() << ",load type " << type << "unknown\n";
02889     return -1;
02890   }
02891   return 0;
02892 }
02893 
02894 
02895 //=============================================================================
02896 int EightNodeBrick::addInertiaLoadToUnbalance(const Vector &accel)
02897 {
02898   // Check for a quick return
02899   if (rho == 0.0) 
02900     return 0;
02901 
02902   // Get R * accel from the nodes
02903   const Vector &Raccel1 = theNodes[0]->getRV(accel);
02904   const Vector &Raccel2 = theNodes[1]->getRV(accel);
02905   const Vector &Raccel3 = theNodes[2]->getRV(accel);
02906   const Vector &Raccel4 = theNodes[3]->getRV(accel);
02907         // Xiaoyan added the following four 09/27/00  
02908   const Vector &Raccel5 = theNodes[4]->getRV(accel);
02909   const Vector &Raccel6 = theNodes[5]->getRV(accel);
02910   const Vector &Raccel7 = theNodes[6]->getRV(accel);
02911   const Vector &Raccel8 = theNodes[7]->getRV(accel);
02912 
02913     if (3 != Raccel1.Size() || 3 != Raccel2.Size() || 3 != Raccel3.Size() ||
02914          3 != Raccel4.Size() || 3 != Raccel5.Size() || 3 != Raccel6.Size() || 
02915   3 != Raccel7.Size() || 3 != Raccel8.Size()  ){  
02916   // Xiaoyan changed 2 to 3 and added Racce15-18  09/27/00
02917       opserr << "EightNodeBrick::addInertiaLoadToUnbalance matrix and vector sizes are incompatable\n";
02918       return -1;
02919     }
02920 
02921   static Vector ra(24);  // Changed form 8 to 24(3*8)  Xiaoyan 09/27/00
02922 
02923   ra(0) =  Raccel1(0);
02924   ra(1) =  Raccel1(1);
02925   ra(2) =  Raccel1(2);
02926   ra(3) =  Raccel2(0);
02927   ra(4) =  Raccel2(1);
02928   ra(5) =  Raccel2(2);
02929   ra(6) =  Raccel3(0);
02930   ra(7) =  Raccel3(1);
02931   ra(8) =  Raccel3(2);
02932   ra(9) =  Raccel4(0);
02933   ra(10) = Raccel4(1);
02934   ra(11) = Raccel4(2);
02935       // Xiaoyan added the following 09/27/00
02936       ra(12) = Raccel5(0);
02937   ra(13) = Raccel5(1);
02938   ra(14) = Raccel5(2);
02939   ra(15) = Raccel6(0);
02940   ra(16) = Raccel6(1);
02941   ra(17) = Raccel6(2);
02942   ra(18) = Raccel7(0);
02943   ra(19) = Raccel7(1);
02944   ra(20) = Raccel7(2);
02945   ra(21) = Raccel8(0);
02946   ra(22) = Raccel8(1);
02947   ra(23) = Raccel8(2);
02948 
02949 
02950     // Want to add ( - fact * M R * accel ) to unbalance
02951     // Take advantage of lumped mass matrix
02952     // Mass matrix is computed in setDomain()
02953     
02954     //double column_mass = 0;
02955     //for (int i = 0; i < 24; i++)   
02956     //   column_mass += M(1,i);
02957     //column_mass = column_mass/3.0;
02958 
02959     //opserr << " addInerti... column_mass " << column_mass << endln;
02960 
02961     //for (int i = 0; i < 24; i++)   
02962     //    Q(i) += -M(i,i)*ra(i);
02963 
02964     Q.addMatrixVector(1.0, M, ra, -1.0);
02965     return 0;
02966 }
02967 
02968 //=============================================================================
02969 const Vector EightNodeBrick::FormEquiBodyForce(void)
02970 {
02971 
02972 //BJ//BJ
02973 //BJ    opserr << "\n\n\n\n Print in const Vector EightNodeBrick::FormEquiBodyForce(void)" <<endln; this->Print(opserr);
02974 //BJ//BJ
02975 
02976 
02977     Vector bforce(24);  
02978 
02979     // Check for a quick return
02980     //opserr << "rho " << rho << endln;
02981     if (rho == 0.0)
02982       return bforce;
02983 
02984     Vector ba(24);  
02985 
02986     ba(0) =  bf(0);
02987     ba(1) =  bf(1);
02988     ba(2) =  bf(2);
02989     ba(3) =  bf(0);
02990     ba(4) =  bf(1);
02991     ba(5) =  bf(2);
02992     ba(6) =  bf(0);
02993     ba(7) =  bf(1);
02994     ba(8) =  bf(2);
02995     ba(9) =  bf(0);
02996     ba(10) = bf(1);
02997     ba(11) = bf(2);
02998     ba(12) = bf(0);
02999     ba(13) = bf(1);
03000     ba(14) = bf(2);
03001     ba(15) = bf(0);
03002     ba(16) = bf(1);
03003     ba(17) = bf(2);
03004     ba(18) = bf(0);
03005     ba(19) = bf(1);
03006     ba(20) = bf(2);
03007     ba(21) = bf(0);
03008     ba(22) = bf(1);
03009     ba(23) = bf(2);
03010 
03011     //Form equivalent body force
03012     bforce.addMatrixVector(0.0, M, ba, 1.0);
03013     //opserr << " ba " << ba;
03014     //opserr << " M " << M;
03015     //if (getTag() == 886)
03016     //opserr << " @@@@@ FormEquiBodyForce  " << bforce;
03017     
03018     return bforce;
03019 
03020     
03021 }
03022 
03023 
03024 //=============================================================================
03025 const Vector &EightNodeBrick::getResistingForce () 
03026 {     
03027 //BJ//BJ
03028 //BJ    opserr << "\n\n\n\n Print in const Vector &EightNodeBrick::getResistingForce ()" <<endln; this->Print(opserr);
03029 //BJ//BJ
03030 
03031     int force_dim[] = {8,3}; 
03032     tensor nodalforces(2,force_dim,0.0);
03033      
03034     nodalforces = nodal_forces();
03035 
03036     //converting nodalforce tensor to vector
03037     for (int i = 0; i< 8; i++)
03038       for (int j = 0; j < 3; j++)
03039         P(i *3 + j) = nodalforces.cval(i+1, j+1);
03040 
03041     //opserr << "P" << P << '\n';
03042     //opserr << "Q" << Q << '\n';
03043 
03044     //P = P - Q;
03045     P.addVector(1.0, Q, -1.0);
03046 
03047     //opserr << "P-Q" << P;
03048     return P;
03049 }
03050 
03051 //=============================================================================
03052 const Vector &EightNodeBrick::getResistingForceIncInertia () 
03053 {
03054   // form resisting force
03055   this->getResistingForce();
03056   
03057   //
03058   // now add dynamic terms
03059   // P += M * a + C * v
03060   //
03061 
03062   if (rho != 0.0) {
03063 
03064     // form the mass matrix
03065     this->getMass();
03066 
03067     const Vector &accel1 = theNodes[0]->getTrialAccel();
03068     const Vector &accel2 = theNodes[1]->getTrialAccel();
03069     const Vector &accel3 = theNodes[2]->getTrialAccel();                         
03070     const Vector &accel4 = theNodes[3]->getTrialAccel();                         
03071     const Vector &accel5 = theNodes[4]->getTrialAccel();                         
03072     const Vector &accel6 = theNodes[5]->getTrialAccel();                         
03073     const Vector &accel7 = theNodes[6]->getTrialAccel();                         
03074     const Vector &accel8 = theNodes[7]->getTrialAccel();                         
03075 
03076     static Vector a(24);  // originally 8
03077 
03078     a(0) =  accel1(0);
03079     a(1) =  accel1(1);
03080     a(2) =  accel1(2);
03081     a(3) =  accel2(0);
03082     a(4) =  accel2(1);
03083     a(5) =  accel2(2);
03084     a(6) =  accel3(0);
03085     a(7) =  accel3(1);
03086     a(8) =  accel3(2);
03087     a(9) =  accel4(0);
03088     a(10) = accel4(1);
03089     a(11) = accel4(2);
03090     // Xiaoyn added the following 09/27/00
03091     a(12) = accel5(0);
03092     a(13) = accel5(1);
03093     a(14) = accel5(2);
03094     a(15) = accel6(0);
03095     a(16) = accel6(1);
03096     a(17) = accel6(2);
03097     a(18) = accel7(0);
03098     a(19) = accel7(1);
03099     a(20) = accel7(2);
03100     a(21) = accel8(0);
03101     a(22) = accel8(1);
03102     a(23) = accel8(2);
03103               
03104     // P += M * a
03105     P.addMatrixVector(1.0, M, a, 1.0);
03106     
03107     // add the damping forces if rayleigh damping
03108     if (alphaM != 0.0 || betaK != 0.0 || betaK0 != 0.0 || betaKc != 0.0)
03109       P += this->getRayleighDampingForces();
03110 
03111   } else {
03112 
03113     // add the damping forces if rayleigh damping
03114     if (betaK != 0.0 || betaK0 != 0.0 || betaKc != 0.0) 
03115       P += this->getRayleighDampingForces();
03116   }
03117 
03118   return P;
03119 
03120 } 
03121 
03122 //=============================================================================
03123 int EightNodeBrick::sendSelf (int commitTag, Channel &theChannel) 
03124 { 
03125      // Not implemtented yet
03126      return 0;
03127 }
03128 
03129 //=============================================================================
03130 int EightNodeBrick::recvSelf (int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker) 
03131 {   
03132      // Not implemtented yet
03133      return 0;
03134 }
03135 
03136 
03137 //=============================================================================
03138 int EightNodeBrick::displaySelf (Renderer &theViewer, int displayMode, float fact)
03139 {
03140     // first determine the end points of the quad based on
03141     // the display factor (a measure of the distorted image)
03142     // store this information in 4 3d vectors v1 through v4
03143     const Vector &end1Crd = theNodes[0]->getCrds();
03144     const Vector &end2Crd = theNodes[1]->getCrds();  
03145     const Vector &end3Crd = theNodes[2]->getCrds();  
03146     const Vector &end4Crd = theNodes[3]->getCrds();  
03147     const Vector &end5Crd = theNodes[4]->getCrds();
03148     const Vector &end6Crd = theNodes[5]->getCrds();  
03149     const Vector &end7Crd = theNodes[6]->getCrds();  
03150     const Vector &end8Crd = theNodes[7]->getCrds();  
03151 
03152     const Vector &end1Disp = theNodes[0]->getDisp();
03153     const Vector &end2Disp = theNodes[1]->getDisp();
03154     const Vector &end3Disp = theNodes[2]->getDisp();
03155     const Vector &end4Disp = theNodes[3]->getDisp();
03156     const Vector &end5Disp = theNodes[4]->getDisp();
03157     const Vector &end6Disp = theNodes[5]->getDisp();
03158     const Vector &end7Disp = theNodes[6]->getDisp();
03159     const Vector &end8Disp = theNodes[7]->getDisp();
03160 
03161     static Vector v1(3);
03162     static Vector v2(3);
03163     static Vector v3(3);
03164     static Vector v4(3);
03165     static Vector v5(3);
03166     static Vector v6(3);
03167     static Vector v7(3);
03168     static Vector v8(3);
03169 
03170     for (int i = 0; i < 2; i++)
03171     {
03172       v1(i) = end1Crd(i) + end1Disp(i)*fact;
03173       v2(i) = end2Crd(i) + end2Disp(i)*fact;    
03174       v3(i) = end3Crd(i) + end3Disp(i)*fact;    
03175       v4(i) = end4Crd(i) + end4Disp(i)*fact;    
03176       v5(i) = end5Crd(i) + end5Disp(i)*fact;
03177       v6(i) = end6Crd(i) + end6Disp(i)*fact;    
03178       v7(i) = end7Crd(i) + end7Disp(i)*fact;    
03179       v8(i) = end8Crd(i) + end8Disp(i)*fact;    
03180     }
03181     
03182     int error = 0;
03183     
03184     error += theViewer.drawLine (v1, v2, 1.0, 1.0);
03185     error += theViewer.drawLine (v2, v3, 1.0, 1.0);
03186     error += theViewer.drawLine (v3, v4, 1.0, 1.0);
03187     error += theViewer.drawLine (v4, v1, 1.0, 1.0);
03188 
03189     error += theViewer.drawLine (v5, v6, 1.0, 1.0);
03190     error += theViewer.drawLine (v6, v7, 1.0, 1.0);
03191     error += theViewer.drawLine (v7, v8, 1.0, 1.0);
03192     error += theViewer.drawLine (v8, v5, 1.0, 1.0);
03193 
03194     error += theViewer.drawLine (v1, v5, 1.0, 1.0);
03195     error += theViewer.drawLine (v2, v6, 1.0, 1.0);
03196     error += theViewer.drawLine (v3, v7, 1.0, 1.0);
03197     error += theViewer.drawLine (v4, v8, 1.0, 1.0);
03198 
03199     return error;
03200 
03201 }     
03202 
03203 //=============================================================================
03204 void EightNodeBrick::Print(OPS_Stream &s, int flag)
03205 {
03206   if (flag == 1) {
03207 
03208     s << "EightNodeBrick, element id:  " << this->getTag() << endln;
03209     s << "Connected external nodes:  " << connectedExternalNodes;
03210     s << this->getResistingForce();
03211 
03212   } else {
03213 
03214     //report(" EightNodeBrick ");
03215     s << "EightNodeBrick, element id:  " << this->getTag() << endln;
03216     s << "Connected external nodes:  " << connectedExternalNodes;
03217 
03218     int total_number_of_Gauss_points = r_integration_order*
03219                                        s_integration_order*
03220                                        t_integration_order;
03221     if ( total_number_of_Gauss_points != 0 )
03222       {
03223      theNodes[0]->Print(s);
03224      theNodes[1]->Print(s);
03225      theNodes[2]->Print(s);
03226      theNodes[3]->Print(s);
03227      theNodes[4]->Print(s);
03228      theNodes[5]->Print(s);
03229            theNodes[6]->Print(s);
03230      theNodes[7]->Print(s);
03231     }
03232     s << "Element mass density:  " << rho << endln << endln;
03233     s << "Material model:  " << endln;
03234 
03235     for( int GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
03236     {
03237       for( int GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
03238       {
03239         for( int GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
03240         {
03241            // this short routine is supposed to calculate position of
03242            // Gauss point from 3D array of short's
03243            short where =
03244            ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
03245 
03246            s << "\n insde Gauss-Legendre loop: where = " << where << endln;
03247            s << " GP_c_r= " << GP_c_r << "GP_c_s = " << GP_c_s << " GP_c_t = " << GP_c_t << endln;
03248            matpoint[where]->report("Material Point\n");
03249            //GPstress[where].reportshort("stress at Gauss Point");
03250            //GPstrain[where].reportshort("strain at Gauss Point");
03251            //matpoint[where].report("Material model  at Gauss Point");
03252         }
03253       }
03254     }   
03255   }
03256 }
03257 
03258 //=============================================================================
03259 Response * EightNodeBrick::setResponse (const char **argv, int argc, Information &eleInformation) 
03260 {
03261     //========================================================
03262     if (strcmp(argv[0],"force") == 0 || strcmp(argv[0],"forces") == 0)
03263     return new ElementResponse(this, 1, P);
03264     
03265     //========================================================
03266     else if (strcmp(argv[0],"stiff") == 0 || strcmp(argv[0],"stiffness") == 0)
03267         return new ElementResponse(this, 2, K);
03268 
03269     //========================================================
03270     else if (strcmp(argv[0],"plasticGPC") == 0 || strcmp(argv[0],"plastifiedGPC") == 0)
03271     {
03272        //checking if element plastified
03273        //int count  = r_integration_order* s_integration_order * t_integration_order;
03274        //straintensor pl_stn;
03275        //int plastify = 0;
03276        //
03277        //for (int i = 0; i < count; i++) {
03278        //  pl_stn = matpoint[i]->getPlasticStrainTensor();
03279        //   double  p_plastc = pl_stn.p_hydrostatic();
03280        //   
03281        //   if (  fabs(p_plastc) > 0 ) { 
03282        //      plastify = 1;
03283        //      break;
03284        //   }
03285        //}
03286   
03287        return new ElementResponse(this, 3, InfoP);
03288     } 
03289     //========================================================
03290     else if (strcmp(argv[0],"plastic") == 0 || strcmp(argv[0],"plastified") == 0)
03291     {  
03292        return new ElementResponse(this, 31, InfoP1);
03293     } 
03294     //========================================================
03295     else if (strcmp(argv[0],"stress") == 0 || strcmp(argv[0],"stresses") == 0)
03296     {
03297        return new ElementResponse(this, 4, InfoS);
03298     } 
03299     //========================================================
03300     else if (strcmp(argv[0],"pq") == 0 || strcmp(argv[0],"PQ") == 0)
03301     {
03302        return new ElementResponse(this, 41, InfoSpq);
03303     } 
03304     //Added 06-27-02 for p-q
03305     //========================================================
03306     else if (strcmp(argv[0],"stresspq") == 0 || strcmp(argv[0],"stressespq") == 0)
03307     {
03308        return new ElementResponse(this, 41, InfoSpq);
03309     } 
03310     //Added 07-22-02 for all p-q, e_v_pl, xi
03311     //========================================================
03312     else if (strcmp(argv[0],"pqall") == 0 )
03313     {
03314        return new ElementResponse(this, 42, InfoSpq_all);
03315     } 
03316 
03317     //========================================================
03318     else if (strcmp(argv[0],"gausspoint") == 0 || strcmp(argv[0],"GaussPoint") == 0)
03319     {
03320        return new ElementResponse(this, 5, Gsc8);
03321     } 
03322 
03323     //========================================================
03324     /*else if (strcmp(argv[0],"material") == 0 || strcmp(argv[0],"integrPoint") == 0) {
03325       int pointNum = atoi(argv[1]);
03326       if (pointNum > 0 && pointNum <= 4)
03327         return theMaterial[pointNum-1]->setResponse(&argv[2], argc-2, eleInfo); 
03328         else 
03329         return 0;
03330     }*/
03331  
03332     // otherwise response quantity is unknown for the quad class
03333     else
03334    return 0;
03335 }
03336 
03337 //=============================================================================
03338 int EightNodeBrick::getResponse (int responseID, Information &eleInfo)
03339 {
03340        switch (responseID) 
03341         {
03342       
03343        case 1:
03344          return eleInfo.setVector(this->getResistingForce());
03345       
03346        case 2:
03347          return eleInfo.setMatrix(this->getTangentStiff());
03348        case 3:
03349                {
03350     //checking if element plastified
03351                  int count  = r_integration_order* s_integration_order * t_integration_order;
03352     //opserr << count << endln;
03353                  //Vector Gsc(FixedOrder*FixedOrder*FixedOrder*3+1);  // 8*3 + count
03354     computeGaussPoint();
03355     //opserr << count << endln;
03356 
03357     //Vector Info(109); // count * 4 +1
03358     InfoP(0) = Gsc8(0); //Number of Gauss point
03359 
03360                  straintensor pl_stn;
03361                  
03362     int plastify;
03363                  for (int i = 0; i < count; i++) {
03364                    plastify = 0;
03365          InfoP(i*4+1) = Gsc8(i*3+1); //x
03366          InfoP(i*4+2) = Gsc8(i*3+2); //y
03367          InfoP(i*4+3) = Gsc8(i*3+3); //z
03368                    pl_stn = matpoint[i]->getPlasticStrainTensor();
03369                    //double  p_plastc = pl_stn.p_hydrostatic();
03370                    double  q_plastc = pl_stn.q_deviatoric();
03371                  
03372          InfoP(i*4+4) = q_plastc; //plastify; //Plastified?
03373 
03374                  }
03375        return eleInfo.setVector( InfoP );
03376     //return plastify;
03377      
03378         }
03379 
03380      case 4:
03381         {
03382                  int count = r_integration_order* s_integration_order * t_integration_order;
03383     int i;
03384                 stresstensor sts;
03385                  //Vector Gsc(81+1);  // 8*3 + count
03386     //Gsc = this->reportTensor("Gauss Point Coor.");
03387 
03388     //Vector Info(109 + 3 ); //Z values, x-disp. and corresponding avg. moment
03389     InfoS(0) = count;
03390         
03391                 for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
03392                 {
03393                     //r = get_Gauss_p_c( r_integration_order, GP_c_r );
03394                     for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
03395                     {
03396                         //s = get_Gauss_p_c( s_integration_order, GP_c_s );             
03397                         //rs = (GP_c_r-1)*s_integration_order+GP_c_s-1;
03398                         
03399       for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
03400                         {    
03401               //for (int i = 0; i < count; i++) 
03402                           i =
03403                              ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
03404 
03405                           sts = matpoint[i]->getStressTensor();
03406            InfoS(i*6+1) = sts.cval(1,1); //sigma_xx
03407            InfoS(i*6+2) = sts.cval(2,2); //sigma_yy
03408            InfoS(i*6+3) = sts.cval(3,3); //sigma_zz
03409            InfoS(i*6+4) = sts.cval(1,2); //Assign sigma_xy
03410            InfoS(i*6+5) = sts.cval(1,3); //Assign sigma_xz
03411            InfoS(i*6+6) = sts.cval(2,3); //Assign sigma_yz
03412             }
03413         }
03414     }
03415         return eleInfo.setVector( InfoS );
03416         }
03417      case 41:
03418         {
03419                  int count = r_integration_order* s_integration_order * t_integration_order;
03420     count = count / 2;
03421                 stresstensor sts;
03422                 sts = matpoint[count]->getStressTensor();
03423     InfoSpq(0) =sts.p_hydrostatic(); 
03424     InfoSpq(1) =sts.q_deviatoric(); 
03425         return eleInfo.setVector( InfoSpq );
03426         }
03427             case 42:
03428         {
03429                  int count = r_integration_order* s_integration_order * t_integration_order;
03430     int i;
03431                 stresstensor sts, principle;
03432 
03433     //InfoSpq_all(0) = count;
03434         
03435                 for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
03436                 {
03437                     //r = get_Gauss_p_c( r_integration_order, GP_c_r );
03438                     for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
03439                     {
03440                         //s = get_Gauss_p_c( s_integration_order, GP_c_s );             
03441                         //rs = (GP_c_r-1)*s_integration_order+GP_c_s-1;
03442                         
03443       for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
03444                         {    
03445               //for (int i = 0; i < count; i++) 
03446                           i =
03447                              ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
03448 
03449                           sts = matpoint[i]->getStressTensor();
03450               InfoSpq_all(i*2+0) =sts.p_hydrostatic(); 
03451               //deviatoric stress sqrt(J2/3)
03452         InfoSpq_all(i*2+1) =sts.q_deviatoric(); 
03453         //deviator stress +/-
03454         principle = sts.principal();
03455               //InfoSpq_all(i*2+1) =principle.val(1,1)-principle.val(3,3); 
03456                            
03457 //                           if (i == 7)  {
03458 //          InfoSpq_all(i*2+2) = principle.val(1,1); 
03459 //          //InfoSpq_all(i*2+3) = principle.val(2,2); 
03460 //          InfoSpq_all(i*2+3) = principle.val(3,3); 
03461 //         
03462 //          //Output volumetric strain for the eight Gauss point
03463 //          straintensor pl_stn;
03464 //          pl_stn = matpoint[i]->getPlasticStrainTensor();
03465 //          //pl_stn = matpoint[i]->getStrainTensor();
03466 //          InfoSpq_all(i*2+4) = pl_stn.Iinvariant1();
03467 //          double psi = matpoint[i]->getpsi();
03468 //          InfoSpq_all(i*2+5) = psi;
03469 //        }
03470             }
03471         }
03472     }
03473         return eleInfo.setVector( InfoSpq_all );
03474         }
03475      case 5:
03476      {
03477     this->computeGaussPoint();
03478        return eleInfo.setVector(Gsc8);
03479      }
03480      
03481      case 31:
03482                {
03483     // Output element plastic info 
03484                  int count  = r_integration_order* s_integration_order * t_integration_order;
03485 
03486     InfoP1(0) = count; //Number of Gauss point
03487 
03488                  straintensor pl_stn;
03489                  
03490                  for (int i = 0; i < count; i++) {
03491                    pl_stn = matpoint[i]->getPlasticStrainTensor();
03492                    //double  p_plastc = pl_stn.p_hydrostatic();
03493                    double  q_plastc = pl_stn.q_deviatoric();
03494                  
03495          InfoP1(i+1) = q_plastc; //plastify; //Plastified?
03496 
03497                  }
03498        return eleInfo.setVector( InfoP1 );
03499      
03500      }
03501      default: 
03502        return -1;
03503   }
03504      //return ;
03505 }
03506 
03507 
03508 
03509 
03510 //=============================================================================
03511 
03512 //const Matrix&
03513 //EightNodeBrick::getTangentStiff ()
03514 //{
03515 //  int order = theQuadRule->getOrder();
03516 //  const Vector &intPt = theQuadRule->getIntegrPointCoords();
03517 //  const Vector &intWt = theQuadRule->getIntegrPointWeights();
03518 //
03519 //  const Vector &disp1 = theNodes[0]->getTrialDisp();
03520 //        const Vector &disp2 = theNodes[1]->getTrialDisp();
03521 //  const Vector &disp3 = theNodes[2]->getTrialDisp();
03522 //        const Vector &disp4 = theNodes[3]->getTrialDisp();
03523 //       // Xiaoyan added 5-8 07/06/00
03524 //        const Vector &disp5 = theNodes[4]->getTrialDisp();
03525 //        const Vector &disp6 = theNodes[5]->getTrialDisp();
03526 //  const Vector &disp7 = theNodes[6]->getTrialDisp();
03527 //        const Vector &disp8 = theNodes[7]->getTrialDisp();
03528 //
03529 //  static Vector u(24);      //Changed from u(8) to u(24) Xiaoyn 07/06/00
03530 //
03531 //  u(0) = disp1(0);
03532 //  u(1) = disp1(1);
03533 //        u(2) = disp1(2);
03534 //  u(3) = disp2(0);
03535 //  u(4) = disp2(1);
03536 //  u(5) = disp2(2);
03537 //        u(6) = disp3(0);       
03538 //  u(7) = disp3(1);
03539 //  u(8) = disp3(2);
03540 //  u(9) = disp4(0);
03541 //  u(10) = disp4(1);
03542 //  u(11) = disp4(2);
03543 //  u(12) = disp5(0);
03544 //  u(13) = disp5(1);
03545 //  u(14) = disp5(2);
03546 //  u(15) = disp6(0);
03547 //  u(16) = disp6(1);
03548 //  u(17) = disp6(2);
03549 //  u(18) = disp7(0);
03550 //  u(19) = disp7(1);
03551 //  u(20) = disp7(2);
03552 //  u(21) = disp8(0);
03553 //  u(22) = disp8(1);
03554 //  u(23) = disp8(2);
03555 
03556 
03557 //  static Vector eps (6);      // Changed eps(3) to eps(6) Xiaoyan 07/06/00
03558 
03559 //  K.Zero();
03560 
03561 //  // Loop over the integration points
03562 //  for (int i = 0; i < order; i++)
03563 //  {
03564 //    for (int j = 0; j < order; j++)
03565 //    {
03566 //
03567 //      // Determine Jacobian for this integration point
03568 //      this->setJacobian (intPt(i), intPt(j));
03569 //
03570 //      // Interpolate strains
03571 //      this->formBMatrix (intPt(i), intPt(j));
03572 //      eps = B*u;
03573 //
03574 //      // Set the material strain
03575 //      (theMaterial[i][j])->setTrialStrain (eps);
03576 //
03577 //      // Get the material tangent
03578 //      const Matrix &D = (theMaterial[i][j])->getTangent();
03579 //
03580 //      // Form the Jacobian of the coordinate transformation
03581 //      double detJ = this->formDetJ (intPt(i), intPt(j));
03582 //
03583 //      // Perform numerical integration
03584 //      K = K + (B^ D * B) * intWt(i)*intWt(j) * detJ;
03585 //    }
03586 //  }
03587 //
03588 //  K = K * thickness;
03589 //
03590 //  return K;
03591 //}
03592 
03593 //const Matrix&
03594 //EightNodeBrick::getSecantStiff ()
03595 //{
03596 //  return K;
03597 //}
03598 
03599 //Commented by Xiaoyan     Use the form like Brick3d
03600 //const Matrix & EightNodeBrick::getDamp ()
03601 //{
03602 //  return C;
03603 //}
03604 // Commented by Xiaoyan 08/04/00
03605 
03606 //const Matrix&
03607 //EightNodeBrick::getMass ()
03608 //{
03609 //  int order = theQuadRule->getOrder();
03610 //  const Vector &intPt = theQuadRule->getIntegrPointCoords();
03611 //  const Vector &intWt = theQuadRule->getIntegrPointWeights();
03612 //
03613 //  M.Zero();
03614 //
03615 //  int i, j;
03616 //
03617 //  // Loop over the integration points
03618 //  for (i = 0; i < order; i++)
03619 //  {
03620 //    for (j = 0; j < order; j++)
03621 //    {
03622 //      // Determine Jacobian for this integration point
03623 //      this->setJacobian (intPt(i), intPt(j));
03624 //
03625 //      // Interpolate strains
03626 //      this->formNMatrix (intPt(i), intPt(j));
03627 //
03628 //      // Form the Jacobian of the coordinate transformation
03629 //      double detJ = this->formDetJ (intPt(i), intPt(j));
03630 //
03631 //      // Perform numerical integration
03632 //      M = M + (N^ N) * intWt(i)*intWt(j) * detJ;
03633 //    }
03634 //  }
03635 //
03636 //  M = M * thickness * rho;
03637 //
03638 //  // Lumped mass ... can be optional
03639 //  for (i = 0; i < 24; i++)       // Changed 8 to 24  Xiaoyan 07/06/00
03640 //  {
03641 //    double sum = 0.0;
03642 //    for (j = 0; j < 24; j++)    // Changed 8 to 24  Xiaoyan 07/06/00
03643 //    {          
03644 //      sum += M(i,j);
03645 //      M(i,j) = 0.0;
03646 //    }
03647 //    M(i,i) = sum;
03648 //  }
03649 //
03650 //  return M;
03651 //}
03652 //
03653 //const Vector&
03654 //EightNodeBrick::getResistingForce ()
03655 //{
03656 //  int order = theQuadRule->getOrder();
03657 //  const Vector &intPt = theQuadRule->getIntegrPointCoords();
03658 //  const Vector &intWt = theQuadRule->getIntegrPointWeights();
03659 //  
03660 //  const Vector &disp1 = theNodes[0]->getTrialDisp();
03661 //        const Vector &disp2 = theNodes[1]->getTrialDisp();
03662 //  const Vector &disp3 = theNodes[2]->getTrialDisp();
03663 //        const Vector &disp4 = theNodes[3]->getTrialDisp();
03664 //  //6-8 added by Xiaoyan 07/06/00
03665 //  const Vector &disp5 = theNodes[4]->getTrialDisp();
03666 //        const Vector &disp6 = theNodes[5]->getTrialDisp();
03667 //  const Vector &disp7 = theNodes[6]->getTrialDisp();
03668 //        const Vector &disp8 = theNodes[7]->getTrialDisp();
03669 //
03670 //
03671 //  static Vector u(24);      //Changed from u(8) to u(24) Xiaoyn 07/06/00
03672 //
03673 //  u(0) = disp1(0);
03674 //  u(1) = disp1(1);
03675 //        u(2) = disp1(2);
03676 //  u(3) = disp2(0);
03677 //  u(4) = disp2(1);
03678 //  u(5) = disp2(2);
03679 //        u(6) = disp3(0);       
03680 //  u(7) = disp3(1);
03681 //  u(8) = disp3(2);
03682 //  u(9) = disp4(0);
03683 //  u(10) = disp4(1);
03684 //  u(11) = disp4(2);
03685 //  u(12) = disp5(0);
03686 //  u(13) = disp5(1);
03687 //  u(14) = disp5(2);
03688 //  u(15) = disp6(0);
03689 //  u(16) = disp6(1);
03690 //  u(17) = disp6(2);
03691 //  u(18) = disp7(0);
03692 //  u(19) = disp7(1);
03693 //  u(20) = disp7(2);
03694 //  u(21) = disp8(0);
03695 //  u(22) = disp8(1);
03696 //  u(23) = disp8(2);
03697 //
03698 //  eps (6);      //Changed eps(3) to eps(6) Xiaoyan 07/06/00
03699 //
03700 //  P.Zero();
03701 //
03702 //  // Loop over the integration points
03703 //  for (int i = 0; i < order; i++)
03704 //  {
03705 //    for (int j = 0; j < order; j++)
03706 //    {
03707 //      // Determine Jacobian for this integration point
03708 //      this->setJacobian (intPt(i), intPt(j));
03709 //
03710 //      // Interpolate strains
03711 //      this->formBMatrix (intPt(i), intPt(j));
03712 //      eps = B*u;
03713 //
03714 //      // Set the material strain
03715 //      (theMaterial[i][j])->setTrialStrain (eps);
03716 //
03717 //      // Get material stress response
03718 //      const Vector &sigma = (theMaterial[i][j])->getStress();
03719 //
03720 //      // Form the Jacobian of the coordinate transformation
03721 //      double detJ = this->formDetJ (intPt(i), intPt(j));
03722 //
03723 //      // Perform numerical integration
03724 //      P = P + (B^ sigma) * intWt(i)*intWt(j) * detJ;
03725 //    }
03726 //  }
03727 //
03728 //  P = P * thickness * -1;
03729 //
03730 //  return P;
03731 //}
03732 //
03733 //const Vector&
03734 //EightNodeBrick::getResistingForceIncInertia ()
03735 //{
03736 //  // Yet to implement
03737 //  return P;
03738 //}
03739 //
03740 //
03741 //
03742 //void
03743 //EightNodeBrick::Print (OPS_Stream &s, int flag)
03744 //{
03745 //  s << "EightNodeBrick, element id:  " << this->getTag() << endln;
03746 //  s << "Connected external nodes:  " << connectedExternalNodes;
03747 //  s << "Material model:  " << theMaterial[0][0]->getType() << endln;
03748 //  s << "Element thickness:  " << thickness << endln;
03749 //  s << "Element mass density:  " << rho << endln << endln;
03750 //}
03751 //
03752 //
03753 //int
03754 //EightNodeBrick::displaySelf (Renderer &theViewer, int displayMode, float fact)
03755 //{
03756     // first determine the end points of the quad based on
03757     // the display factor (a measure of the distorted image)
03758     // store this information in 2 3d vectors v1 and v2
03759 //        const Vector &end1Crd = theNodes[0]->getCrds();
03760 //        const Vector &end2Crd = theNodes[1]->getCrds();  
03761 //  const Vector &end3Crd = theNodes[2]->getCrds();  
03762 //  const Vector &end4Crd = theNodes[3]->getCrds();  
03763 //  // 5-8 were added by Xiaoyan
03764 //        const Vector &end5Crd = theNodes[4]->getCrds();
03765 //        const Vector &end6Crd = theNodes[5]->getCrds();  
03766 //  const Vector &end7Crd = theNodes[6]->getCrds();  
03767 //  const Vector &end8Crd = theNodes[7]->getCrds();  
03769 //      const Vector &end1Disp = theNodes[0]->getDisp();
03770 //  const Vector &end2Disp = theNodes[1]->getDisp();
03771 //  const Vector &end3Disp = theNodes[2]->getDisp();
03772 //  const Vector &end4Disp = theNodes[3]->getDisp();
03773 //
03774   // 5-8 were added by Xiaoyan
03775 //        const Vector &end5Disp = theNodes[4]->getDisp();
03776 //  const Vector &end6Disp = theNodes[5]->getDisp();
03777 //  const Vector &end7Disp = theNodes[6]->getDisp();
03778 //  const Vector &end8Disp = theNodes[7]->getDisp();
03779 //
03780 //  Vector v1(3);
03781 //  Vector v2(3);
03782 //  Vector v3(3);
03783 //  Vector v4(3);
03784 //  //5-8 added by Xiaoyan 07/06/00
03785 //  Vector v5(3);
03786 //  Vector v6(3);
03787 //  Vector v7(3);
03788 //  Vector v8(3);
03789 //
03790 //  for (int i = 0; i < 3; i++)      //Changed from i<2 to i<3, Xiaonyan 07/06/00
03791 //  {
03792 //    v1(i) = end1Crd(i) + end1Disp(i)*fact;
03793 //    v2(i) = end2Crd(i) + end2Disp(i)*fact;    
03794 //    v3(i) = end3Crd(i) + end3Disp(i)*fact;    
03795 //    v4(i) = end4Crd(i) + end4Disp(i)*fact; 
03796 //  
03797 //    //5-8 added by Xiaoyan 07/06/00
03798 //       v5(i) = end5Crd(i) + end1Disp(i)*fact;
03799 //    v6(i) = end6Crd(i) + end2Disp(i)*fact;    
03800 //    v7(i) = end7Crd(i) + end3Disp(i)*fact;    
03801 //    v8(i) = end8Crd(i) + end4Disp(i)*fact;    
03802 //  }
03803 //  int error = 0;
03804 //  
03805 //  error += theViewer.drawLine (v1, v2, 1.0, 1.0);
03806 //  error += theViewer.drawLine (v2, v3, 1.0, 1.0);
03807 //  error += theViewer.drawLine (v3, v4, 1.0, 1.0);
03808 //  error += theViewer.drawLine (v4, v5, 1.0, 1.0);   // 5-8 added by Xiaoyan 07/06/00
03809 //  error += theViewer.drawLine (v5, v6, 1.0, 1.0);
03810 //  error += theViewer.drawLine (v6, v7, 1.0, 1.0);
03811 //  error += theViewer.drawLine (v7, v8, 1.0, 1.0);
03812 //  error += theViewer.drawLine (v8, v1, 1.0, 1.0);
03813 //
03814 //  return error;
03815 //}
03816 // The following are all commented by  Xiaoyan. We use the Brick3D to form these
03817 
03818 //
03819 //void
03820 //EightNodeBrick::formNMatrix (double r, double s,double t) 
03822 //{
03823 //  N.Zero();
03824 //
03829 //
03831 // The shape functions have been changed from N(2,8) to N(3,24)
03832 // I take the node order according to Bathe's book p344-345. Xiaoyan
03833 //        N(0,0)=N(1,1)=N(2,2)=1/8.*(1.0+r)*(1.0+s)*(1.0+t);
03834 //  N(0,3)=N(1,4)=N(2,5)=1/8.*(1.0-r)*(1.0+s)*(1.0+t);
03835 //  N(0,6)=N(1,7)=N(2,8)=1/8.*(1.0-r)*(1.0-s)*(1.0+t);
03836 //  N(0,9)=N(1,10)=N(2,11)=1/8.*(1.0+r)*(1.0-s)*(1.0+t);
03837 //  N(0,12)=N(1,13)=N(2,14)=1/8.*(1.0+r)*(1.0+s)*(1.0-t);
03838 //  N(0,15)=N(1,16)=N(2,17)=1/8.*(1.0-r)*(1.0+s)*(1.0-t);
03839 //  N(0,18)=N(1,19)=N(2,20)=1/8.*(1.0-r)*(1.0-s)*(1.0-t);
03840 //  N(0,21)=N(1,22)=N(2,23)=1/8.*(1.0+r)*(1.0-s)*(1.0-t);
03841 // }
03842 //void
03843 //EightNodeBrick::setJacobian (double r, double s, double t)
03845 //{
03846 //  const Vector &nd1Crds = theNodes[0]->getCrds();
03847 //  const Vector &nd2Crds = theNodes[1]->getCrds();
03848 //  const Vector &nd3Crds = theNodes[2]->getCrds();
03849 //  const Vector &nd4Crds = theNodes[3]->getCrds();
03850 //  // Xiaoyan added 5-8 07/06/00
03851 //  const Vector &nd5Crds = theNodes[4]->getCrds();
03852 //  const Vector &nd6Crds = theNodes[5]->getCrds();
03853 //  const Vector &nd7Crds = theNodes[6]->getCrds();
03854 //  const Vector &nd8Crds = theNodes[7]->getCrds();
03855 //
03859 //  J(0,1) = -nd1Crds(0)*(1.0-xi) - nd2Crds(0)*(1.0+xi) +
03860 //        nd3Crds(0)*(1.0+xi) + nd4Crds(0)*(1.0-xi);
03861 //
03862 //  J(1,0) = -nd1Crds(1)*(1.0-eta) + nd2Crds(1)*(1.0-eta) +
03863 //        nd3Crds(1)*(1.0+eta) - nd4Crds(1)*(1.0+eta);
03864 //
03865 //  J(1,1) = -nd1Crds(1)*(1.0-xi) - nd2Crds(1)*(1.0+xi) +
03866 //        nd3Crds(1)*(1.0+xi) + nd4Crds(1)*(1.0-xi);
03867 //      J = J * 0.25;
03868 //
03869 //  // For 3D problem Jacobi Matrix changed from J(2,2) to J(3,3)
03870 //  // Xiaoyan  changed 07/06/00
03871 //
03872 //
03873 //  J(0,0) = nd1Crds(0)*(1.0+s)*(1.0+t) - nd2Crds(0)*(1.0+s)*(1.0+t) -              
03874 //     nd3Crds(0)*(1.0-s)*(1.0+t) + nd4Crds(0)*(1.0-s)*(1.0+t) +
03875 //     nd5Crds(0)*(1.0+s)*(1.0-t) - nd6Crds(0)*(1.0+s)*(1.0-t) -              
03876 //     nd7Crds(0)*(1.0-s)*(1.0-t) + nd8Crds(0)*(1.0-s)*(1.0-t);
03877 //  
03878 //  J(0,1) = nd1Crds(1)*(1.0+s)*(1.0+t) - nd2Crds(1)*(1.0+s)*(1.0+t) -              
03879 //     nd3Crds(1)*(1.0-s)*(1.0+t) + nd4Crds(1)*(1.0-s)*(1.0+t) +
03880 //     nd5Crds(1)*(1.0+s)*(1.0-t) - nd6Crds(1)*(1.0+s)*(1.0-t) -              
03881 //     nd7Crds(1)*(1.0-s)*(1.0-t) + nd8Crds(1)*(1.0-s)*(1.0-t);
03882 //  
03883 //  J(0,2) = nd1Crds(2)*(1.0+s)*(1.0+t) - nd2Crds(2)*(1.0+s)*(1.0+t) -              
03884 //     nd3Crds(2)*(1.0-s)*(1.0+t) + nd4Crds(2)*(1.0-s)*(1.0+t) +
03885 //     nd5Crds(2)*(1.0+s)*(1.0-t) - nd6Crds(2)*(1.0+s)*(1.0-t) -              
03886 //     nd7Crds(2)*(1.0-s)*(1.0-t) + nd8Crds(2)*(1.0-s)*(1.0-t);
03887 //                       
03888 //  J(1,0) = nd1Crds(0)*(1.0+r)*(1.0+t) + nd2Crds(0)*(1.0-r)*(1.0+t) -              
03889 //     nd3Crds(0)*(1.0-r)*(1.0+t) - nd4Crds(0)*(1.0+r)*(1.0+t) +
03890 //     nd5Crds(0)*(1.0+r)*(1.0-t) + nd6Crds(0)*(1.0-r)*(1.0-t) -              
03891 //     nd7Crds(0)*(1.0-r)*(1.0-t) - nd8Crds(0)*(1.0+r)*(1.0-t);
03892 //                                                               
03893 //  J(1,1) = nd1Crds(1)*(1.0+r)*(1.0+t) + nd2Crds(1)*(1.0-r)*(1.0+t) -              
03894 //     nd3Crds(1)*(1.0-r)*(1.0+t) - nd4Crds(1)*(1.0+r)*(1.0+t) +
03895 //     nd5Crds(1)*(1.0+r)*(1.0-t) + nd6Crds(1)*(1.0-r)*(1.0-t) -              
03896 //     nd7Crds(1)*(1.0-r)*(1.0-t) - nd8Crds(1)*(1.0+r)*(1.0-t);
03897 //       
03898 //        J(1,2) = nd1Crds(2)*(1.0+r)*(1.0+t) + nd2Crds(2)*(1.0-r)*(1.0+t) -              
03899 //     nd3Crds(2)*(1.0-r)*(1.0+t) - nd4Crds(2)*(1.0+r)*(1.0+t) +
03900 //     nd5Crds(2)*(1.0+r)*(1.0-t) + nd6Crds(2)*(1.0-r)*(1.0-t) -              
03901 //     nd7Crds(2)*(1.0-r)*(1.0-t) - nd8Crds(2)*(1.0+r)*(1.0-t);
03902 //
03903 //  J(2,0) = nd1Crds(0)*(1.0+r)*(1.0+s) + nd2Crds(0)*(1.0-r)*(1.0+s) +              
03904 //     nd3Crds(0)*(1.0-r)*(1.0-s) + nd4Crds(0)*(1.0+r)*(1.0-s) -
03905 //     nd5Crds(0)*(1.0+r)*(1.0+s) - nd6Crds(0)*(1.0-r)*(1.0+s) -              
03906 //     nd7Crds(0)*(1.0-r)*(1.0-s) - nd8Crds(0)*(1.0+r)*(1.0-s);
03907 //     
03908 //  J(2,1) = nd1Crds(1)*(1.0+r)*(1.0+s) + nd2Crds(1)*(1.0-r)*(1.0+s) +              
03909 //     nd3Crds(1)*(1.0-r)*(1.0-s) + nd4Crds(1)*(1.0+r)*(1.0-s) -
03910 //     nd5Crds(1)*(1.0+r)*(1.0+s) - nd6Crds(1)*(1.0-r)*(1.0+s) -              
03911 //     nd7Crds(1)*(1.0-r)*(1.0-s) - nd8Crds(1)*(1.0+r)*(1.0-s);
03912 //
03913 //  J(2,2) = nd1Crds(2)*(1.0+r)*(1.0+s) + nd2Crds(2)*(1.0-r)*(1.0+s) +              
03914 //     nd3Crds(2)*(1.0-r)*(1.0-s) + nd4Crds(2)*(1.0+r)*(1.0-s) -
03915 //     nd5Crds(2)*(1.0+r)*(1.0+s) - nd6Crds(2)*(1.0-r)*(1.0+s) -              
03916 //     nd7Crds(2)*(1.0-r)*(1.0-s) - nd8Crds(2)*(1.0+r)*(1.0-s);
03917 //                    
03918 //   J=J*0.125
03919 //
03920 //    // L = inv(J)  Changed from L(2,2) to L(3,3)  07/07/00
03921 //
03922 //  L(0,0)=-J(1,2)*J(2,1) + J(1,1)*J(2,2);
03923 //  L(0.1)= J(0,2)*J(2,1) - J(0,1)*J(2,2);
03924 //  L(0,3)=-J(0,2)*J(1,1) + J(0,1)*J(1,2);
03925 //  L(1,0)= J(1,2)*J(2,0) - J(1,0)*J(2,2);
03926 //  L(1,1)=-J(0,2)*J(2,0) + J(0,0)*J(2.2);
03927 //  L(1,2)= J(0,2)*J(1,0) - J(0,0)*J(1,2);
03928 //  L(2,0)=-J(1,1)*J(2,0) + J(1,0)*J(2,1);
03929 //  L(2,1)= J(0,1)*J(2,0) - J(0,0)*J(2,1);
03930 //  L(2,2)=-J(0,1)*J(1,0) + J(0,0)*J(1,1);
03931 //  L=L/formDetJ(r,s,t)
03932 //      
03933 //  L(0,0) = J(1,1);
03934 //  L(1,0) = -J(0,1);
03935 //  L(0,1) = -J(1,0);
03936 //  L(1,1) = J(0,0);
03937 
03938 //  L = L / formDetJ (xi, eta);
03939 //}
03940 //
03941 //void
03942 //EightNodeBrick::formBMatrix (double r, double s, double t)
03944 //{
03945 //    B.Zero();
03946 //
03947 //    //Changed by Xiaoyan 07/06/00
03948 //    double L00 = L(0,0);
03949 //    double L01 = L(0,1);
03950 //    double L02 = L(0,1);
03951 //    double L10 = L(1,0);
03952 //    double L11 = L(1,1);
03953 //    double L12 = L(1,2);
03954 //    double L20 = L(2,0);
03955 //    double L21 = L(2,1);
03956 //    double L22 = L(2,2);
03957 //
03958 //    // See Cook, Malkus, Plesha p. 169 for the derivation of these terms
03959 //    B(0,0) = L00*-0.25*(1.0-eta) + L01*-0.25*(1.0-xi);    // N_1,1
03960 //    B(0,2) = L00*0.25*(1.0-eta) + L01*-0.25*(1.0+xi);    // N_2,1
03961 //    B(0,4) = L00*0.25*(1.0+eta) + L01*0.25*(1.0+xi);    // N_3,1
03962 //    B(0,6) = L00*-0.25*(1.0+eta) + L01*0.25*(1.0-xi);    // N_4,1
03963 //  
03964 //    B(1,1) = L10*-0.25*(1.0-eta) + L11*-0.25*(1.0-xi);    // N_1,2
03965 //    B(1,3) = L10*0.25*(1.0-eta) + L11*-0.25*(1.0+xi);    // N_2,2
03966 //    B(1,5) = L10*0.25*(1.0+eta) + L11*0.25*(1.0+xi);    // N_3,2
03967 //    B(1,7) = L10*-0.25*(1.0+eta) + L11*0.25*(1.0-xi);    // N_4,2
03968 //
03969 //    B(2,0) = B(1,1);
03970 //    B(2,1) = B(0,0);
03971 //    B(2,2) = B(1,3);
03972 //    B(2,3) = B(0,2);
03973 //    B(2,4) = B(1,5);
03974 //    B(2,5) = B(0,4);
03975 //    B(2,6) = B(1,7);
03976 //    B(2,7) = B(0,6);
03977 //}
03978 //
03979 //
03980 //
03983 //double  dh1dr=0.125*(1+s)*(1+t);
03984 //double  dh1ds=0.125*(1+r)*(1+t);
03985 //double  dh1dt=0.125*(1+r)*(1+s);
03986 //
03987 //double  dh2dr=-0.125*(1+s)*(1+t);
03988 //double  dh2ds=0.125*(1-r)*(1+t);
03989 //double  dh2dt=0.125*(1-r)*(1+s);
03990 //
03991 //double  dh3dr=-0.125*(1-s)*(1+t);
03992 //double  dh3ds=-0.125*(1-r)*(1+t);
03993 //double  dh3dt=0.125*(1-r)*(1-s);
03994 //
03995 //double  dh4dr=0.125*(1-s)*(1+t);
03996 //double  dh4ds=-0.125*(1+r)*(1+t);
03997 //double  dh4dt=0.125*(1+r)*(1-s);
03998 //
03999 //double  dh5dr=0.125*(1+s)*(1-t);
04000 //double  dh5ds=0.125*(1+r)*(1-t);
04001 //double  dh5dt=-0.125*(1+r)*(1+s);
04002 //
04003 //double  dh6dr=-0.125*(1+s)*(1-t);
04004 //double  dh6ds=0.125*(1-r)*(1-t);
04005 //double  dh6dt=-0.125*(1-r)*(1+s);
04006 //
04007 //double  dh7dr=-0.125*(1-s)*(1-t);
04008 //double  dh7ds=-0.125*(1-r)*(1-t);
04009 //double  dh7dt=-0.125*(1-r)*(1-s);
04010 //
04011 //double  dh8dr=0.125*(1-s)*(1-t);
04012 //double  dh8ds=-0.125*(1+r)*(1-t);
04013 //double  dh8dt=-0.125*(1+r)*(1-s);
04014 //
04016 //B(0,0)=L00*dh1dr+L01*dh1ds+L02*dh1dt;
04017 //B(0,3)=L00*dh2dr+L01*dh2ds+L02*dh2dt;
04018 //B(0,6)=L00*dh3dr+L01*dh3ds+L02*dh3dt;
04019 //B(0,9)=L00*dh4dr+L01*dh4ds+L02*dh4dt;
04020 //B(0,12)=L00*dh5dr+L01*dh5ds+L02*dh5dt;
04021 //B(0,15)=L00*dh6dr+L01*dh6ds+L02*dh6dt;
04022 //B(0,18)=L00*dh7dr+L01*dh7ds+L02*dh7dt;
04023 //B(0,21)=L00*dh8dr+L01*dh8ds+L02*dh8dt;
04024 //
04025 //B(1,1)=L10*dh1dr+L11*dh1ds+L12*dh1dt;
04026 //B(1,4)=L10*dh2dr+L11*dh2ds+L12*dh2dt;
04027 //B(1,7)=L10*dh3dr+L11*dh3ds+L12*dh3dt;
04028 //B(1,10)=L10*dh4dr+L11*dh4ds+L12*dh4dt;
04029 //B(1,13)=L10*dh5dr+L11*dh5ds+L12*dh5dt;
04030 //B(1,16)=L10*dh6dr+L11*dh6ds+L12*dh6dt;
04031 //B(1,19)=L10*dh7dr+L11*dh7ds+L12*dh7dt;
04032 //B(1,22)=L10*dh8dr+L11*dh8ds+L12*dh8dt;
04033 //
04034 //B(2,2)=L20d*h1dr+L21*dh1ds+L22*dh1dt;
04035 //B(2,5)=L20d*h2dr+L21*dh2ds+L22*dh2dt;
04036 //B(2,8)=L20d*h3dr+L21*dh3ds+L22*dh3dt;
04037 //B(2,11)=L20*dh4dr+L21*dh4ds+L22*dh4dt;
04038 //B(2,14)=L20*dh5dr+L21*dh5ds+L22*dh5dt;
04039 //B(2,17)=L20*dh6dr+L21*dh6ds+L22*dh6dt;
04040 //B(2,20)=L20*dh7dr+L21*dh7ds+L22*dh7dt;
04041 //B(2,23)=L20*dh8dr+L21*dh8ds+L22*dh8dt;
04042 //
04043 //B(3,0)=B(1,1);
04044 //B(3,1)=B(0,0);
04045 //B(3,3)=B(1,4);
04046 //B(3,4)=B(0,3);
04047 //B(3,6)=B(1,7);
04048 //B(3,7)=B(0,6);
04049 //B(3,9)=B(1,10);
04050 //B(3,10)=B(0,9);
04051 //B(3,12)=B(1,13);
04052 //B(3,13)=B(0,12);
04053 //B(3,15)=B(1,16);
04054 //B(3,16)=B(0,15);
04055 //B(3,18)=B(1,19);
04056 //B(3,19)=B(0,18);
04057 //B(3,21)=B(1,22);
04058 //B(3,22)=B(0,21);
04059 //
04060 //B(4,1)=B(2,2);
04061 //B(4,2)=B(1,1);
04062 //B(4,4)=B(2,5);
04063 //B(4,5)=B(1,4);
04064 //B(4,7)=B(2,8);
04065 //B(4,8)=B(1,7);
04066 //B(4,10)=B(2,11);
04067 //B(4,11)=B(1,10);
04068 //B(4,13)=B(2,14);
04069 //B(4,14)=B(1,13);
04070 //B(4,16)=B(2,17);
04071 //B(4,17)=B(1,16);
04072 //B(4,19)=B(2,20);
04073 //B(4,20)=B(1,19);
04074 //B(4,21)=B(2,23);
04075 //B(4,23)=B(1,22);
04076 //
04077 //B(5,0)=B(2,2);
04078 //B(5,2)=B(0,0);
04079 //B(5,3)=B(2,5);
04080 //B(5,5)=B(0,3);
04081 //B(5,6)=B(2,8);
04082 //B(5,8)=B(0,6);
04083 //B(5,9)=B(2,11);
04084 //B(5,11)=B(0,9);
04085 //B(5,12)=B(2,14);
04086 //B(5,14)=B(0,12);
04087 //B(5,15)=B(2,17);
04088 //B(5,17)=B(0,15);
04089 //B(5,18)=B(2,20);
04090 //B(5,20)=B(2,18);
04091 //B(5,21)=B(0,23);
04092 //B(5,23)=B(0,21);
04093 //
04094 //B(3,3)= L00*dh2dr+L01*dh2ds+L02*dh2dt;
04095 //B(3,6)= L00*dh3dr+L01*dh3ds+L02*dh3dt;
04096 //B(3,9)= L00*dh4dr+L01*dh4ds+L02*dh4dt;
04097 //B(3,12)=L00*dh5dr+L01*dh5ds+L02*dh5dt;
04098 //B(3,15)=L00*dh6dr+L01*dh6ds+L02*dh6dt;
04099 //B(3,18)=L00*dh7dr+L01*dh7ds+L02*dh7dt;
04100 //B(3,21)=L00*dh8dr+L01*dh8ds+L02*dh8dt;
04101 //double
04102 //EightNodeBrick::formDetJ (double r, double s, double t)
04103 //{
04104 //    return J(0,0)*J(1,1)*J(2,2)+J(1,0)*J(2,1)*J(0,2)+J(2,0)*J(0,1)*J(1,2)
04105 //         - J(2,0)*J(1,1)*J(0,2)-J(0,0)*J(2,1)*J(1,2)-J(0,1)*J(1,0)*J(2,2);
04106 //}
04107 
04108 
04109 double EightNodeBrick::get_Gauss_p_c(short order, short point_numb)
04110   {
04111 //  Abscissae coefficient of the Gaussian quadrature formula
04112 // starting from 1 not from 0
04113     static double Gauss_coordinates[7][7];
04114 
04115     Gauss_coordinates[1][1] = 0.0 ;
04116     Gauss_coordinates[2][1] = -0.577350269189626;
04117     Gauss_coordinates[2][2] = -Gauss_coordinates[2][1];
04118     Gauss_coordinates[3][1] = -0.774596669241483;
04119     Gauss_coordinates[3][2] = 0.0;
04120     Gauss_coordinates[3][3] = -Gauss_coordinates[3][1];
04121     Gauss_coordinates[4][1] = -0.861136311594053;
04122     Gauss_coordinates[4][2] = -0.339981043584856;
04123     Gauss_coordinates[4][3] = -Gauss_coordinates[4][2];
04124     Gauss_coordinates[4][4] = -Gauss_coordinates[4][1];
04125     Gauss_coordinates[5][1] = -0.906179845938664;
04126     Gauss_coordinates[5][2] = -0.538469310105683;
04127     Gauss_coordinates[5][3] = 0.0;
04128     Gauss_coordinates[5][4] = -Gauss_coordinates[5][2];
04129     Gauss_coordinates[5][5] = -Gauss_coordinates[5][1];
04130     Gauss_coordinates[6][1] = -0.932469514203152;
04131     Gauss_coordinates[6][2] = -0.661209386466265;
04132     Gauss_coordinates[6][3] = -0.238619186083197;
04133     Gauss_coordinates[6][4] = -Gauss_coordinates[6][3];
04134     Gauss_coordinates[6][5] = -Gauss_coordinates[6][2];
04135     Gauss_coordinates[6][6] = -Gauss_coordinates[6][1];
04136 
04137     return Gauss_coordinates[order][point_numb];
04138  }
04139 
04140 double EightNodeBrick::get_Gauss_p_w(short order, short point_numb)
04141   {
04142 //  Weight coefficient of the Gaussian quadrature formula
04143 // starting from 1 not from 0
04144     static double Gauss_weights[7][7]; // static data ??
04145 
04146     Gauss_weights[1][1] = 2.0;
04147     Gauss_weights[2][1] = 1.0;
04148     Gauss_weights[2][2] = 1.0;
04149     Gauss_weights[3][1] = 0.555555555555556;
04150     Gauss_weights[3][2] = 0.888888888888889;
04151     Gauss_weights[3][3] = Gauss_weights[3][1];
04152     Gauss_weights[4][1] = 0.347854845137454;
04153     Gauss_weights[4][2] = 0.652145154862546;
04154     Gauss_weights[4][3] = Gauss_weights[4][2];
04155     Gauss_weights[4][4] = Gauss_weights[4][1];
04156     Gauss_weights[5][1] = 0.236926885056189;
04157     Gauss_weights[5][2] = 0.478628670499366;
04158     Gauss_weights[5][3] = 0.568888888888889;
04159     Gauss_weights[5][4] = Gauss_weights[5][2];
04160     Gauss_weights[5][5] = Gauss_weights[5][1];
04161     Gauss_weights[6][1] = 0.171324492379170;
04162     Gauss_weights[6][2] = 0.360761573048139;
04163     Gauss_weights[6][3] = 0.467913934572691;
04164     Gauss_weights[6][4] = Gauss_weights[6][3];
04165     Gauss_weights[6][5] = Gauss_weights[6][2];
04166     Gauss_weights[6][6] = Gauss_weights[6][1];
04167 
04168     return Gauss_weights[order][point_numb];
04169   }
04170 
04171 
04172 int EightNodeBrick::update(void) //Note: Guanzhou finished the algorithm consistent with global incremental calculation Mar2005
04173   {
04174 
04175     double r  = 0.0;
04176     double s  = 0.0;
04177     double t  = 0.0;
04178 
04179     short where = 0;
04180 
04181     static int dh_dim[] = {8,3};
04182     tensor dh(2, dh_dim, 0.0);
04183 
04184     static int disp_dim[] = {8,3};
04185     //GZ out tensor incr_displacements(2,disp_dim,0.0);
04186 
04187     //GZ out straintensor incr_strain;
04188 
04189     tensor Jacobian;
04190     tensor JacobianINV;
04191     tensor dhGlobal;
04192 
04193     //Guanzhou out incr_displacements = incr_disp();//Get incrmental disp from domain
04194     
04195     tensor trial_disp(2,disp_dim,0.0);
04196     trial_disp = total_disp();//Guanzhou added, get trial disp from domain
04197     
04198     straintensor trial_strain;
04199     
04200     
04201     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
04202       {
04203         r = get_Gauss_p_c( r_integration_order, GP_c_r );
04204 
04205         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
04206           {
04207             s = get_Gauss_p_c( s_integration_order, GP_c_s );
04208 
04209             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
04210               {
04211                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
04212 
04213                 where =
04214                    ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
04215                 // derivatives of local coordiantes with respect to local coordiantes
04216                 dh = dh_drst_at(r,s,t);
04217                 // Jacobian tensor ( matrix )
04218                 Jacobian = Jacobian_3D(dh);
04219                 //....                Jacobian.print("J");
04220                 // Inverse of Jacobian tensor ( matrix )
04221                 JacobianINV = Jacobian_3Dinv(dh);
04222                 //....                JacobianINV.print("JINV");
04223                 // determinant of Jacobian tensor ( matrix )
04224                 //--                det_of_Jacobian  = Jacobian.determinant();
04225                 //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
04226                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
04227                 dhGlobal = dh("ij") * JacobianINV("kj");
04228                 // incrmental straines at this Gauss point
04229                 // now in Update we know the total displacements so let's find
04230                 // the total strain
04231                 trial_strain =
04232                     (dhGlobal("ib")*trial_disp("ia")).symmetrize11();
04233                 trial_strain.null_indices();
04234 
04235                 //Guanzhou out Mar2005 if ( ( (matpoint[where]->matmodel)->setTrialStrainIncr( incr_strain)) )
04236                 if ( ( (matpoint[where]->matmodel)->setTrialStrain(trial_strain)) )
04237                   opserr << "EightNodeBrick::update (tag: " << this->getTag() << "), Update Failed\n";
04238 
04239               }
04240           }
04241       }
04242 
04243       return 0;
04244       
04245   }
04246 
04247 #endif

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