Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

EightNodeBrick.cpp

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