TwentySevenNodeBrick.cpp

Go to the documentation of this file.
00001 
00002 //
00003 // COPYRIGHT (C):     :-))
00004 // PROJECT:           Object Oriented Finite Element Program
00005 // FILE:              TwentySevenNodeBrick.cpp
00006 // CLASS:             TwentySevenNodeBrick
00007 // MEMBER FUNCTIONS:
00008 //
00009 // MEMBER VARIABLES
00010 //
00011 // PURPOSE:           Finite Element Class
00012 // RETURN:
00013 // VERSION:
00014 // LANGUAGE:          C++
00015 // TARGET OS:         all
00016 // DESIGNER:          Boris Jeremic, Guanzhou Jie
00017 // PROGRAMMER:        Guanzhou Jie and Boris Jeremic
00018 // DATE:              Oct. 2003
00019 // UPDATE HISTORY:    May 2004 Guanzhou added update()
00020 //
00021 //
00022 //
00024 //
00025 
00026 #ifndef TWENTYSEVENNODEBRICK_CPP
00027 #define TWENTYSEVENNODEBRICK_CPP
00028 
00029 #include <NDMaterial.h>
00030 #include <Matrix.h>
00031 #include <Vector.h>
00032 #include <ID.h>
00033 #include <Renderer.h>
00034 #include <Domain.h>
00035 #include <string.h>
00036 #include <Information.h>
00037 #include <Channel.h>
00038 #include <FEM_ObjectBroker.h>
00039 #include <ElementResponse.h>
00040 
00041 #include <TwentySevenNodeBrick.h>
00042 #include <ElementalLoad.h>
00043 #define FixedOrder 3
00044 
00045 
00046 Matrix TwentySevenNodeBrick::K(81, 81);
00047 Matrix TwentySevenNodeBrick::C(81, 81);
00048 Matrix TwentySevenNodeBrick::M(81, 81);
00049 Vector TwentySevenNodeBrick::P(81);
00050 Vector InfoMoment(109+3);  //For computing moment
00051 Vector InfoPlastic(FixedOrder*FixedOrder*FixedOrder*4+1); //Plastic info
00052 Vector InfoStress(FixedOrder*FixedOrder*FixedOrder*6+1); //Stress info
00053 Vector GaussCoord(FixedOrder*FixedOrder*FixedOrder*3+1); //Gauss point coordinates
00054 Vector Info_pq2(2); //p and q of count/2
00055 //====================================================================
00056 // Constructor
00057 //====================================================================
00058 
00059 TwentySevenNodeBrick::TwentySevenNodeBrick(int element_number,
00060                                int node_numb_1,  int node_numb_2,  int node_numb_3,  int node_numb_4,
00061                                int node_numb_5,  int node_numb_6,  int node_numb_7,  int node_numb_8,
00062                                int node_numb_9,  int node_numb_10, int node_numb_11, int node_numb_12,
00063                                int node_numb_13, int node_numb_14, int node_numb_15, int node_numb_16,
00064                                int node_numb_17, int node_numb_18, int node_numb_19, int node_numb_20,
00065                                int node_numb_21,  int node_numb_22,  int node_numb_23,  int node_numb_24,
00066                                int node_numb_25,  int node_numb_26,  int node_numb_27,
00067                                NDMaterial * Globalmmodel, double b1, double b2,double b3,
00068              double r, double p)
00069 
00070   :Element(element_number, ELE_TAG_TwentySevenNodeBrick ),
00071   connectedExternalNodes(27), Ki(0), Q(81), bf(3),
00072   rho(r), pressure(p)
00073   {
00074     //elem_numb = element_number;
00075     bf(0) = b1;
00076     bf(1) = b2;
00077     bf(2) = b3;
00078 
00079     determinant_of_Jacobian = 0.0;
00080 
00081     //r_integration_order = r_int_order;
00082     //s_integration_order = s_int_order;
00083     //t_integration_order = t_int_order;
00084     r_integration_order = FixedOrder; // Gauss-Legendre integration order in r direction
00085     s_integration_order = FixedOrder; // Gauss-Legendre integration order in s direction
00086     t_integration_order = FixedOrder; // Gauss-Legendre integration order in t direction
00087 
00088     //Not needed. Right now we have one NDMaterial for each material point
00089     //mmodel = Globalmmodel->getCopy( type ); // One global mat model
00090 
00091     int total_number_of_Gauss_points = r_integration_order*s_integration_order*t_integration_order;
00092 
00093 
00094     if ( total_number_of_Gauss_points != 0 )
00095       {
00096          matpoint  = new MatPoint3D * [total_number_of_Gauss_points];
00097       }
00098     else
00099       {
00100         matpoint  = 0;
00101       }
00103     short where = 0;
00104 
00105     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
00106       {
00107         double r = get_Gauss_p_c( r_integration_order, GP_c_r );
00108         double rw = get_Gauss_p_w( r_integration_order, GP_c_r );
00109 
00110         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
00111           {
00112             double s = get_Gauss_p_c( s_integration_order, GP_c_s );
00113             double sw = get_Gauss_p_w( s_integration_order, GP_c_s );
00114 
00115             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
00116               {
00117                 double t = get_Gauss_p_c( t_integration_order, GP_c_t );
00118                 double tw = get_Gauss_p_w( t_integration_order, GP_c_t );
00119 
00120                 // this short routine is supposed to calculate position of
00121                 // Gauss point from 3D array of short's
00122                 where =
00123                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
00124 
00125                 //DB::printf("\n\nBefore Initialization **************** where = %d \n",where);
00126                 //DB::printf("GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
00127                 //DB            GP_c_r,GP_c_s,GP_c_t);
00128                 //DB
00129                 //DBGPstress[where].reportshort("stress within before Initialization");
00130                 //DBGPstrain[where].reportshort("strain within before Initialization");
00131                 //DB
00132                 //DB// I suspect that [] should be overloaded so that compiler knows which
00133                 //DB// material model is returning a pointer and fot the purpose
00134                 //DB//matpoint[where].report("mmodel within before Initialization");
00135                 //DB//matpoint[where].report("mmodel within before Initialization"); // operator[] overloaded
00136                 //DB(matpoint)->operator[](where).report("mmodel within before Initialization"); // operator[] overloaded
00137                 //DB                                                               // for NDMaterial and
00138                 //DB                                                               // derived types!
00139 
00140                   matpoint[where] = new MatPoint3D(GP_c_r,
00141                                                  GP_c_s,
00142                                                  GP_c_t,
00143                                                  r, s, t,
00144                                                  rw, sw, tw,
00145                                                //InitEPS,
00146                                                       Globalmmodel);
00147            //NMD);
00148            //&( GPstress[where] ), //&( GPiterative_stress[where] ), //IN_q_ast_iterative[where] ,//&( GPstrain[where] ),  //&( GPtangent_E[where] ),
00149                                          //&( (matpoint)->operator[](where) )
00150                                          // ugly syntax but it works! Still don't know what's wrong   // with the old style matpoint[where]
00151               }
00152           }
00153       }
00154 
00155       // Set connected external node IDs
00156       connectedExternalNodes( 0) = node_numb_1;
00157       connectedExternalNodes( 1) = node_numb_2;
00158       connectedExternalNodes( 2) = node_numb_3;
00159       connectedExternalNodes( 3) = node_numb_4;
00160       connectedExternalNodes( 4) = node_numb_5;
00161       connectedExternalNodes( 5) = node_numb_6;
00162       connectedExternalNodes( 6) = node_numb_7;
00163       connectedExternalNodes( 7) = node_numb_8;
00164 
00165       connectedExternalNodes( 8) = node_numb_9;
00166       connectedExternalNodes( 9) = node_numb_10;
00167       connectedExternalNodes(10) = node_numb_11;
00168       connectedExternalNodes(11) = node_numb_12;
00169 
00170       connectedExternalNodes(12) = node_numb_13;
00171       connectedExternalNodes(13) = node_numb_14;
00172       connectedExternalNodes(14) = node_numb_15;
00173       connectedExternalNodes(15) = node_numb_16;
00174 
00175       connectedExternalNodes(16) = node_numb_17;
00176       connectedExternalNodes(17) = node_numb_18;
00177       connectedExternalNodes(18) = node_numb_19;
00178       connectedExternalNodes(19) = node_numb_20;
00179 
00180       connectedExternalNodes(20) = node_numb_21;
00181       connectedExternalNodes(21) = node_numb_22;
00182       connectedExternalNodes(22) = node_numb_23;
00183       connectedExternalNodes(23) = node_numb_24;
00184       connectedExternalNodes(24) = node_numb_25;
00185       connectedExternalNodes(25) = node_numb_26;
00186       connectedExternalNodes(26) = node_numb_27;
00187 
00188       for (int i=0; i<27; i++)
00189   theNodes[i] = 0;
00190 
00191       nodes_in_brick = 27;
00192 
00193 }
00194 
00195 //====================================================================
00196 TwentySevenNodeBrick::TwentySevenNodeBrick ():Element(0, ELE_TAG_TwentySevenNodeBrick ),
00197 connectedExternalNodes(27), Ki(0), Q(81), bf(3), rho(0.0), pressure(0.0), mmodel(0)
00198 {
00199      matpoint = 0;
00200 
00201      for (int i=0; i<27; i++)
00202        theNodes[i] = 0;
00203 }
00204 
00205 
00206 //#############################################################################
00207 
00208 
00211 TwentySevenNodeBrick::~TwentySevenNodeBrick ()
00212 {
00213 
00214     int total_number_of_Gauss_points = r_integration_order*s_integration_order*t_integration_order;
00215 
00216     for (int i = 0; i < total_number_of_Gauss_points; i++)
00217     {
00218   // Delete the NDMaterials at each integration point
00219   if (matpoint[i])
00220      delete matpoint[i];
00221     }
00222 
00223     // Delete the array of pointers to NDMaterial pointer arrays
00224     if (matpoint)
00225       delete [] matpoint;
00226 
00227     if (Ki != 0)
00228       delete Ki;
00229 
00230 }
00231 
00235 void TwentySevenNodeBrick::incremental_Update()
00236   {
00237     double r  = 0.0;
00238     // double rw = 0.0;
00239     double s  = 0.0;
00240     // double sw = 0.0;
00241     double t  = 0.0;
00242     // double tw = 0.0;
00243 
00244     short where = 0;
00245     //,,,,,    double weight = 0.0;
00246 
00247     //double this_one_PP = (matpoint)->operator[](where).IS_Perfect_Plastic();
00248 
00249     int dh_dim[] = {27,3};
00250     tensor dh(2, dh_dim, 0.0);
00251 
00252 
00253     static int disp_dim[] = {27,3};
00254     tensor incremental_displacements(2,disp_dim,0.0);
00255 
00256     straintensor incremental_strain;
00257 
00258     tensor Jacobian;
00259     tensor JacobianINV;
00260     tensor dhGlobal;
00261 
00262     incremental_displacements = incr_disp();
00263 
00264     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
00265       {
00266         r = get_Gauss_p_c( r_integration_order, GP_c_r );
00267         //--        rw = get_Gauss_p_w( r_integration_order, GP_c_r );
00268         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
00269           {
00270             s = get_Gauss_p_c( s_integration_order, GP_c_s );
00271             //--            sw = get_Gauss_p_w( s_integration_order, GP_c_s );
00272             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
00273             {
00274                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
00275                 //--                tw = get_Gauss_p_w( t_integration_order, GP_c_t );
00276                 // this short routine is supposed to calculate position of
00277                 // Gauss point from 3D array of short's
00278                 where =
00279                    ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
00280                 // derivatives of local coordiantes with respect to local coordiantes
00281                 dh = dh_drst_at(r,s,t);
00282                 // Jacobian tensor ( matrix )
00283                 Jacobian = Jacobian_3D(dh);
00284                 //....                Jacobian.print("J");
00285                 // Inverse of Jacobian tensor ( matrix )
00286                 JacobianINV = Jacobian_3Dinv(dh);
00287                 //....                JacobianINV.print("JINV");
00288                 // determinant of Jacobian tensor ( matrix )
00289                 //--                det_of_Jacobian  = Jacobian.determinant();
00290                 //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
00291                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
00292                 //dhGlobal = dh("ij") * JacobianINV("jk"); // Zhaohui 09-02-2001
00293                 dhGlobal = dh("ij") * JacobianINV("kj");
00294                 //....                dhGlobal.print("dh","dhGlobal");
00295                 //weight
00296                 //                weight = rw * sw * tw * det_of_Jacobian;
00297                 //::::::   ::printf("\n\nIN THE STIFFNESS TENSOR INTEGRATOR ----**************** where = %d \n", where);
00298                 //::::::   ::printf(" void TwentySevenNodeBrick::incremental_Update()\n");
00299                 //::::::   ::printf(" GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d    --->>>  where = %d \n",
00300                 //::::::                      GP_c_r,GP_c_s,GP_c_t,where);
00301                 //::::::   ::printf("WEIGHT = %f", weight);
00302                 //::::::   ::printf("determinant of Jacobian = %f", determinant_of_Jacobian);
00303                 //::::::   matpoint[where].report("Gauss Point\n");
00304                 // incremental straines at this Gauss point
00305                 // now in Update we know the incremental displacements so let's find
00306                 // the incremental strain
00307                 incremental_strain =
00308                     (dhGlobal("ib")*incremental_displacements("ia")).symmetrize11();
00309                 incremental_strain.null_indices();
00310                 //incremental_strain.reportshort("\n incremental_strain tensor at GAUSS point\n");
00311 
00312                 // here comes the final_stress calculation actually on only needs to copy stresses
00313                 // from the iterative data . . .
00314                 //(GPstress+where)->reportshortpqtheta("\n stress START GAUSS \n");
00315 
00316     if ( ! ( (matpoint[where]->matmodel)->setTrialStrainIncr( incremental_strain)) )
00317       opserr << "TwentySevenNodeBrick::incremental_Update (tag: " << this->getTag() << "), not converged\n";
00318     //matpoint[where].setEPS( mmodel->getEPS() );
00319             }
00320           }
00321       }
00322   }
00323 
00324 
00325 //#############################################################################
00326 //#############################################################################
00327 //***************************************************************
00328 tensor TwentySevenNodeBrick::H_3D(double r1, double r2, double r3)
00329   {
00330 
00331     int dimension[] = {81,3};
00332 
00333     tensor H(2, dimension, 0.0);
00334 
00335     //Shape Functions of Node 1 Along Three Coordinate Directions
00336     H.val(1,1)=0.5*r1*(r1+1.0)*0.5*r2*(r2+1.0)*0.5*r3*(r3+1.0);
00337     H.val(2,2)=H.val(1,1);
00338     H.val(3,3)=H.val(1,1);
00339 
00340     //Shape Functions of Node 2 Along Three Coordinate Directions
00341     H.val(4,1)=0.5*r1*(r1-1.0)*0.5*r2*(r2+1.0)*0.5*r3*(r3+1.0);
00342     H.val(5,2)=H.val(4,1);
00343     H.val(6,3)=H.val(4,1);
00344 
00345     //Shape Functions of Node 3 Along Three Coordinate Directions
00346     H.val(7,1)=0.5*r1*(r1-1.0)*0.5*r2*(r2-1.0)*0.5*r3*(r3+1.0);
00347     H.val(8,2)=H.val(7,1);
00348     H.val(9,3)=H.val(7,1);
00349 
00350     //Shape Functions of Node 4 Along Three Coordinate Directions
00351     H.val(10,1)=0.5*r1*(r1+1.0)*0.5*r2*(r2-1.0)*0.5*r3*(r3+1.0);
00352     H.val(11,2)=H.val(10,1);
00353     H.val(12,3)=H.val(10,1);
00354 
00355     //Shape Functions of Node 5 Along Three Coordinate Directions
00356     H.val(13,1)=0.5*r1*(r1+1.0)*0.5*r2*(r2+1.0)*0.5*r3*(r3-1.0);
00357     H.val(14,2)=H.val(13,1);
00358     H.val(15,3)=H.val(13,1);
00359 
00360     //Shape Functions of Node 6 Along Three Coordinate Directions
00361     H.val(16,1)=0.5*r1*(r1-1.0)*0.5*r2*(r2+1.0)*0.5*r3*(r3-1.0);
00362     H.val(17,2)=H.val(16,1);
00363     H.val(18,3)=H.val(16,1);
00364 
00365     //Shape Functions of Node 7 Along Three Coordinate Directions
00366     H.val(19,1)=0.5*r1*(r1-1.0)*0.5*r2*(r2-1.0)*0.5*r3*(r3-1.0);
00367     H.val(20,2)=H.val(19,1);
00368     H.val(21,3)=H.val(19,1);
00369 
00370 
00371     //Shape Functions of Node 8 Along Three Coordinate Directions
00372     H.val(22,1)=0.5*r1*(r1+1.0)*0.5*r2*(r2-1.0)*0.5*r3*(r3-1.0);
00373     H.val(23,2)=H.val(22,1);
00374     H.val(24,3)=H.val(22,1);
00375 
00376 
00377     //Shape Functions of Node 9 Along Three Coordinate Directions
00378     H.val(25,1)=0.5*r1*(r1+1.0)*0.5*r2*(r2+1.0)*(1.0-r3*r3);
00379     H.val(26,2)=H.val(25,1);
00380     H.val(27,3)=H.val(25,1);
00381 
00382 
00383     //Shape Functions of Node 10Along Three Coordinate Directions
00384     H.val(28,1)=0.5*r1*(r1-1.0)*0.5*r2*(r2+1.0)*(1.0-r3*r3);
00385     H.val(29,2)=H.val(28,1);
00386     H.val(30,3)=H.val(28,1);
00387 
00388 
00389     //Shape Functions of Node 11Along Three Coordinate Directions
00390     H.val(31,1)=0.5*r1*(r1-1.0)*0.5*r2*(r2-1.0)*(1.0-r3*r3);
00391     H.val(32,2)=H.val(31,1);
00392     H.val(33,3)=H.val(31,1);
00393 
00394 
00395     //Shape Functions of Node 12Along Three Coordinate Directions
00396     H.val(34,1)=0.5*r1*(r1+1.0)*0.5*r2*(r2-1.0)*(1.0-r3*r3);
00397     H.val(35,2)=H.val(34,1);
00398     H.val(36,3)=H.val(34,1);
00399 
00400 
00401     //Shape Functions of Node 13Along Three Coordinate Directions
00402     H.val(37,1)=(1.0-r1*r1)*0.5*r2*(r2+1.0)*0.5*r3*(r3+1.0);
00403     H.val(38,2)=H.val(37,1);
00404     H.val(39,3)=H.val(37,1);
00405 
00406 
00407     //Shape Functions of Node 14Along Three Coordinate Directions
00408     H.val(40,1)=0.5*r1*(r1-1.0)*(1.0-r2*r2)*0.5*r3*(r3+1.0);
00409     H.val(41,2)=H.val(40,1);
00410     H.val(42,3)=H.val(40,1);
00411 
00412 
00413     //Shape Functions of Node 15Along Three Coordinate Directions
00414     H.val(43,1)=(1.0-r1*r1)*0.5*r2*(r2-1.0)*0.5*r3*(r3+1.0);
00415     H.val(44,2)=H.val(43,1);
00416     H.val(45,3)=H.val(43,1);
00417 
00418 
00419     //Shape Functions of Node 16Along Three Coordinate Directions
00420     H.val(46,1)=0.5*r1*(r1+1.0)*(1.0-r2*r2)*0.5*r3*(r3+1.0);
00421     H.val(47,2)=H.val(46,1);
00422     H.val(48,3)=H.val(46,1);
00423 
00424 
00425     //Shape Functions of Node 17Along Three Coordinate Directions
00426     H.val(49,1)=(1.0-r1*r1)*0.5*r2*(r2+1.0)*0.5*r3*(r3-1.0);
00427     H.val(50,2)=H.val(49,1);
00428     H.val(51,3)=H.val(49,1);
00429 
00430 
00431     //Shape Functions of Node 18Along Three Coordinate Directions
00432     H.val(52,1)=0.5*r1*(r1-1.0)*(1.0-r2*r2)*0.5*r3*(r3-1.0);
00433     H.val(53,2)=H.val(52,1);
00434     H.val(54,3)=H.val(52,1);
00435 
00436 
00437     //Shape Functions of Node 19Along Three Coordinate Directions
00438     H.val(55,1)=(1.0-r1*r1)*0.5*r2*(r2-1.0)*0.5*r3*(r3-1.0);
00439     H.val(56,2)=H.val(55,1);
00440     H.val(57,3)=H.val(55,1);
00441 
00442 
00443     //Shape Functions of Node 20Along Three Coordinate Directions
00444     H.val(58,1)=0.5*r1*(r1+1.0)*(1.0-r2*r2)*0.5*r3*(r3-1.0);
00445     H.val(59,2)=H.val(58,1);
00446     H.val(60,3)=H.val(58,1);
00447 
00448 
00449     //Shape Functions of Node 21Along Three Coordinate Directions
00450     H.val(61,1)=(1.0-r1*r1)*0.5*r2*(r2+1.0)*(1.0-r3*r3);
00451     H.val(62,2)=H.val(61,1);
00452     H.val(63,3)=H.val(61,1);
00453 
00454 
00455     //Shape Functions of Node 22Along Three Coordinate Directions
00456     H.val(64,1)=0.5*r1*(r1-1.0)*(1.0-r2*r2)*(1.0-r3*r3);
00457     H.val(65,2)=H.val(64,1);
00458     H.val(66,3)=H.val(64,1);
00459 
00460 
00461     //Shape Functions of Node 23Along Three Coordinate Directions
00462     H.val(67,1)=(1.0-r1*r1)*0.5*r2*(r2-1.0)*(1.0-r3*r3);
00463     H.val(68,2)=H.val(67,1);
00464     H.val(69,3)=H.val(67,1);
00465 
00466 
00467     //Shape Functions of Node 24Along Three Coordinate Directions
00468     H.val(70,1)=0.5*r1*(r1+1.0)*(1.0-r2*r2)*(1.0-r3*r3);
00469     H.val(71,2)=H.val(70,1);
00470     H.val(72,3)=H.val(70,1);
00471 
00472 
00473     //Shape Functions of Node 25Along Three Coordinate Directions
00474     H.val(73,1)=(1.0-r1*r1)*(1.0-r2*r2)*0.5*r3*(r3+1.0);
00475     H.val(74,2)=H.val(73,1);
00476     H.val(75,3)=H.val(73,1);
00477 
00478 
00479     //Shape Functions of Node 26Along Three Coordinate Directions
00480     H.val(76,1)=(1.0-r1*r1)*(1.0-r2*r2)*0.5*r3*(r3-1.0);
00481     H.val(77,2)=H.val(76,1);
00482     H.val(78,3)=H.val(76,1);
00483 
00484 
00485     //Shape Functions of Node 27Along Three Coordinate Directions
00486     H.val(79,1)=(1.0-r1*r1)*(1.0-r2*r2)*(1.0-r3*r3);
00487     H.val(80,2)=H.val(79,1);
00488     H.val(81,3)=H.val(79,1);
00489 
00490 
00491 
00492 /*    // influence of the node number 20
00493         H.val(58,1)=(1.0+r1)*(1.0-r2)*(1.0-r3*r3)*0.25;
00494         H.val(59,2)=H.val(58,1); //(1.0+r1)*(1.0-r2)*(1.0-r3*r3)*0.25;
00495         H.val(60,3)=H.val(58,1); //(1.0+r1)*(1.0-r2)*(1.0-r3*r3)*0.25;
00496     // influence of the node number 19
00497         H.val(55,1)=(1.0-r1)*(1.0-r2)*(1.0-r3*r3)*0.25;
00498         H.val(56,2)=H.val(55,1); //(1.0-r1)*(1.0-r2)*(1.0-r3*r3)*0.25;
00499         H.val(57,3)=H.val(55,1); //(1.0-r1)*(1.0-r2)*(1.0-r3*r3)*0.25;
00500     // influence of the node number 18
00501         H.val(52,1)=(1.0-r1)*(1.0+r2)*(1.0-r3*r3)*0.25;
00502         H.val(53,2)=H.val(52,1); //(1.0-r1)*(1.0+r2)*(1.0-r3*r3)*0.25;
00503         H.val(54,3)=H.val(52,1); //(1.0-r1)*(1.0+r2)*(1.0-r3*r3)*0.25;
00504     // influence of the node number 17
00505         H.val(49,1)=(1.0+r1)*(1.0+r2)*(1.0-r3*r3)*0.25;
00506         H.val(50,2)=H.val(49,1); //(1.0+r1)*(1.0+r2)*(1.0-r3*r3)*0.25;
00507         H.val(51,3)=H.val(49,1); //(1.0+r1)*(1.0+r2)*(1.0-r3*r3)*0.25;
00508 
00509     // influence of the node number 16
00510         H.val(46,1)=(1.0+r1)*(1.0-r2*r2)*(1.0-r3)*0.25;
00511         H.val(47,2)=H.val(46,1); //(1.0+r1)*(1.0-r2*r2)*(1.0-r3)*0.25;
00512         H.val(48,3)=H.val(46,1); //(1.0+r1)*(1.0-r2*r2)*(1.0-r3)*0.25;
00513     // influence of the node number 15
00514         H.val(43,1)=(1.0-r1*r1)*(1.0-r2)*(1.0-r3)*0.25;
00515         H.val(44,2)=H.val(43,1); //(1.0-r1*r1)*(1.0-r2)*(1.0-r3)*0.25;
00516         H.val(45,3)=H.val(43,1); //(1.0-r1*r1)*(1.0-r2)*(1.0-r3)*0.25;
00517     // influence of the node number 14
00518         H.val(40,1)=(1.0-r1)*(1.0-r2*r2)*(1.0-r3)*0.25;
00519         H.val(41,2)=H.val(40,1); //(1.0-r1)*(1.0-r2*r2)*(1.0-r3)*0.25;
00520         H.val(42,3)=H.val(40,1); //(1.0-r1)*(1.0-r2*r2)*(1.0-r3)*0.25;
00521     // influence of the node number 13
00522         H.val(37,1)=(1.0-r1*r1)*(1.0+r2)*(1.0-r3)*0.25;
00523         H.val(38,2)=H.val(37,1); //(1.0-r1*r1)*(1.0+r2)*(1.0-r3)*0.25;
00524         H.val(39,3)=H.val(37,1); //(1.0-r1*r1)*(1.0+r2)*(1.0-r3)*0.25;
00525 
00526     // influence of the node number 12
00527         H.val(34,1)=(1.0+r1)*(1.0-r2*r2)*(1.0+r3)*0.25;
00528         H.val(35,2)=H.val(34,1); //(1.0+r1)*(1.0-r2*r2)*(1.0+r3)*0.25;
00529         H.val(36,3)=H.val(34,1); //(1.0+r1)*(1.0-r2*r2)*(1.0+r3)*0.25;
00530     // influence of the node number 11
00531         H.val(31,1)=(1.0-r1*r1)*(1.0-r2)*(1.0+r3)*0.25;
00532         H.val(32,2)=H.val(31,1); //(1.0-r1*r1)*(1.0-r2)*(1.0+r3)*0.25;
00533         H.val(33,3)=H.val(31,1); //(1.0-r1*r1)*(1.0-r2)*(1.0+r3)*0.25;
00534     // influence of the node number 10
00535         H.val(28,1)=(1.0-r1)*(1.0-r2*r2)*(1.0+r3)*0.25;
00536         H.val(29,2)=H.val(28,1); //(1.0-r1)*(1.0-r2*r2)*(1.0+r3)*0.25;
00537         H.val(30,3)=H.val(28,1); //(1.0-r1)*(1.0-r2*r2)*(1.0+r3)*0.25;
00538     // influence of the node number 9
00539         H.val(25,1)=(1.0-r1*r1)*(1.0+r2)*(1.0+r3)*0.25;
00540         H.val(26,2)=H.val(25,1); //(1.0-r1*r1)*(1.0+r2)*(1.0+r3)*0.25;
00541         H.val(27,3)=H.val(25,1); //(1.0-r1*r1)*(1.0+r2)*(1.0+r3)*0.25;
00542 
00543 
00544     // 9-20 nodes
00545 
00546     // influence of the node number 8
00547     H.val(22,1)=(1.0+r1)*(1.0-r2)*(1.0-r3)*0.125 - (H.val(43,1)+H.val(48,3)+H.val(81,3))*0.5;
00548     H.val(23,2)=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(81,3))/2.0;
00549     H.val(24,3)=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(81,3))/2.0;
00550     // influence of the node number 7
00551     H.val(19,1)=(1.0-r1)*(1.0-r2)*(1.0-r3)*0.125 - (H.val(42,3)+H.val(43,1)+H.val(57,3))*0.5;
00552     H.val(20,2)=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;
00553     H.val(21,3)=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;
00554     // influence of the node number 6
00555     H.val(16,1)=(1.0-r1)*(1.0+r2)*(1.0-r3)*0.125 - (H.val(39,3)+H.val(42,3)+H.val(54,3))*0.5;
00556     H.val(17,2)=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;
00557     H.val(18,3)=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;
00558     // influence of the node number 5
00559     H.val(13,1)=(1.0+r1)*(1.0+r2)*(1.0-r3)*0.125 - (H.val(39,3)+H.val(48,3)+H.val(51,3))*0.5;
00560     H.val(14,2)=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;
00561     H.val(15,3)=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;
00562 
00563     // influence of the node number 4
00564     H.val(10,1)=(1.0+r1)*(1.0-r2)*(1.0+r3)*0.125 - (H.val(33,3)+H.val(36,3)+H.val(81,3))*0.5;
00565     H.val(11,2)=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(81,3))/2.0;
00566     H.val(12,3)=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(81,3))/2.0;
00567     // influence of the node number 3
00568     H.val(7,1) =(1.0-r1)*(1.0-r2)*(1.0+r3)*0.125 - (H.val(30,3)+H.val(33,3)+H.val(57,3))*0.5;
00569     H.val(8,2) =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;
00570     H.val(9,3) =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;
00571     // influence of the node number 2
00572     H.val(4,1) =(1.0-r1)*(1.0+r2)*(1.0+r3)*0.125 - (H.val(30,3)+H.val(54,3)+H.val(27,3))*0.5;
00573     H.val(5,2) =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;
00574     H.val(6,3) =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;
00575     // influence of the node number 1
00576     H.val(1,1) =(1.0+r1)*(1.0+r2)*(1.0+r3)*0.125 - (H.val(36,3)+H.val(51,3)+H.val(27,3))*0.5;
00577     H.val(2,2) =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;
00578     H.val(3,3) =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;
00579 
00580     //         double sum = 0;
00581     //
00582     //   for (int i=1; i<=81 ; i++)
00583     //           {
00584     // //        sum+=H.cval(i,1);
00585     //       for (int j=1; j<= 1; j++)
00586     //          {
00587     //                    sum+=H.cval(i,1);
00588     //             ::printf( "  %+9.2e", H.cval(i,j) );
00589     //           }
00590     //            // ::printf( "  %d \n", i);
00591     //      }
00592     //       ::printf( " \n sum= %+6.2e\n", sum );
00593 
00594 
00595     //    printf("r1 = %lf, r2 = %lf, r3 = %lf\n", r1, r2, r3);
00596     //    H.print("h"); *///Commented out by Guanzhou, Oct. 2003
00597 
00598     return H;
00599   }
00600 
00601 //#############################################################################
00602 //***************************************************************
00603 /*tensor TwentySevenNodeBrick::interp_poli_at(double r1, double r2, double r3)
00604   {
00605 
00606     int dimension[] = {20};
00607     tensor h(1, dimension, 0.0);
00608 
00609 
00610     // influence of the node number 20
00611     //    h.val(20)=(1.0+r1)*(1.0-r2)*(1.0-r3*r3)/4.0;
00612         h.val(20)=(1.0+r1)*(1.0-r2)*(1.0-r3*r3)*0.25;
00613     // influence of the node number 19
00614         h.val(19)=(1.0-r1)*(1.0-r2)*(1.0-r3*r3)*0.25;
00615     // influence of the node number 18
00616         h.val(18)=(1.0-r1)*(1.0+r2)*(1.0-r3*r3)*0.25;
00617     // influence of the node number 17
00618         h.val(17)=(1.0+r1)*(1.0+r2)*(1.0-r3*r3)*0.25;
00619 
00620     // influence of the node number 16
00621         h.val(16)=(1.0+r1)*(1.0-r2*r2)*(1.0-r3)*0.25;
00622     // influence of the node number 15
00623         h.val(15)=(1.0-r1*r1)*(1.0-r2)*(1.0-r3)*0.25;
00624     // influence of the node number 14
00625         h.val(14)=(1.0-r1)*(1.0-r2*r2)*(1.0-r3)*0.25;
00626     // influence of the node number 13
00627         h.val(13)=(1.0-r1*r1)*(1.0+r2)*(1.0-r3)*0.25;
00628 
00629     // influence of the node number 12
00630         h.val(12)=(1.0+r1)*(1.0-r2*r2)*(1.0+r3)*0.25;
00631     // influence of the node number 11
00632         h.val(11)=(1.0-r1*r1)*(1.0-r2)*(1.0+r3)*0.25;
00633     // influence of the node number 10
00634         h.val(10)=(1.0-r1)*(1.0-r2*r2)*(1.0+r3)*0.25;
00635     // influence of the node number 9
00636         h.val( 9)=(1.0-r1*r1)*(1.0+r2)*(1.0+r3)*0.25;
00637 
00638       // influence of the node number 8
00639     //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;
00640     h.val(8)=(1.0+r1)*(1.0-r2)*(1.0-r3)*0.125 - (h.val(15)+h.val(16)+h.val(20))*0.5;
00641       // influence of the node number 7
00642     h.val(7)=(1.0-r1)*(1.0-r2)*(1.0-r3)*0.125 - (h.val(14)+h.val(15)+h.val(19))*0.5;
00643       // influence of the node number 6
00644     h.val(6)=(1.0-r1)*(1.0+r2)*(1.0-r3)*0.125 - (h.val(13)+h.val(14)+h.val(18))*0.5;
00645       // influence of the node number 5
00646     h.val(5)=(1.0+r1)*(1.0+r2)*(1.0-r3)*0.125 - (h.val(13)+h.val(16)+h.val(17))*0.5;
00647 
00648       // influence of the node number 4
00649     h.val(4)=(1.0+r1)*(1.0-r2)*(1.0+r3)*0.125 - (h.val(11)+h.val(12)+h.val(20))*0.5;
00650       // influence of the node number 3
00651     h.val(3)=(1.0-r1)*(1.0-r2)*(1.0+r3)*0.125 - (h.val(10)+h.val(11)+h.val(19))*0.5;
00652       // influence of the node number 2
00653     h.val(2)=(1.0-r1)*(1.0+r2)*(1.0+r3)*0.125 - (h.val(10)+h.val(18)+h.val( 9))*0.5;
00654       // influence of the node number 1
00655     h.val(1)=(1.0+r1)*(1.0+r2)*(1.0+r3)*0.125 - (h.val(12)+h.val(17)+h.val( 9))*0.5;
00656     //    printf("r1 = %lf, r2 = %lf, r3 = %lf\n", r1, r2, r3);
00657     //    h.print("h");
00658 
00659     return h;
00660   }*///Commented out by Guanzhou, Oct. 2003
00661 
00662 
00663 
00664 tensor TwentySevenNodeBrick::dh_drst_at(double r1, double r2, double r3)
00665   {
00666 
00667     int dimensions[] = {27,3};  // Changed from{20,3} to {27,3} Guanzhou Oct. 2003
00668     tensor dh(2, dimensions, 0.0);
00669 
00670 
00671     //Shape Functions of Node 1 Along Three Coordinate Directions
00672     dh.val(1,1)=0.5*(2.0*r1+1.0)*0.5*r2*(r2+1.0)*0.5*r3*(r3+1.0);
00673     dh.val(1,2)=0.5*r1*(r1+1.0)*0.5*(2.0*r2+1.0)*0.5*r3*(r3+1.0);
00674     dh.val(1,3)=0.5*r1*(r1+1.0)*0.5*r2*(r2+1.0)*0.5*(2.0*r3+1.0);
00675 
00676     //Shape Functions of Node 2 Along Three Coordinate Directions
00677     dh.val(2,1)=0.5*(2.0*r1-1.0)*0.5*r2*(r2+1.0)*0.5*r3*(r3+1.0);
00678     dh.val(2,2)=0.5*r1*(r1-1.0)*0.5*(2.0*r2+1.0)*0.5*r3*(r3+1.0);
00679     dh.val(2,3)=0.5*r1*(r1-1.0)*0.5*r2*(r2+1.0)*0.5*(2.0*r3+1.0);
00680 
00681     //Shape Functions of Node 3 Along Three Coordinate Directions
00682     dh.val(3,1)=0.5*(2.0*r1-1.0)*0.5*r2*(r2-1.0)*0.5*r3*(r3+1.0);
00683     dh.val(3,2)=0.5*r1*(r1-1.0)*0.5*(2.0*r2-1.0)*0.5*r3*(r3+1.0);
00684     dh.val(3,3)=0.5*r1*(r1-1.0)*0.5*r2*(r2-1.0)*0.5*(2.0*r3+1.0);
00685 
00686     //Shape Functions of Node 4 Along Three Coordinate Directions
00687     dh.val(4,1)=0.5*(2.0*r1+1.0)*0.5*r2*(r2-1.0)*0.5*r3*(r3+1.0);
00688     dh.val(4,2)=0.5*r1*(r1+1.0)*0.5*(2.0*r2-1.0)*0.5*r3*(r3+1.0);
00689     dh.val(4,3)=0.5*r1*(r1+1.0)*0.5*r2*(r2-1.0)*0.5*(2.0*r3+1.0);
00690 
00691     //Shape Functions of Node 5 Along Three Coordinate Directions
00692     dh.val(5,1)=0.5*(2.0*r1+1.0)*0.5*r2*(r2+1.0)*0.5*r3*(r3-1.0);
00693     dh.val(5,2)=0.5*r1*(r1+1.0)*0.5*(2.0*r2+1.0)*0.5*r3*(r3-1.0);
00694     dh.val(5,3)=0.5*r1*(r1+1.0)*0.5*r2*(r2+1.0)*0.5*(2.0*r3-1.0);
00695 
00696     //Shape Functions of Node 6 Along Three Coordinate Directions
00697     dh.val(6,1)=0.5*(2.0*r1-1.0)*0.5*r2*(r2+1.0)*0.5*r3*(r3-1.0);
00698     dh.val(6,2)=0.5*r1*(r1-1.0)*0.5*(2.0*r2+1.0)*0.5*r3*(r3-1.0);
00699     dh.val(6,3)=0.5*r1*(r1-1.0)*0.5*r2*(r2+1.0)*0.5*(2.0*r3-1.0);
00700 
00701     //Shape Functions of Node 7 Along Three Coordinate Directions
00702     dh.val(7,1)=0.5*(2.0*r1-1.0)*0.5*r2*(r2-1.0)*0.5*r3*(r3-1.0);
00703     dh.val(7,2)=0.5*r1*(r1-1.0)*0.5*(2.0*r2-1.0)*0.5*r3*(r3-1.0);
00704     dh.val(7,3)=0.5*r1*(r1-1.0)*0.5*r2*(r2-1.0)*0.5*(2.0*r3-1.0);
00705 
00706 
00707     //Shape Functions of Node 8 Along Three Coordinate Directions
00708     dh.val(8,1)=0.5*(2.0*r1+1.0)*0.5*r2*(r2-1.0)*0.5*r3*(r3-1.0);
00709     dh.val(8,2)=0.5*r1*(r1+1.0)*0.5*(2.0*r2-1.0)*0.5*r3*(r3-1.0);
00710     dh.val(8,3)=0.5*r1*(r1+1.0)*0.5*r2*(r2-1.0)*0.5*(2.0*r3-1.0);
00711 
00712 
00713     //Shape Functions of Node 9 Along Three Coordinate Directions
00714     dh.val(9,1)=0.5*(2.0*r1+1.0)*0.5*r2*(r2+1.0)*(1.0-r3*r3);
00715     dh.val(9,2)=0.5*r1*(r1+1.0)*0.5*(2.0*r2+1.0)*(1.0-r3*r3);
00716     dh.val(9,3)=0.5*r1*(r1+1.0)*0.5*r2*(r2+1.0)*(-2.0*r3);
00717 
00718 
00719     //Shape Functions of Node 10Along Three Coordinate Directions
00720     dh.val(10,1)=0.5*(2.0*r1-1.0)*0.5*r2*(r2+1.0)*(1.0-r3*r3);
00721     dh.val(10,2)=0.5*r1*(r1-1.0)*0.5*(2.0*r2+1.0)*(1.0-r3*r3);
00722     dh.val(10,3)=0.5*r1*(r1-1.0)*0.5*r2*(r2+1.0)*(-2.0*r3);
00723 
00724 
00725     //Shape Functions of Node 11Along Three Coordinate Directions
00726     dh.val(11,1)=0.5*(2.0*r1-1.0)*0.5*r2*(r2-1.0)*(1.0-r3*r3);
00727     dh.val(11,2)=0.5*r1*(r1-1.0)*0.5*(2.0*r2-1.0)*(1.0-r3*r3);
00728     dh.val(11,3)=0.5*r1*(r1-1.0)*0.5*r2*(r2-1.0)*(-2.0*r3);
00729 
00730 
00731     //Shape Functions of Node 12Along Three Coordinate Directions
00732     dh.val(12,1)=0.5*(2.0*r1+1.0)*0.5*r2*(r2-1.0)*(1.0-r3*r3);
00733     dh.val(12,2)=0.5*r1*(r1+1.0)*0.5*(2.0*r2-1.0)*(1.0-r3*r3);
00734     dh.val(12,3)=0.5*r1*(r1+1.0)*0.5*r2*(r2-1.0)*(-2.0*r3);
00735 
00736 
00737     //Shape Functions of Node 13Along Three Coordinate Directions
00738     dh.val(13,1)=(-2.0*r1)*0.5*r2*(r2+1.0)*0.5*r3*(r3+1.0);
00739     dh.val(13,2)=(1.0-r1*r1)*0.5*(2.0*r2+1.0)*0.5*r3*(r3+1.0);
00740     dh.val(13,3)=(1.0-r1*r1)*0.5*r2*(r2+1.0)*0.5*(2.0*r3+1.0);
00741 
00742 
00743     //Shape Functions of Node 14Along Three Coordinate Directions
00744     dh.val(14,1)=0.5*(2.0*r1-1.0)*(1.0-r2*r2)*0.5*r3*(r3+1.0);
00745     dh.val(14,2)=0.5*r1*(r1-1.0)*(-2.0*r2)*0.5*r3*(r3+1.0);
00746     dh.val(14,3)=0.5*r1*(r1-1.0)*(1.0-r2*r2)*0.5*(2.0*r3+1.0);
00747 
00748 
00749     //Shape Functions of Node 15Along Three Coordinate Directions
00750     dh.val(15,1)=(-2.0*r1)*0.5*r2*(r2-1.0)*0.5*r3*(r3+1.0);
00751     dh.val(15,2)=(1.0-r1*r1)*0.5*(2.0*r2-1.0)*0.5*r3*(r3+1.0);
00752     dh.val(15,3)=(1.0-r1*r1)*0.5*r2*(r2-1.0)*0.5*(2.0*r3+1.0);
00753 
00754 
00755     //Shape Functions of Node 16Along Three Coordinate Directions
00756     dh.val(16,1)=0.5*(2.0*r1+1.0)*(1.0-r2*r2)*0.5*r3*(r3+1.0);
00757     dh.val(16,2)=0.5*r1*(r1+1.0)*(-2.0*r2)*0.5*r3*(r3+1.0);
00758     dh.val(16,3)=0.5*r1*(r1+1.0)*(1.0-r2*r2)*0.5*(2.0*r3+1.0);
00759 
00760 
00761     //Shape Functions of Node 17Along Three Coordinate Directions
00762     dh.val(17,1)=(-2.0*r1)*0.5*r2*(r2+1.0)*0.5*r3*(r3-1.0);
00763     dh.val(17,2)=(1.0-r1*r1)*0.5*(2.0*r2+1.0)*0.5*r3*(r3-1.0);
00764     dh.val(17,3)=(1.0-r1*r1)*0.5*r2*(r2+1.0)*0.5*(2.0*r3-1.0);
00765 
00766 
00767     //Shape Functions of Node 18Along Three Coordinate Directions
00768     dh.val(18,1)=0.5*(2.0*r1-1.0)*(1.0-r2*r2)*0.5*r3*(r3-1.0);
00769     dh.val(18,2)=0.5*r1*(r1-1.0)*(-2.0*r2)*0.5*r3*(r3-1.0);
00770     dh.val(18,3)=0.5*r1*(r1-1.0)*(1.0-r2*r2)*0.5*(2.0*r3-1.0);
00771 
00772 
00773     //Shape Functions of Node 19Along Three Coordinate Directions
00774     dh.val(19,1)=(-2.0*r1)*0.5*r2*(r2-1.0)*0.5*r3*(r3-1.0);
00775     dh.val(19,2)=(1.0-r1*r1)*0.5*(2.0*r2-1.0)*0.5*r3*(r3-1.0);
00776     dh.val(19,3)=(1.0-r1*r1)*0.5*r2*(r2-1.0)*0.5*(2.0*r3-1.0);
00777 
00778 
00779     //Shape Functions of Node 20Along Three Coordinate Directions
00780     dh.val(20,1)=0.5*(2.0*r1+1.0)*(1.0-r2*r2)*0.5*r3*(r3-1.0);
00781     dh.val(20,2)=0.5*r1*(r1+1.0)*(-2.0*r2)*0.5*r3*(r3-1.0);
00782     dh.val(20,3)=0.5*r1*(r1+1.0)*(1.0-r2*r2)*0.5*(2.0*r3-1.0);
00783 
00784 
00785     //Shape Functions of Node 21Along Three Coordinate Directions
00786     dh.val(21,1)=(-2.0*r1)*0.5*r2*(r2+1.0)*(1.0-r3*r3);
00787     dh.val(21,2)=(1.0-r1*r1)*0.5*(2.0*r2+1.0)*(1.0-r3*r3);
00788     dh.val(21,3)=(1.0-r1*r1)*0.5*r2*(r2+1.0)*(-2.0*r3);
00789 
00790 
00791     //Shape Functions of Node 22Along Three Coordinate Directions
00792     dh.val(22,1)=0.5*(2.0*r1-1.0)*(1.0-r2*r2)*(1.0-r3*r3);
00793     dh.val(22,2)=0.5*r1*(r1-1.0)*(-2.0*r2)*(1.0-r3*r3);
00794     dh.val(22,3)=0.5*r1*(r1-1.0)*(1.0-r2*r2)*(-2.0*r3);
00795 
00796 
00797     //Shape Functions of Node 23Along Three Coordinate Directions
00798     dh.val(23,1)=(-2.0*r1)*0.5*r2*(r2-1.0)*(1.0-r3*r3);
00799     dh.val(23,2)=(1.0-r1*r1)*0.5*(2.0*r2-1.0)*(1.0-r3*r3);
00800     dh.val(23,3)=(1.0-r1*r1)*0.5*r2*(r2-1.0)*(-2.0*r3);
00801 
00802 
00803     //Shape Functions of Node 24Along Three Coordinate Directions
00804     dh.val(24,1)=0.5*(2.0*r1+1.0)*(1.0-r2*r2)*(1.0-r3*r3);
00805     dh.val(24,2)=0.5*r1*(r1+1.0)*(-2.0*r2)*(1.0-r3*r3);
00806     dh.val(24,3)=0.5*r1*(r1+1.0)*(1.0-r2*r2)*(-2.0*r3);
00807 
00808 
00809     //Shape Functions of Node 25Along Three Coordinate Directions
00810     dh.val(25,1)=(-2.0*r1)*(1.0-r2*r2)*0.5*r3*(r3+1.0);
00811     dh.val(25,2)=(1.0-r1*r1)*(-2.0*r2)*0.5*r3*(r3+1.0);
00812     dh.val(25,3)=(1.0-r1*r1)*(1.0-r2*r2)*0.5*(2.0*r3+1.0);
00813 
00814 
00815     //Shape Functions of Node 26Along Three Coordinate Directions
00816     dh.val(26,1)=(-2.0*r1)*(1.0-r2*r2)*0.5*r3*(r3-1.0);
00817     dh.val(26,2)=(1.0-r1*r1)*(-2.0*r2)*0.5*r3*(r3-1.0);
00818     dh.val(26,3)=(1.0-r1*r1)*(1.0-r2*r2)*0.5*(2.0*r3-1.0);
00819 
00820 
00821     //Shape Functions of Node 27Along Three Coordinate Directions
00822     dh.val(27,1)=(-2.0*r1)*(1.0-r2*r2)*(1.0-r3*r3);
00823     dh.val(27,2)=(1.0-r1*r1)*(-2.0*r2)*(1.0-r3*r3);
00824     dh.val(27,3)=(1.0-r1*r1)*(1.0-r2*r2)*(-2.0*r3);
00825 
00826 
00827 
00828 /*    // influence of the node number 20
00829         dh.val(20,1) =   (1.0-r2)*(1.0-r3*r3)*0.25; ///4.0;
00830         dh.val(20,2) = - (1.0+r1)*(1.0-r3*r3)*0.25; ///4.0;
00831         dh.val(20,3) = - (1.0+r1)*(1.0-r2)*r3*0.50; ///2.0;
00832     // influence of the node number 19
00833         dh.val(19,1) = - (1.0-r2)*(1.0-r3*r3)*0.25; ///4.0;
00834         dh.val(19,2) = - (1.0-r1)*(1.0-r3*r3)*0.25; ///4.0;
00835         dh.val(19,3) = - (1.0-r1)*(1.0-r2)*r3*0.50; ///2.0;
00836     // influence of the node number 18
00837         dh.val(18,1) = - (1.0+r2)*(1.0-r3*r3)*0.25; ///4.0;
00838         dh.val(18,2) =   (1.0-r1)*(1.0-r3*r3)*0.25; ///4.0;
00839         dh.val(18,3) = - (1.0-r1)*(1.0+r2)*r3*0.50; ///2.0;
00840     // influence of the node number 17
00841         dh.val(17,1) =   (1.0+r2)*(1.0-r3*r3)*0.25; ///4.0;
00842         dh.val(17,2) =   (1.0+r1)*(1.0-r3*r3)*0.25; ///4.0;
00843         dh.val(17,3) = - (1.0+r1)*(1.0+r2)*r3*0.50; ///2.0;
00844 
00845     // influence of the node number 16
00846         dh.val(16,1) =   (1.0-r2*r2)*(1.0-r3)*0.25; ///4.0;
00847         dh.val(16,2) = - (1.0+r1)*r2*(1.0-r3)*0.50; ///2.0;
00848         dh.val(16,3) = - (1.0+r1)*(1.0-r2*r2)*0.25; ///4.0;
00849     // influnce of the node number 15
00850         dh.val(15,1) = - r1*(1.0-r2)*(1.0-r3)*0.50; ///2.0;
00851         dh.val(15,2) = - (1.0-r1*r1)*(1.0-r3)*0.25; ///4.0;
00852         dh.val(15,3) = - (1.0-r1*r1)*(1.0-r2)*0.25; ///4.0;
00853     // influence of the node number 14
00854         dh.val(14,1) = - (1.0-r2*r2)*(1.0-r3)*0.25; ///4.0;
00855         dh.val(14,2) = - (1.0-r1)*r2*(1.0-r3)*0.50; ///2.0;
00856         dh.val(14,3) = - (1.0-r1)*(1.0-r2*r2)*0.25; ///4.0;
00857     // influence of the node number 13
00858         dh.val(13,1) = - r1*(1.0+r2)*(1.0-r3)*0.50; ///2.0;
00859         dh.val(13,2) =   (1.0-r1*r1)*(1.0-r3)*0.25; ///4.0;
00860         dh.val(13,3) = - (1.0-r1*r1)*(1.0+r2)*0.25; ///4.0;
00861 
00862     // influence of the node number 12
00863         dh.val(12,1) =   (1.0-r2*r2)*(1.0+r3)*0.25; ///4.0;
00864         dh.val(12,2) = - (1.0+r1)*r2*(1.0+r3)*0.50; ///2.0;
00865         dh.val(12,3) =   (1.0+r1)*(1.0-r2*r2)*0.25; ///4.0;
00866     // influence of the node number 11
00867         dh.val(11,1) = - r1*(1.0-r2)*(1.0+r3)*0.50; ///2.0;
00868         dh.val(11,2) = - (1.0-r1*r1)*(1.0+r3)*0.25; ///4.0; // bug discovered 01 aug '95 2.0 -> 4.0
00869         dh.val(11,3) =   (1.0-r1*r1)*(1.0-r2)*0.25; ///4.0;
00870     // influence of the node number 10
00871         dh.val(10,1) = - (1.0-r2*r2)*(1.0+r3)*0.25; ///4.0;
00872         dh.val(10,2) = - (1.0-r1)*r2*(1.0+r3)*0.50; ///2.0;
00873         dh.val(10,3) =   (1.0-r1)*(1.0-r2*r2)*0.25; ///4.0;
00874     // influence of the node number 9
00875         dh.val(9,1)  = - r1*(1.0+r2)*(1.0+r3)*0.50; ///2.0;
00876         dh.val(9,2)  =   (1.0-r1*r1)*(1.0+r3)*0.25; ///4.0;
00877         dh.val(9,3)  =   (1.0-r1*r1)*(1.0+r2)*0.25; ///4.0;
00878 
00879       // influence of the node number 8
00880     //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;
00881     dh.val(8,1)= (1.0-r2)*(1.0-r3)*0.125 - (dh.val(15,1)+dh.val(16,1)+dh.val(20,1))*0.50; ///2.0;
00882     dh.val(8,2)=-(1.0+r1)*(1.0-r3)*0.125 - (dh.val(15,2)+dh.val(16,2)+dh.val(20,2))*0.50; ///2.0;
00883     dh.val(8,3)=-(1.0+r1)*(1.0-r2)*0.125 - (dh.val(15,3)+dh.val(16,3)+dh.val(20,3))*0.50; ///2.0;
00884       // influence of the node number 7
00885     dh.val(7,1)=-(1.0-r2)*(1.0-r3)*0.125 - (dh.val(14,1)+dh.val(15,1)+dh.val(19,1))*0.50; ///2.0;
00886     dh.val(7,2)=-(1.0-r1)*(1.0-r3)*0.125 - (dh.val(14,2)+dh.val(15,2)+dh.val(19,2))*0.50; ///2.0;
00887     dh.val(7,3)=-(1.0-r1)*(1.0-r2)*0.125 - (dh.val(14,3)+dh.val(15,3)+dh.val(19,3))*0.50; ///2.0;
00888       // influence of the node number 6
00889     dh.val(6,1)=-(1.0+r2)*(1.0-r3)*0.125 - (dh.val(13,1)+dh.val(14,1)+dh.val(18,1))*0.50; ///2.0;
00890     dh.val(6,2)= (1.0-r1)*(1.0-r3)*0.125 - (dh.val(13,2)+dh.val(14,2)+dh.val(18,2))*0.50; ///2.0;
00891     dh.val(6,3)=-(1.0-r1)*(1.0+r2)*0.125 - (dh.val(13,3)+dh.val(14,3)+dh.val(18,3))*0.50; ///2.0;
00892       // influence of the node number 5
00893     dh.val(5,1)= (1.0+r2)*(1.0-r3)*0.125 - (dh.val(13,1)+dh.val(16,1)+dh.val(17,1))*0.50; ///2.0;
00894     dh.val(5,2)= (1.0+r1)*(1.0-r3)*0.125 - (dh.val(13,2)+dh.val(16,2)+dh.val(17,2))*0.50; ///2.0;
00895     dh.val(5,3)=-(1.0+r1)*(1.0+r2)*0.125 - (dh.val(13,3)+dh.val(16,3)+dh.val(17,3))*0.50; ///2.0;
00896 
00897       // influence of the node number 4
00898     dh.val(4,1)= (1.0-r2)*(1.0+r3)*0.125 - (dh.val(11,1)+dh.val(12,1)+dh.val(20,1))*0.50; ///2.0;
00899     dh.val(4,2)=-(1.0+r1)*(1.0+r3)*0.125 - (dh.val(11,2)+dh.val(12,2)+dh.val(20,2))*0.50; ///2.0;
00900     dh.val(4,3)= (1.0+r1)*(1.0-r2)*0.125 - (dh.val(11,3)+dh.val(12,3)+dh.val(20,3))*0.50; ///2.0;
00901       // influence of the node number 3
00902     dh.val(3,1)=-(1.0-r2)*(1.0+r3)*0.125 - (dh.val(10,1)+dh.val(11,1)+dh.val(19,1))*0.50; ///2.0;
00903     dh.val(3,2)=-(1.0-r1)*(1.0+r3)*0.125 - (dh.val(10,2)+dh.val(11,2)+dh.val(19,2))*0.50; ///2.0;
00904     dh.val(3,3)= (1.0-r1)*(1.0-r2)*0.125 - (dh.val(10,3)+dh.val(11,3)+dh.val(19,3))*0.50; ///2.0;
00905       // influence of the node number 2
00906     dh.val(2,1)=-(1.0+r2)*(1.0+r3)*0.125 - (dh.val(10,1)+dh.val(18,1)+dh.val( 9,1))*0.50; ///2.0;
00907     dh.val(2,2)= (1.0-r1)*(1.0+r3)*0.125 - (dh.val(10,2)+dh.val(18,2)+dh.val( 9,2))*0.50; ///2.0;
00908     dh.val(2,3)= (1.0-r1)*(1.0+r2)*0.125 - (dh.val(10,3)+dh.val(18,3)+dh.val( 9,3))*0.50; ///2.0;
00909       // influence of the node number 1
00910     dh.val(1,1)= (1.0+r2)*(1.0+r3)*0.125 - (dh.val(12,1)+dh.val(17,1)+dh.val( 9,1))*0.50; ///2.0;
00911     dh.val(1,2)= (1.0+r1)*(1.0+r3)*0.125 - (dh.val(12,2)+dh.val(17,2)+dh.val( 9,2))*0.50; ///2.0;
00912     dh.val(1,3)= (1.0+r1)*(1.0+r2)*0.125 - (dh.val(12,3)+dh.val(17,3)+dh.val( 9,3))*0.50; ///2.0;*///Commented out by Guanzhou, Oct. 2003
00913 
00914     return dh;
00915   }
00916 
00917 
00918 
00920 TwentySevenNodeBrick & TwentySevenNodeBrick::operator[](int subscript)
00921   {
00922     return ( *(this+subscript) );
00923   }
00924 
00925 //Finite_Element & TwentySevenNodeBrick::operator[](short subscript)
00926 //  {
00927 //    return ( *(this+subscript) );
00928 //  }
00929 
00930 //Finite_Element & TwentySevenNodeBrick::operator[](unsigned subscript)
00931 //  {
00932 //    return ( *(this+subscript) );
00933 //  }
00934 
00935 
00940 tensor TwentySevenNodeBrick::getStiffnessTensor(void)
00941   {
00942     int K_dim[] = {27,3,3,27};
00943     tensor Kk(4,K_dim,0.0);
00944     tensor Kkt(4,K_dim,0.0);
00945 
00946 //debugging
00947 //    matrix Kmat;
00948 
00949     double r  = 0.0;
00950     double rw = 0.0;
00951     double s  = 0.0;
00952     double sw = 0.0;
00953     double t  = 0.0;
00954     double tw = 0.0;
00955 
00956     short where = 0;
00957     double weight = 0.0;
00958 
00959     int dh_dim[] = {27,3};
00960     tensor dh(2, dh_dim, 0.0);
00961 
00962     //    tensor Constitutive( 4, def_dim_4, 0.0);
00963     tensor Constitutive;
00964 
00965     double det_of_Jacobian = 0.0;
00966 
00967     static int disp_dim[] = {27,3};
00968     tensor incremental_displacements(2,disp_dim,0.0); // \Delta u
00969 
00970     straintensor incremental_strain;
00971 //    straintensor total_strain_at_GP;
00972 
00973     tensor Jacobian;
00974     tensor JacobianINV;
00975     tensor JacobianINVtemp;
00976     tensor dhGlobal;
00977 
00978     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
00979       {
00980         r = get_Gauss_p_c( r_integration_order, GP_c_r );
00981         rw = get_Gauss_p_w( r_integration_order, GP_c_r );
00982         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
00983           {
00984             s = get_Gauss_p_c( s_integration_order, GP_c_s );
00985             sw = get_Gauss_p_w( s_integration_order, GP_c_s );
00986             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
00987               {
00988                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
00989                 tw = get_Gauss_p_w( t_integration_order, GP_c_t );
00990                 // this short routine is supposed to calculate position of
00991                 // Gauss point from 3D array of short's
00992                 where =
00993                    ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
00994                 // derivatives of local coordinates with respect to local coordinates
00995                 dh = dh_drst_at(r,s,t);
00996     //dh.print("dh");
00997                 // Jacobian tensor ( matrix )
00998                 Jacobian = Jacobian_3D(dh);
00999                 // Inverse of Jacobian tensor ( matrix )
01000                 JacobianINV = Jacobian_3Dinv(dh);
01001                 //JacobianINVtemp = Jacobian.inverse();
01002                 // determinant of Jacobian tensor ( matrix )
01003                 det_of_Jacobian  = Jacobian.determinant();
01004                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
01006                 dhGlobal = dh("ij") * JacobianINV("kj");
01007                 //        ::fprintf(stdout," # %d \n\n\n\n\n\n\n\n", El_count);
01008                   //dhGlobal.print("dhGlobal");
01009                 //weight
01010                 weight = rw * sw * tw * det_of_Jacobian;
01011                 //::::::
01012                 //printf("\n\nIN THE STIFFNESS TENSOR INTEGRATOR ----**************** where = %d \n", where);
01013                 //printf("  Stifness_Tensor \n");
01014                 //printf("                    GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
01015                 //                            GP_c_r,GP_c_s,GP_c_t);
01016                 //printf("WEIGHT = %f", weight);
01017                 //Jacobian.print("J");
01018                 //JacobianINV.print("JINV");
01019                 //JacobianINVtemp.print("JINVtemp");
01020                 //tensor I = JacobianINV("ij")*Jacobian("jk");
01021                 //I.print("I");
01022 
01023                 //printf("determinant of Jacobian = %.6e", det_of_Jacobian);
01024                 //matpoint[where].report("Gauss Point\n");
01025 
01026                 // incremental straines at this Gauss point
01027                 //GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor1\n");
01028 
01029     //09-02-2001 Zhaohui
01030     //              incremental_strain =
01031                 //     (dhGlobal("ib")*incremental_displacements("ia")).symmetrize11();
01032 
01033     //incremental_strain.null_indices();
01034                 //incremental_strain.report("\n incremental_strain tensor at GAUSS point\n");
01035 
01036                   // incremental_strain.reportshort("\n incremental_strain tensor at GAUSS point\n");
01037                 //----   GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor2\n");
01038                 // intialize total strain with the strain at this Gauss point before
01039                 // adding this increments strains!
01040                 //                total_strain_at_GP.Initialize(*(GPstrain+where));
01041                 //total_strain_at_GP.reportshort("\n total_strain tensor at GAUSS point BEFORE\n");
01042                 // this is the addition of incremental strains to the previous strain state at
01043                 // this Gauss point
01044                 //                total_strain_at_GP = total_strain_at_GP + incremental_strain;
01045                 //total_strain_at_GP.reportshort("\n total_strain tensor at GAUSS point AFTER\n");
01046                 //..   dakle ovde posalji strain_increment jer se stari stress cuva u okviru svake
01047                 //..   Gauss tacke a samo saljes strain_increment koji ce da se prenese
01048                 //..   u integracionu rutinu pa ce ta da vrati krajnji napon i onda moze da
01049                 //..   se pravi ConstitutiveStiffnessTensor.
01050                 // here comes the final_stress calculation
01051                 // this final stress after integration is used ONLY to obtain Constitutive tensor
01052                 // at this Gauss point.
01053 
01054                 //final_stress_after_integration =
01055                 //    (matpoint)->operator[](where).FinalStress(*(GPstress+where),
01056                 //                                 incremental_strain,
01057                 //                                 (matpoint)->operator[](where),
01058                 //                                 number_of_subincrements,
01059                 //                                 this_one_PP);
01060                 //final_stress_after_integration.reportshortpqtheta("\n final_stress_after_integration in stiffness_tensor5\n");
01061 
01062                 //----   GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor3\n");
01063                 //final_stress_after_integration.reportshortpqtheta("\n final_stress_after_integration GAUSS \n");
01064                 //----   GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor4\n");
01065 
01066                 // this final stress after integration is used ONLY to obtain Constitutive tensor
01067                 // at this Gauss point AND to set up the iterative_stress that is used in calculting
01068                 // internal forces during iterations!!
01069 
01070                 //GPiterative_stress[where].Initialize(final_stress_after_integration);
01071                 //GPiterative_stress[where].reportshortpqtheta("\n iterative_stress at GAUSS point in stiffness_tensor5\n");
01072 
01073 
01074                 // Stress state at Gauss point will be updated ( in the
01075                 // sense of updating stresses ( integrating them ) ) in function Update (...) ! ! ! ! !
01076                 // calculate the constitutive tensor
01077                 //......         Constitutive =  GPtangent_E[where];
01078 
01079     //Constitutive =  (matpoint)->operator[](where).ConstitutiveTensor(final_stress_after_integration,
01080                 //                                         *(GPstress+where),
01081                 //                                          incremental_strain,
01082                 //                                          (matpoint)->operator[](where),
01083                 //                                          this_one_PP);
01084                 //Constitutive.print("C","\n\n C tensor \n");
01085 
01086           //EPState *tmp_eps = (matpoint[where]).getEPS();
01087           //NDMaterial *tmp_ndm = (matpoint[where]).getNDMat();
01088 
01089                   Constitutive = (matpoint[where]->matmodel)->getTangentTensor();
01090                 //Constitutive.print("C","\n\n C tensor \n");
01091 
01092     //    matpoint[where].setEPS( mmodel->getEPS() );
01093     //}
01094     //else if ( tmp_ndm ) { //Elastic case
01095     //    (matpoint[where].p_matmodel)->setTrialStrainIncr( incremental_strain );
01096     //    Constitutive = (matpoint[where].p_matmodel)->getTangentTensor();
01097     //}
01098     //else {
01099                  //   g3ErrorHandler->fatal("TwentySevenNodeBrick::incremental_Update (tag: %d), could not getTangentTensor", this->getTag());
01100     //   exit(1);
01101     //}
01102 
01103     //printf("Constitutive.trace = %12.6e\n", Constitutive.trace());
01104                 //Kmat = this->stiffness_matrix(Constitutive);
01105                 //printf("Constitutive tensor max:= %10.3e\n", Kmat.mmax());
01106 
01107                 //----   GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor5\n");
01108                 // this is update of constitutive tensor at this Gauss point
01109                 //GPtangent_E[where].Initialize(Constitutive);
01110                 //....GPtangent_E[where].print(" tangent E at GAUSS point");
01111 
01112                 //GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor6\n");
01113 
01114                 //K = K + temp2;
01115 
01116                   Kkt = dhGlobal("ib")*Constitutive("abcd");
01117                   Kk = Kk + Kkt("aicd")*dhGlobal("jd")*weight;
01118 
01119     //Kk = Kk + dhGlobal("ib")*Constitutive("abcd")*dhGlobal("jd")*weight;
01120                 //....K.print("K","\n\n K tensor \n");
01121 
01122     //Kmat = this->stiffness_matrix(Kk);
01123                 //printf("K tensor max= %10.3e\n", Kmat.mmax());
01124 
01125                 //convert constitutive and K to matrix and find min and max and print!
01126 
01127 
01128 
01129               }
01130           }
01131       }
01132     //Kk.print("K","\n\n K tensor \n");
01133     //K = Kk;
01134     return Kk;
01135   }
01136 
01137 
01138 //#############################################################################
01139 
01140 void TwentySevenNodeBrick::set_strain_stress_tensor(FILE *fp, double * u)
01141   {
01142     int dh_dim[] = {27,3};
01143     tensor dh(2, dh_dim, 0.0);
01144 
01145 //    tensor Constitutive( 4, def_dim_4, 0.0);
01146     tensor Constitutive;
01147     double r  = 0.0;
01148     double s  = 0.0;
01149     double t  = 0.0;
01150     int where = 0;
01151 
01152     double det_of_Jacobian;
01153 
01154     straintensor strain;
01155     stresstensor stress;
01156 
01157     tensor Jacobian;
01158     tensor JacobianINV;
01159     tensor dhGlobal;
01160 
01161 
01162     static int disp_dim[] = {27,3};
01163     tensor total_displacements(2,disp_dim,0.0); //
01164 
01165     total_displacements = total_disp(fp, u);
01166 
01167     ::printf("\n  displacement(x-y-z) at GAUSS pt %d \n\n", where+1);
01168     for (int ii=1; ii<=27;ii++)
01169      {
01170       ::printf("Global# %d Local#%d  %+0.5e %+0.5e %+0.5e\n",
01171                      //G_N_numbs[ii-1],
01172          connectedExternalNodes(ii-1),
01173          ii,total_displacements.val(ii,1),
01174                total_displacements.val(ii,2),
01175          total_displacements.val(ii,3));
01176      }
01177 
01178     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
01179       {
01180         r = get_Gauss_p_c( r_integration_order, GP_c_r );
01181         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
01182           {
01183             s = get_Gauss_p_c( s_integration_order, GP_c_s );
01184             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
01185               {
01186                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
01187                 // this short routine is supposed to calculate position of
01188                 // Gauss point from 3D array of short's
01189                 where =
01190                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
01191                 // derivatives of local coordinates with respect to local coordinates
01192                 dh = dh_drst_at(r,s,t);
01193                 // Jacobian tensor ( matrix )
01194                 Jacobian = Jacobian_3D(dh);
01195                 // Inverse of Jacobian tensor ( matrix )
01196                 JacobianINV = Jacobian_3Dinv(dh);
01197                 // determinant of Jacobian tensor ( matrix )
01198                 det_of_Jacobian  = Jacobian.determinant();
01199                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
01200                 //dhGlobal = dh("ij") * JacobianINV("jk");// Zhaohui 09-02-2001
01201                 dhGlobal = dh("ij") * JacobianINV("kj");
01202                 //weight
01203                 // straines at this Gauss point from displacement
01204                 strain = (dhGlobal("ib")*total_displacements("ia")).symmetrize11();
01205                 strain.null_indices();
01206                 // here comes the final_stress calculation
01207                 // at this Gauss point.
01208 
01209                 //Constitutive =  GPtangent_E[where];
01210                 //Constitutive =  (matpoint->getEPS() )->getEep();
01211                 // if set total displ, then it should be elstic material
01212                   Constitutive =  ( matpoint[where]->matmodel)->getTangentTensor();
01213 
01214                   stress = Constitutive("ijkl") * strain("kl");
01215                 stress.null_indices();
01216 
01217                 ::printf("\n  strain tensor at GAUSS point %d \n", where+1);
01218                 strain.reportshort("");
01219                 ::printf("\n  stress tensor at GAUSS point %d \n", where+1);
01220                 stress.reportshort("");
01221 
01222 
01223               }
01224           }
01225       }
01226   }
01227 
01228 
01230 //  tensor TwentySevenNodeBrick::mass_tensor(Elastic  mmodel)
01231 tensor TwentySevenNodeBrick::getMassTensor(void)
01232   {
01233     //int M_dim[] = {8,3,3,8};
01234     int M_dim[] = {81,81};
01235     tensor Mm(2,M_dim,0.0);
01236 
01237     double r  = 0.0;
01238     double rw = 0.0;
01239     double s  = 0.0;
01240     double sw = 0.0;
01241     double t  = 0.0;
01242     double tw = 0.0;
01243 
01244     short where = 0;
01245     double weight = 0.0;
01246 
01247     int dh_dim[] = {27,3};
01248 
01249     tensor dh(2, dh_dim, 0.0);
01250 
01251     int h_dim[] = {81,3};
01252     tensor H(2, h_dim, 0.0);
01253 
01254     double det_of_Jacobian = 0.0;
01255 
01256     tensor Jacobian;
01257 
01258     double RHO;
01259     RHO= rho;    //global
01260 
01261     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
01262       {
01263         r = get_Gauss_p_c( r_integration_order, GP_c_r );
01264         rw = get_Gauss_p_w( r_integration_order, GP_c_r );
01265         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
01266           {
01267             s = get_Gauss_p_c( s_integration_order, GP_c_s );
01268             sw = get_Gauss_p_w( s_integration_order, GP_c_s );
01269             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
01270               {
01271                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
01272                 tw = get_Gauss_p_w( t_integration_order, GP_c_t );
01273                 // this short routine is supposed to calculate position of
01274                 // Gauss point from 3D array of short's
01275                 where =
01276                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
01277                 // derivatives of local coordinates with respect to local coordinates
01278                 dh = dh_drst_at(r,s,t);
01279                 // Jacobian tensor ( matrix )
01280                 Jacobian = Jacobian_3D(dh);
01281                 //     Jacobian.print("J","Jacobian");
01282                 // Inverse of Jacobian tensor ( matrix )
01283                 //                JacobianINV = Jacobian_3Dinv(dh);
01284                 // determinant of Jacobian tensor ( matrix )
01285                 det_of_Jacobian  = Jacobian.determinant();
01286                 //     printf("det_of_Jacobian = %6.2e \n",det_of_Jacobian);
01287                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
01288                 //                dhGlobal = dh("ij") * JacobianINV("jk");
01289                 // derivatives of local coordinates with respect to local coordinates
01290 
01291 
01292                 // printf("\n\nIN THE MASS TENSOR INTEGRATOR ----**************** where = %d \n", where);
01293                 // printf("  Mass_Tensor \n");
01294                 // printf("                    GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
01295                 //                             GP_c_r,GP_c_s,GP_c_t);
01296                 //
01297                 H = H_3D(r,s,t);
01298 
01299                 //  double sum = 0.0;
01300                 //  for (int i=1; i<=81 ; i++)
01301                 //           {
01302                 // //        sum+=H.cval(i,1);
01303                 //       for (int j=1; j<= 3; j++)
01304                 //          {
01305                 //                    sum+=H.cval(i,j);
01306                 //             ::printf( "  %+9.2e", H.cval(i,j) );
01307                 //           }
01308                 //             ::printf( "  %d \n", i);
01309                 //      }
01310                 //       ::printf( " \n sum= %+6.2e\n", sum );
01311 
01312 
01313 
01314 
01315                 // matpoint GaPo = MatPoint3D::GP()+where;
01316 
01317                 weight = rw * sw * tw * RHO * det_of_Jacobian;
01318 
01319                   Mm = Mm + H("ib")*H("kb")*weight;
01320          //  printf("\n +++++++++++++++++++++++++ \n\n");
01321           //Mm.printshort("M");
01322               }
01323           }
01324       }
01325     //M = Mm;
01326     //Mm.printshort("M");
01327     return Mm;
01328   }
01329 
01330 
01332 
01333 tensor TwentySevenNodeBrick::stiffness_matrix(const tensor & K)
01334   {
01335 //    int K_dim[] = {20,3,3,20};
01336 //    tensor K(4,K_dim,0.0);
01337     matrix Kmatrix(81,81,0.0);
01338 
01339     int Ki=0;
01340     int Kj=0;
01341 
01342     for ( int i=1 ; i<=27 ; i++ )
01343       {
01344         for ( int j=1 ; j<=27 ; j++ )
01345           {
01346             for ( int k=1 ; k<=3 ; k++ )
01347               {
01348                 for ( int l=1 ; l<=3 ; l++ )
01349                   {
01350                     Ki = k+3*(i-1);
01351                     Kj = l+3*(j-1);
01352                     //::printf("i=%d k=%d  Ki=%d       j=%d l=%d  Kj=%d\n",i,k,Ki,j,l,Kj);
01353 
01354                     Kmatrix.val( Ki , Kj ) = K.cval(i,k,l,j);
01355                   }
01356               }
01357           }
01358       }
01359     return Kmatrix;
01360   }
01361 
01362 //#############################################################################
01363 
01365 tensor TwentySevenNodeBrick::mass_matrix(const tensor & M)
01366   {
01367     //    int K_dim[] = {20,3,3,20};
01368     //    tensor K(4,K_dim,0.0);
01369     matrix Mmatrix(81,81,0.0);
01370 
01371     for ( int i=1 ; i<=81 ; i++ )
01372       {
01373         for ( int j=1 ; j<=81 ; j++ )
01374           {
01375              Mmatrix.val( i , j ) = M.cval(i,j);
01376              //  ::printf("Mi Mj %d %d %+6.2e ",Mi,Mj,Mmatrix.val( Mi , Mj ) );
01377           }
01378       }
01379     return Mmatrix;
01380   }
01382 
01384 tensor TwentySevenNodeBrick::Jacobian_3D(tensor dh)
01385   {
01386      tensor N_C = Nodal_Coordinates();
01387      tensor Jacobian_3D = dh("ij") * N_C("ik");
01388      return Jacobian_3D;
01389   }
01390 
01391 //#############################################################################
01392 tensor TwentySevenNodeBrick::Jacobian_3Dinv(tensor dh)
01393   {
01394      tensor N_C = Nodal_Coordinates();
01395      tensor Jacobian_3Dinv = (dh("ij") * N_C("ik")).inverse();
01396      return Jacobian_3Dinv;
01397   }
01398 
01399 
01401 tensor TwentySevenNodeBrick::Nodal_Coordinates(void)
01402   {
01403     const int dimensions[] = {27,3};
01404     tensor N_coord(2, dimensions, 0.0);
01405 
01406     //Zhaohui using node pointers, which come from the Domain
01407     const Vector &nd1Crds = theNodes[0]->getCrds();
01408     const Vector &nd2Crds = theNodes[1]->getCrds();
01409     const Vector &nd3Crds = theNodes[2]->getCrds();
01410     const Vector &nd4Crds = theNodes[3]->getCrds();
01411     const Vector &nd5Crds = theNodes[4]->getCrds();
01412     const Vector &nd6Crds = theNodes[5]->getCrds();
01413     const Vector &nd7Crds = theNodes[6]->getCrds();
01414     const Vector &nd8Crds = theNodes[7]->getCrds();
01415 
01416     const Vector &nd9Crds  =  theNodes[8]->getCrds();
01417     const Vector &nd10Crds = theNodes[9]->getCrds();
01418     const Vector &nd11Crds = theNodes[10]->getCrds();
01419     const Vector &nd12Crds = theNodes[11]->getCrds();
01420 
01421     const Vector &nd13Crds = theNodes[12]->getCrds();
01422     const Vector &nd14Crds = theNodes[13]->getCrds();
01423     const Vector &nd15Crds = theNodes[14]->getCrds();
01424     const Vector &nd16Crds = theNodes[15]->getCrds();
01425 
01426 
01427     const Vector &nd17Crds = theNodes[16]->getCrds();
01428     const Vector &nd18Crds = theNodes[17]->getCrds();
01429     const Vector &nd19Crds = theNodes[18]->getCrds();
01430     const Vector &nd20Crds = theNodes[19]->getCrds();
01431 
01432     const Vector &nd21Crds = theNodes[20]->getCrds();
01433     const Vector &nd22Crds = theNodes[21]->getCrds();
01434     const Vector &nd23Crds = theNodes[22]->getCrds();
01435     const Vector &nd24Crds = theNodes[23]->getCrds();
01436     const Vector &nd25Crds = theNodes[24]->getCrds();
01437     const Vector &nd26Crds = theNodes[25]->getCrds();
01438     const Vector &nd27Crds = theNodes[26]->getCrds();
01439 
01440 
01441 
01442     N_coord.val(1,1)=nd1Crds(0); N_coord.val(1,2)=nd1Crds(1); N_coord.val(1,3)=nd1Crds(2);
01443     N_coord.val(2,1)=nd2Crds(0); N_coord.val(2,2)=nd2Crds(1); N_coord.val(2,3)=nd2Crds(2);
01444     N_coord.val(3,1)=nd3Crds(0); N_coord.val(3,2)=nd3Crds(1); N_coord.val(3,3)=nd3Crds(2);
01445     N_coord.val(4,1)=nd4Crds(0); N_coord.val(4,2)=nd4Crds(1); N_coord.val(4,3)=nd4Crds(2);
01446     N_coord.val(5,1)=nd5Crds(0); N_coord.val(5,2)=nd5Crds(1); N_coord.val(5,3)=nd5Crds(2);
01447     N_coord.val(6,1)=nd6Crds(0); N_coord.val(6,2)=nd6Crds(1); N_coord.val(6,3)=nd6Crds(2);
01448     N_coord.val(7,1)=nd7Crds(0); N_coord.val(7,2)=nd7Crds(1); N_coord.val(7,3)=nd7Crds(2);
01449     N_coord.val(8,1)=nd8Crds(0); N_coord.val(8,2)=nd8Crds(1); N_coord.val(8,3)=nd8Crds(2);
01450 
01451     N_coord.val(9 ,1)=nd9Crds(0);  N_coord.val(9 ,2)=nd9Crds(1);  N_coord.val(9 ,3)=nd9Crds(2);
01452     N_coord.val(10,1)=nd10Crds(0); N_coord.val(10,2)=nd10Crds(1); N_coord.val(10,3)=nd10Crds(2);
01453     N_coord.val(11,1)=nd11Crds(0); N_coord.val(11,2)=nd11Crds(1); N_coord.val(11,3)=nd11Crds(2);
01454     N_coord.val(12,1)=nd12Crds(0); N_coord.val(12,2)=nd12Crds(1); N_coord.val(12,3)=nd12Crds(2);
01455 
01456     N_coord.val(13,1)=nd13Crds(0); N_coord.val(13,2)=nd13Crds(1); N_coord.val(13,3)=nd13Crds(2);
01457     N_coord.val(14,1)=nd14Crds(0); N_coord.val(14,2)=nd14Crds(1); N_coord.val(14,3)=nd14Crds(2);
01458     N_coord.val(15,1)=nd15Crds(0); N_coord.val(15,2)=nd15Crds(1); N_coord.val(15,3)=nd15Crds(2);
01459     N_coord.val(16,1)=nd16Crds(0); N_coord.val(16,2)=nd16Crds(1); N_coord.val(16,3)=nd16Crds(2);
01460 
01461     N_coord.val(17,1)=nd17Crds(0); N_coord.val(17,2)=nd17Crds(1); N_coord.val(17,3)=nd17Crds(2);
01462     N_coord.val(18,1)=nd18Crds(0); N_coord.val(18,2)=nd18Crds(1); N_coord.val(18,3)=nd18Crds(2);
01463     N_coord.val(19,1)=nd19Crds(0); N_coord.val(19,2)=nd19Crds(1); N_coord.val(19,3)=nd19Crds(2);
01464     N_coord.val(20,1)=nd20Crds(0); N_coord.val(20,2)=nd20Crds(1); N_coord.val(20,3)=nd20Crds(2);
01465 
01466     N_coord.val(21,1)=nd21Crds(0); N_coord.val(21,2)=nd21Crds(1); N_coord.val(21,3)=nd21Crds(2);
01467     N_coord.val(22,1)=nd22Crds(0); N_coord.val(22,2)=nd22Crds(1); N_coord.val(22,3)=nd22Crds(2);
01468     N_coord.val(23,1)=nd23Crds(0); N_coord.val(23,2)=nd23Crds(1); N_coord.val(23,3)=nd23Crds(2);
01469     N_coord.val(24,1)=nd24Crds(0); N_coord.val(24,2)=nd24Crds(1); N_coord.val(24,3)=nd24Crds(2);
01470     N_coord.val(25,1)=nd25Crds(0); N_coord.val(25,2)=nd25Crds(1); N_coord.val(25,3)=nd25Crds(2);
01471     N_coord.val(26,1)=nd26Crds(0); N_coord.val(26,2)=nd26Crds(1); N_coord.val(26,3)=nd26Crds(2);
01472     N_coord.val(27,1)=nd27Crds(0); N_coord.val(27,2)=nd27Crds(1); N_coord.val(27,3)=nd27Crds(2);
01473 
01474 
01475     return N_coord;
01476 
01477   }
01478 
01480 tensor TwentySevenNodeBrick::incr_disp(void)
01481   {
01482     const int dimensions[] = {27,3};
01483     tensor increment_disp(2, dimensions, 0.0);
01484 
01485     //for ( int i=0 ; i<20 ; i++ )
01486     //
01487     //  {
01488     //    // increment_disp.val(i+1,1) = nodes[ G_N_numbs[i] ].incremental_translation_x();
01489     //    // increment_disp.val(i+1,2) = nodes[ G_N_numbs[i] ].incremental_translation_y();
01490     //    // increment_disp.val(i+1,3) = nodes[ G_N_numbs[i] ].incremental_translation_z();
01491     //
01492     //    increment_disp.val(i+1,1) = IncremenDis(0);
01493     //    increment_disp.val(i+1,2) = IncremenDis(1);
01494     //    increment_disp.val(i+1,3) = IncremenDis(2);
01495     //
01496     //  }
01497 
01498     //Zhaohui using node pointers, which come from the Domain
01499     //const Vector &TotDis1 = theNodes[0]->getTrialDisp();
01500     //const Vector &incrdelDis1 = theNodes[0]->getIncrDisp();
01501     //Have to get IncrDeltaDisp, not IncrDisp for cumulation of incr_disp
01502     const Vector &IncrDis1 = theNodes[0]->getIncrDeltaDisp();
01503     const Vector &IncrDis2 = theNodes[1]->getIncrDeltaDisp();
01504     const Vector &IncrDis3 = theNodes[2]->getIncrDeltaDisp();
01505     const Vector &IncrDis4 = theNodes[3]->getIncrDeltaDisp();
01506     const Vector &IncrDis5 = theNodes[4]->getIncrDeltaDisp();
01507     const Vector &IncrDis6 = theNodes[5]->getIncrDeltaDisp();
01508     const Vector &IncrDis7 = theNodes[6]->getIncrDeltaDisp();
01509     const Vector &IncrDis8 = theNodes[7]->getIncrDeltaDisp();
01510 
01511     const Vector &IncrDis9  = theNodes[8]->getIncrDeltaDisp();
01512     const Vector &IncrDis10 = theNodes[9]->getIncrDeltaDisp();
01513     const Vector &IncrDis11 = theNodes[10]->getIncrDeltaDisp();
01514     const Vector &IncrDis12 = theNodes[11]->getIncrDeltaDisp();
01515 
01516     const Vector &IncrDis13 = theNodes[12]->getIncrDeltaDisp();
01517     const Vector &IncrDis14 = theNodes[13]->getIncrDeltaDisp();
01518     const Vector &IncrDis15 = theNodes[14]->getIncrDeltaDisp();
01519     const Vector &IncrDis16 = theNodes[15]->getIncrDeltaDisp();
01520 
01521     const Vector &IncrDis17 = theNodes[16]->getIncrDeltaDisp();
01522     const Vector &IncrDis18 = theNodes[17]->getIncrDeltaDisp();
01523     const Vector &IncrDis19 = theNodes[18]->getIncrDeltaDisp();
01524     const Vector &IncrDis20 = theNodes[19]->getIncrDeltaDisp();
01525 
01526     const Vector &IncrDis21 = theNodes[20]->getIncrDeltaDisp();
01527     const Vector &IncrDis22 = theNodes[21]->getIncrDeltaDisp();
01528     const Vector &IncrDis23 = theNodes[22]->getIncrDeltaDisp();
01529     const Vector &IncrDis24 = theNodes[23]->getIncrDeltaDisp();
01530     const Vector &IncrDis25 = theNodes[24]->getIncrDeltaDisp();
01531     const Vector &IncrDis26 = theNodes[25]->getIncrDeltaDisp();
01532     const Vector &IncrDis27 = theNodes[26]->getIncrDeltaDisp();
01533 
01534 
01535 
01536     increment_disp.val(1,1)=IncrDis1(0); increment_disp.val(1,2)=IncrDis1(1);increment_disp.val(1,3)=IncrDis1(2);
01537     increment_disp.val(2,1)=IncrDis2(0); increment_disp.val(2,2)=IncrDis2(1);increment_disp.val(2,3)=IncrDis2(2);
01538     increment_disp.val(3,1)=IncrDis3(0); increment_disp.val(3,2)=IncrDis3(1);increment_disp.val(3,3)=IncrDis3(2);
01539     increment_disp.val(4,1)=IncrDis4(0); increment_disp.val(4,2)=IncrDis4(1);increment_disp.val(4,3)=IncrDis4(2);
01540     increment_disp.val(5,1)=IncrDis5(0); increment_disp.val(5,2)=IncrDis5(1);increment_disp.val(5,3)=IncrDis5(2);
01541     increment_disp.val(6,1)=IncrDis6(0); increment_disp.val(6,2)=IncrDis6(1);increment_disp.val(6,3)=IncrDis6(2);
01542     increment_disp.val(7,1)=IncrDis7(0); increment_disp.val(7,2)=IncrDis7(1);increment_disp.val(7,3)=IncrDis7(2);
01543     increment_disp.val(8,1)=IncrDis8(0); increment_disp.val(8,2)=IncrDis8(1);increment_disp.val(8,3)=IncrDis8(2);
01544 
01545     increment_disp.val(9 ,1)=IncrDis9(0);  increment_disp.val(9 ,2)=IncrDis9(1); increment_disp.val(9 ,3)=IncrDis9(2);
01546     increment_disp.val(10,1)=IncrDis10(0); increment_disp.val(10,2)=IncrDis10(1);increment_disp.val(10,3)=IncrDis10(2);
01547     increment_disp.val(11,1)=IncrDis11(0); increment_disp.val(11,2)=IncrDis11(1);increment_disp.val(11,3)=IncrDis11(2);
01548     increment_disp.val(12,1)=IncrDis12(0); increment_disp.val(12,2)=IncrDis12(1);increment_disp.val(12,3)=IncrDis12(2);
01549 
01550     increment_disp.val(13,1)=IncrDis13(0); increment_disp.val(13,2)=IncrDis13(1);increment_disp.val(13,3)=IncrDis13(2);
01551     increment_disp.val(14,1)=IncrDis14(0); increment_disp.val(14,2)=IncrDis14(1);increment_disp.val(14,3)=IncrDis14(2);
01552     increment_disp.val(15,1)=IncrDis15(0); increment_disp.val(15,2)=IncrDis15(1);increment_disp.val(15,3)=IncrDis15(2);
01553     increment_disp.val(16,1)=IncrDis16(0); increment_disp.val(16,2)=IncrDis16(1);increment_disp.val(16,3)=IncrDis16(2);
01554 
01555     increment_disp.val(17,1)=IncrDis17(0); increment_disp.val(17,2)=IncrDis17(1);increment_disp.val(17,3)=IncrDis17(2);
01556     increment_disp.val(18,1)=IncrDis18(0); increment_disp.val(18,2)=IncrDis18(1);increment_disp.val(18,3)=IncrDis18(2);
01557     increment_disp.val(19,1)=IncrDis19(0); increment_disp.val(19,2)=IncrDis19(1);increment_disp.val(19,3)=IncrDis19(2);
01558     increment_disp.val(20,1)=IncrDis20(0); increment_disp.val(20,2)=IncrDis20(1);increment_disp.val(20,3)=IncrDis20(2);
01559 
01560     increment_disp.val(21,1)=IncrDis21(0); increment_disp.val(21,2)=IncrDis21(1);increment_disp.val(21,3)=IncrDis21(2);
01561     increment_disp.val(22,1)=IncrDis22(0); increment_disp.val(22,2)=IncrDis22(1);increment_disp.val(22,3)=IncrDis22(2);
01562     increment_disp.val(23,1)=IncrDis23(0); increment_disp.val(23,2)=IncrDis23(1);increment_disp.val(23,3)=IncrDis23(2);
01563     increment_disp.val(24,1)=IncrDis24(0); increment_disp.val(24,2)=IncrDis24(1);increment_disp.val(24,3)=IncrDis24(2);
01564     increment_disp.val(25,1)=IncrDis25(0); increment_disp.val(25,2)=IncrDis25(1);increment_disp.val(25,3)=IncrDis25(2);
01565     increment_disp.val(26,1)=IncrDis26(0); increment_disp.val(26,2)=IncrDis26(1);increment_disp.val(26,3)=IncrDis26(2);
01566     increment_disp.val(27,1)=IncrDis27(0); increment_disp.val(27,2)=IncrDis27(1);increment_disp.val(27,3)=IncrDis27(2);
01567 
01568 
01569 
01570     return increment_disp;
01571   }
01572 
01574 tensor TwentySevenNodeBrick::total_disp(void)
01575   {
01576     const int dimensions[] = {27,3};
01577     tensor total_disp(2, dimensions, 0.0);
01578 
01579     //Zhaohui using node pointers, which come from the Domain
01580     const Vector &TotDis1 = theNodes[0]->getTrialDisp();
01581     opserr<<"\ntot node " << theNodes[0]->getTag() <<" x "<< TotDis1(0) <<" y "<< TotDis1(1) << " z "<< TotDis1(2) << endln;
01582     const Vector &TotDis2 = theNodes[1]->getTrialDisp();
01583     opserr << "tot node " << theNodes[1]->getTag() << " x " << TotDis2(0) <<" y "<< TotDis2(1) << " z "<< TotDis2(2) << endln;
01584     const Vector &TotDis3 = theNodes[2]->getTrialDisp();
01585     opserr << "tot node " << theNodes[2]->getTag() << " x " << TotDis3(0) <<" y "<< TotDis3(1) << " z "<< TotDis3(2) << endln;
01586     const Vector &TotDis4 = theNodes[3]->getTrialDisp();
01587     opserr << "tot node " << theNodes[3]->getTag() << " x " << TotDis4(0) <<" y "<< TotDis4(1) << " z "<< TotDis4(2) << endln;
01588     const Vector &TotDis5 = theNodes[4]->getTrialDisp();
01589     opserr << "tot node " << theNodes[4]->getTag() << " x " << TotDis5(0) <<" y "<< TotDis5(1) << " z "<< TotDis5(2) << endln;
01590     const Vector &TotDis6 = theNodes[5]->getTrialDisp();
01591     opserr << "tot node " << theNodes[5]->getTag() << " x " << TotDis6(0) <<" y "<< TotDis6(1) << " z "<< TotDis6(2) << endln;
01592     const Vector &TotDis7 = theNodes[6]->getTrialDisp();
01593     opserr << "tot node " << theNodes[6]->getTag() << " x " << TotDis7(0) <<" y "<< TotDis7(1) << " z "<< TotDis7(2) << endln;
01594     const Vector &TotDis8 = theNodes[7]->getTrialDisp();
01595     opserr << "tot node " << theNodes[7]->getTag() << " x " << TotDis8(0) <<" y "<< TotDis8(1) << " z "<< TotDis8(2) << endln;
01596 
01597     const Vector &TotDis9 = theNodes[8]->getTrialDisp();
01598     opserr << "tot node " << theNodes[8]->getTag() << " x " << TotDis9(0) <<" y "<< TotDis9(1) << " z "<< TotDis9(2) << endln;
01599     const Vector &TotDis10 = theNodes[9]->getTrialDisp();
01600     opserr << "tot node " << theNodes[9]->getTag() << " x " << TotDis10(0) <<" y "<< TotDis10(1) << " z "<< TotDis10(2) << endln;
01601     const Vector &TotDis11 = theNodes[10]->getTrialDisp();
01602     opserr << "tot node " << theNodes[10]->getTag() << " x " << TotDis11(0) <<" y "<< TotDis11(1) << " z "<< TotDis11(2) << endln;
01603     const Vector &TotDis12 = theNodes[11]->getTrialDisp();
01604     opserr << "tot node " << theNodes[11]->getTag() << " x " << TotDis12(0) <<" y "<< TotDis12(1) << " z "<< TotDis12(2) << endln;
01605 
01606     const Vector &TotDis13 = theNodes[12]->getTrialDisp();
01607     opserr << "tot node " << theNodes[12]->getTag() << " x " << TotDis13(0) <<" y "<< TotDis13(1) << " z "<< TotDis13(2) << endln;
01608     const Vector &TotDis14 = theNodes[13]->getTrialDisp();
01609     opserr << "tot node " << theNodes[13]->getTag() << " x " << TotDis14(0) <<" y "<< TotDis14(1) << " z "<< TotDis14(2) << endln;
01610     const Vector &TotDis15 = theNodes[14]->getTrialDisp();
01611     opserr << "tot node " << theNodes[14]->getTag() << " x " << TotDis15(0) <<" y "<< TotDis15(1) << " z "<< TotDis15(2) << endln;
01612     const Vector &TotDis16 = theNodes[15]->getTrialDisp();
01613     opserr << "tot node " << theNodes[15]->getTag() << " x " << TotDis16(0) <<" y "<< TotDis16(1) << " z "<< TotDis16(2) << endln;
01614 
01615     const Vector &TotDis17 = theNodes[16]->getTrialDisp();
01616     opserr << "tot node " << theNodes[16]->getTag() << " x " << TotDis17(0) <<" y "<< TotDis17(1) << " z "<< TotDis17(2) << endln;
01617     const Vector &TotDis18 = theNodes[17]->getTrialDisp();
01618     opserr << "tot node " << theNodes[17]->getTag() << " x " << TotDis18(0) <<" y "<< TotDis18(1) << " z "<< TotDis18(2) << endln;
01619     const Vector &TotDis19 = theNodes[18]->getTrialDisp();
01620     opserr << "tot node " << theNodes[18]->getTag() << " x " << TotDis19(0) <<" y "<< TotDis19(1) << " z "<< TotDis19(2) << endln;
01621     const Vector &TotDis20 = theNodes[19]->getTrialDisp();
01622     opserr << "tot node " << theNodes[19]->getTag() << " x " << TotDis20(0) <<" y "<< TotDis20(1) << " z "<< TotDis20(2) << endln;
01623     const Vector &TotDis21 = theNodes[20]->getTrialDisp();
01624     opserr << "tot node " << theNodes[20]->getTag() << " x " << TotDis21(0) <<" y "<< TotDis21(1) << " z "<< TotDis21(2) << endln;
01625     const Vector &TotDis22 = theNodes[21]->getTrialDisp();
01626     opserr << "tot node " << theNodes[21]->getTag() << " x " << TotDis22(0) <<" y "<< TotDis22(1) << " z "<< TotDis22(2) << endln;
01627     const Vector &TotDis23 = theNodes[22]->getTrialDisp();
01628     opserr << "tot node " << theNodes[22]->getTag() << " x " << TotDis23(0) <<" y "<< TotDis23(1) << " z "<< TotDis23(2) << endln;
01629     const Vector &TotDis24 = theNodes[23]->getTrialDisp();
01630     opserr << "tot node " << theNodes[23]->getTag() << " x " << TotDis24(0) <<" y "<< TotDis24(1) << " z "<< TotDis24(2) << endln;
01631     const Vector &TotDis25 = theNodes[24]->getTrialDisp();
01632     opserr << "tot node " << theNodes[24]->getTag() << " x " << TotDis25(0) <<" y "<< TotDis25(1) << " z "<< TotDis25(2) << endln;
01633     const Vector &TotDis26 = theNodes[25]->getTrialDisp();
01634     opserr << "tot node " << theNodes[25]->getTag() << " x " << TotDis26(0) <<" y "<< TotDis26(1) << " z "<< TotDis26(2) << endln;
01635     const Vector &TotDis27 = theNodes[26]->getTrialDisp();
01636     opserr << "tot node " << theNodes[26]->getTag() << " x " << TotDis27(0) <<" y "<< TotDis27(1) << " z "<< TotDis27(2) << endln;
01637 
01638 
01639 
01640 
01641     total_disp.val(1,1)=TotDis1(0); total_disp.val(1,2)=TotDis1(1);total_disp.val(1,3)=TotDis1(2);
01642     total_disp.val(2,1)=TotDis2(0); total_disp.val(2,2)=TotDis2(1);total_disp.val(2,3)=TotDis2(2);
01643     total_disp.val(3,1)=TotDis3(0); total_disp.val(3,2)=TotDis3(1);total_disp.val(3,3)=TotDis3(2);
01644     total_disp.val(4,1)=TotDis4(0); total_disp.val(4,2)=TotDis4(1);total_disp.val(4,3)=TotDis4(2);
01645     total_disp.val(5,1)=TotDis5(0); total_disp.val(5,2)=TotDis5(1);total_disp.val(5,3)=TotDis5(2);
01646     total_disp.val(6,1)=TotDis6(0); total_disp.val(6,2)=TotDis6(1);total_disp.val(6,3)=TotDis6(2);
01647     total_disp.val(7,1)=TotDis7(0); total_disp.val(7,2)=TotDis7(1);total_disp.val(7,3)=TotDis7(2);
01648     total_disp.val(8,1)=TotDis8(0); total_disp.val(8,2)=TotDis8(1);total_disp.val(8,3)=TotDis8(2);
01649 
01650     total_disp.val(9,1)=TotDis9(0); total_disp.val(9,2)=TotDis9(1);total_disp.val(9,3)=TotDis9(2);
01651     total_disp.val(10,1)=TotDis10(0); total_disp.val(10,2)=TotDis10(1);total_disp.val(10,3)=TotDis10(2);
01652     total_disp.val(11,1)=TotDis11(0); total_disp.val(11,2)=TotDis11(1);total_disp.val(11,3)=TotDis11(2);
01653     total_disp.val(12,1)=TotDis12(0); total_disp.val(12,2)=TotDis12(1);total_disp.val(12,3)=TotDis12(2);
01654 
01655     total_disp.val(13,1)=TotDis13(0); total_disp.val(13,2)=TotDis13(1);total_disp.val(13,3)=TotDis13(2);
01656     total_disp.val(14,1)=TotDis14(0); total_disp.val(14,2)=TotDis14(1);total_disp.val(14,3)=TotDis14(2);
01657     total_disp.val(15,1)=TotDis15(0); total_disp.val(15,2)=TotDis15(1);total_disp.val(15,3)=TotDis15(2);
01658     total_disp.val(16,1)=TotDis16(0); total_disp.val(16,2)=TotDis16(1);total_disp.val(16,3)=TotDis16(2);
01659 
01660     total_disp.val(17,1)=TotDis17(0); total_disp.val(17,2)=TotDis17(1);total_disp.val(17,3)=TotDis17(2);
01661     total_disp.val(18,1)=TotDis18(0); total_disp.val(18,2)=TotDis18(1);total_disp.val(18,3)=TotDis18(2);
01662     total_disp.val(19,1)=TotDis19(0); total_disp.val(19,2)=TotDis19(1);total_disp.val(19,3)=TotDis19(2);
01663     total_disp.val(20,1)=TotDis20(0); total_disp.val(20,2)=TotDis20(1);total_disp.val(20,3)=TotDis20(2);
01664 
01665     total_disp.val(21,1)=TotDis21(0); total_disp.val(21,2)=TotDis21(1);total_disp.val(21,3)=TotDis21(2);
01666     total_disp.val(22,1)=TotDis22(0); total_disp.val(22,2)=TotDis22(1);total_disp.val(22,3)=TotDis22(2);
01667     total_disp.val(23,1)=TotDis23(0); total_disp.val(23,2)=TotDis23(1);total_disp.val(23,3)=TotDis23(2);
01668     total_disp.val(24,1)=TotDis24(0); total_disp.val(24,2)=TotDis24(1);total_disp.val(24,3)=TotDis24(2);
01669     total_disp.val(25,1)=TotDis25(0); total_disp.val(25,2)=TotDis25(1);total_disp.val(25,3)=TotDis25(2);
01670     total_disp.val(26,1)=TotDis26(0); total_disp.val(26,2)=TotDis26(1);total_disp.val(26,3)=TotDis26(2);
01671     total_disp.val(27,1)=TotDis27(0); total_disp.val(27,2)=TotDis27(1);total_disp.val(27,3)=TotDis27(2);
01672 
01673 
01674     return total_disp;
01675   }
01676 
01677 
01679 tensor TwentySevenNodeBrick::total_disp(FILE *fp, double * u) //Not implemented yet??? Guanzhou Oct. 2003
01680   {
01681     const int dimensions[] = {27,3};
01682     tensor total_disp(2, dimensions, 0.0);
01683     //    double totalx, totaly, totalz;
01684     //    totalx=0;
01685     //    totaly=0;
01686     //    totalz=0;
01687 
01688     //for ( int i=0 ; i<20 ; i++ )
01689     //
01690     //  {
01691     //    // total_disp.val(i+1,1) = nodes[ G_N_numbs[i] ].total_translation_x(u);
01692     //    // total_disp.val(i+1,2) = nodes[ G_N_numbs[i] ].total_translation_y(u);
01693     //    // total_disp.val(i+1,3) = nodes[ G_N_numbs[i] ].total_translation_z(u);
01694     //    Vector TotalTranDis = nodes[ G_N_numbs[i] ].getDisp();
01695     //
01696     //    total_disp.val(i+1,1) = TotalTranDis(0);
01697     //  total_disp.val(i+1,2) = TotalTranDis(1);
01698     //    total_disp.val(i+1,3) = TotalTranDis(2);
01699     //
01700     //  }
01701 
01702     // Need more work
01703 
01704     //Zhaohui using node pointers, which come from the Domain
01705     const Vector &TotDis1 = theNodes[0]->getTrialDisp();
01706     const Vector &TotDis2 = theNodes[1]->getTrialDisp();
01707     const Vector &TotDis3 = theNodes[2]->getTrialDisp();
01708     const Vector &TotDis4 = theNodes[3]->getTrialDisp();
01709     const Vector &TotDis5 = theNodes[4]->getTrialDisp();
01710     const Vector &TotDis6 = theNodes[5]->getTrialDisp();
01711     const Vector &TotDis7 = theNodes[6]->getTrialDisp();
01712     const Vector &TotDis8 = theNodes[7]->getTrialDisp();
01713 
01714     total_disp.val(1,1)=TotDis1(0); total_disp.val(1,2)=TotDis1(1);total_disp.val(1,3)=TotDis1(2);
01715     total_disp.val(2,1)=TotDis2(0); total_disp.val(2,2)=TotDis2(1);total_disp.val(2,3)=TotDis2(2);
01716     total_disp.val(3,1)=TotDis3(0); total_disp.val(3,2)=TotDis3(1);total_disp.val(3,3)=TotDis3(2);
01717     total_disp.val(4,1)=TotDis4(0); total_disp.val(4,2)=TotDis4(1);total_disp.val(4,3)=TotDis4(2);
01718     total_disp.val(5,1)=TotDis5(0); total_disp.val(5,2)=TotDis5(1);total_disp.val(5,3)=TotDis5(2);
01719     total_disp.val(6,1)=TotDis6(0); total_disp.val(6,2)=TotDis6(1);total_disp.val(6,3)=TotDis6(2);
01720     total_disp.val(7,1)=TotDis7(0); total_disp.val(7,2)=TotDis7(1);total_disp.val(7,3)=TotDis7(2);
01721     total_disp.val(8,1)=TotDis8(0); total_disp.val(8,2)=TotDis8(1);total_disp.val(8,3)=TotDis8(2);
01722 
01723     return total_disp;
01724   }
01725 
01726 
01728 int TwentySevenNodeBrick::get_global_number_of_node(int local_node_number)
01729 {
01730   //return G_N_numbs[local_node_number];
01731   return connectedExternalNodes(local_node_number);
01732 }
01733 
01735 int  TwentySevenNodeBrick::get_Brick_Number(void)
01736 {
01737   //return elem_numb;
01738   return this->getTag();
01739 }
01740 
01742 //int * TwentySevenNodeBrick::get_LM(void)
01743 //  {
01744 //    return 0;
01745 //  }
01746 
01747 //Commented out Zhaohui 09-27-2000
01748 
01750 //void TwentySevenNodeBrick::set_LM(Node * node)
01751 //  {
01756 //    for (int LocalNodeNumber = 1 ; LocalNodeNumber<=8 ; LocalNodeNumber++ )// for 8noded brick
01757 //      {
01759 //        unsigned int global_node_number = this->get_global_number_of_node(LocalNodeNumber-1);
01760 //        LM[3*LocalNodeNumber-3] = node[global_node_number].eqn_tx();
01761 //        LM[3*LocalNodeNumber-2] = node[global_node_number].eqn_ty();
01762 //        LM[3*LocalNodeNumber-1] = node[global_node_number].eqn_tz();
01763 //      }
01764 //
01765 //      // ::printf("\n\n");
01766 //
01772 //
01773 //  }
01774 
01775 
01777 // returns nodal forces for given stress field in an element
01778 tensor TwentySevenNodeBrick::nodal_forces(void)
01779   {
01780     int force_dim[] = {27,3};  // Guanzhou changed for {20,3} to {27,3} for 27 nodes
01781 
01782     tensor nodal_forces(2,force_dim,0.0);
01783 
01784     double r  = 0.0;
01785     double rw = 0.0;
01786     double s  = 0.0;
01787     double sw = 0.0;
01788     double t  = 0.0;
01789     double tw = 0.0;
01790 
01791     short where = 0;
01792     double weight = 0.0;
01793 
01794     int dh_dim[] = {27,3};
01795 
01796     tensor dh(2, dh_dim, 0.0);
01797 
01798     stresstensor stress_at_GP(0.0);
01799 
01800     double det_of_Jacobian = 0.0;
01801 
01802     straintensor incremental_strain;
01803 
01804     static int disp_dim[] = {27,3};
01805     tensor incremental_displacements(2,disp_dim,0.0); // \Delta u
01806 
01807     incremental_displacements = incr_disp();
01808 
01809     tensor Jacobian;
01810     tensor JacobianINV;
01811     tensor dhGlobal;
01812 
01813     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
01814       {
01815         r = get_Gauss_p_c( r_integration_order, GP_c_r );
01816         rw = get_Gauss_p_w( r_integration_order, GP_c_r );
01817 
01818         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
01819           {
01820             s = get_Gauss_p_c( s_integration_order, GP_c_s );
01821             sw = get_Gauss_p_w( s_integration_order, GP_c_s );
01822 
01823             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
01824               {
01825                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
01826                 tw = get_Gauss_p_w( t_integration_order, GP_c_t );
01827 
01828                 // this short routine is supposed to calculate position of
01829                 // Gauss point from 3D array of short's
01830                 where =
01831                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
01832 
01833                 // derivatives of local coordiantes with respect to local coordiantes
01834                 dh = dh_drst_at(r,s,t);
01835 
01836                 // Jacobian tensor ( matrix )
01837                 Jacobian = Jacobian_3D(dh);
01838                 //....                Jacobian.print("J");
01839 
01840                 // Inverse of Jacobian tensor ( matrix )
01841                 JacobianINV = Jacobian_3Dinv(dh);
01842                 //....                JacobianINV.print("JINV");
01843 
01844                 // determinant of Jacobian tensor ( matrix )
01845                 det_of_Jacobian  = Jacobian.determinant();
01846                 //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
01847 
01848                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
01849                 //dhGlobal = dh("ij") * JacobianINV("jk");// Zhaohui 09-02-2001
01850                 dhGlobal = dh("ij") * JacobianINV("kj");
01851 
01852                 //weight
01853                 weight = rw * sw * tw * det_of_Jacobian;
01854                 //..::printf("\n\nIN THE nodal forces ----**************** where = %d \n", where);
01855                 //..::printf("                    GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
01856                 //..                           GP_c_r,GP_c_s,GP_c_t);
01857                 //..::printf("WEIGHT = %f", weight);
01858                 //..::printf("determinant of Jacobian = %f", det_of_Jacobian);
01859                 //..matpoint[where].report("Gauss Point\n");
01860 
01861                 //..   // samo jos odredi ovaj tensor E i to za svaku gauss tacku drugaciji !!!!!!!!!!!!
01862                 //..   ovde negde bi trebalo da se na osnovu inkrementalnih pomeranja
01863                 //..   nadje inkrementalna deformacija ( strain_increment ) pa sa njom dalje:
01864                 //..
01866                 //                incremental_displacements = incr_disp();
01867                 //
01869                 //                incremental_strain =
01870                 //                  (dhGlobal("ib")*incremental_displacements("ia")).symmetrize11();
01871                 //
01872                 //                incremental_strain.null_indices();
01874                 //
01877 
01878                 //..   dakle ovde posalji strain_increment jer se stari stress cuva u okviru svake
01879                 //..   Gauss tacke a samo saljes strain_increment koji ce da se prenese
01880                 //..   u integracionu rutinu pa ce ta da vrati krajnji napon i onda moze da
01881                 //..   se pravi ConstitutiveStiffnessTensor.
01882                 //.. Ustvari posalji sve sto imas ( incremental_strain, start_stress,
01883                 //.. number_of_subincrements . . . u ovu Constitutive_tensor funkciju
01884                 //.. pa ona nek ide, u zavisnosti od modela koji se koristi i neka
01885                 //.. onda tamo u svakoj posebnoj modelskoj funkciji vrati sta treba
01886                 //.. ( recimo Elastic odmah vraca Eelastic a recimo MRS_Lade prvo
01887                 //.. pita koji nacin integracije da koristi pa onda u zvisnosti od toga
01888                 //.. zove funkcuju koja integrali za taj algoritam ( ForwardEuler, BakcwardEuler,
01889                 //.. SemiBackwardEuler, . . . ) i onda kada funkcija vrati napon onda
01890                 //.. se opet pita koji je tip integracije bio u pitanju pa pravi odgovarajuci
01891                 //.. ConstitutiveTensor i vraca ga nazad!
01892 
01893                 //                   stress_at_GP = (GPstress)->operator[](where);
01894                 //stress_at_GP = GPstress[where];
01895 
01896           //EPState *tmp_eps = (matpoint[where]->matmodel)->getEPS();
01897     //stress_at_GP = tmp_eps->getStress();
01898     //opserr << "tmp_eps" << (*tmp_eps);
01899 
01900           //NDMaterial *tmp_ndm = (matpoint[where]).getNDMat();
01901 
01902     //if ( tmp_eps ) {     //Elasto-plastic case
01903 
01904     //stress_at_GP = (matpoint[where].matmodel->getEPS())->getStress();
01905 
01906     //   EPState *tmp_eps = (matpoint[where]->matmodel)->getEPS();
01907     //   stress_at_GP = tmp_eps->getStress();
01908 
01909 
01910 
01911 //out May 5 2004, Guanzhou    incremental_strain =
01912 //out May 5 2004, Guanzhou                     (dhGlobal("ib")*incremental_displacements("ia")).symmetrize11();
01913 //out May 5 2004, Guanzhou//    if (where == 0)
01914 //out May 5 2004, Guanzhou//       //opserr << " In nodal_force delta_incremental_strain tag "<< getTag() <<"  " <<incremental_strain << endln;
01915 //out May 5 2004, Guanzhou////    opserr << " el tag = "<< getTag();
01916 //out May 5 2004, Guanzhou//
01917 //out May 5 2004, Guanzhou    int err = ( matpoint[where]->matmodel )->setTrialStrainIncr( incremental_strain);
01918 //out May 5 2004, Guanzhou    if ( err) {
01919 //out May 5 2004, Guanzhou       //cout << "incr_strn " <<  incremental_strain;
01920 //out May 5 2004, Guanzhou             //cout << "incr_disp " <<  incremental_displacements;
01921 //out May 5 2004, Guanzhou                    opserr << "TwentySevenNodeBrick::nodal_forces (tag: " << this->getTag() << ", not converged\n";
01922 //out May 5 2004, Guanzhou       exit(-1);
01923 //out May 5 2004, Guanzhou    }
01924 
01925     //char *test = matpoint[where]->matmodel->getType();
01926     // fmk - changing if so if into else block must be Template3Dep
01927 //    if (strcmp(matpoint[where]->matmodel->getType(),"Template3Dep") != 0)
01928        stress_at_GP = matpoint[where]->getStressTensor();
01929 
01930 //         stress_at_GP.report("PROBLEM");
01931 //         getchar();
01932 
01933 //    else
01934 //    {
01935 //             //Some thing funny happened when getting stress directly from matpoint[where], i have to do it this way!
01936 //       EPState *tmp_eps = ((Template3Dep *)(matpoint[where]->matmodel))->getEPS();
01937 //       stress_at_GP = tmp_eps->getStress();
01938 //       //delete tmp_eps;
01939 //           }
01940 
01941              //double  p = stress_at_GP.p_hydrostatic();
01942                 //if ( p < 0.0 )
01943           //{
01944           //  opserr << getTag();
01945           //  opserr << " ***p  =    " << p << endln;
01946           //}
01947 
01948     //opserr << " nodal_force ::: stress_at_GP " << stress_at_GP << endln;
01949 
01950     //}
01951     //else if ( tmp_ndm ) { //Elastic case
01952                //    stress_at_GP = (matpoint[where].getNDMat())->getStressTensor();
01953     //}
01954     //else {
01955                  //   g3ErrorHandler->fatal("TwentySevenNodeBrick::nodal_forces (tag: %d), could not getStress", this->getTag());
01956     //   exit(1);
01957     //}
01958 
01959                 //stress_at_GP.report("\n stress_at_GPtensor at GAUSS point for nodal forces \n");
01960 
01961                 // nodal forces See Zienkievicz part 1 pp 108
01962                 nodal_forces =
01963                      nodal_forces + dhGlobal("ib")*stress_at_GP("ab")*weight;
01964                 //nodal_forces.print("nf","\n\n Nodal Forces \n");
01965 
01966               }
01967           }
01968       }
01969 
01970     //opserr << "\n element no. " << getTag() << endln;
01971     //nodal_forces.print("nf","\n Nodal Forces \n");
01972     return nodal_forces;
01973 
01974   }
01975 
01977 // returns nodal forces for given ITERATIVE stress field in an element
01978 tensor TwentySevenNodeBrick::iterative_nodal_forces(void)
01979   {
01980     int force_dim[] = {27,3};
01981 
01982     tensor nodal_forces(2,force_dim,0.0);
01983 
01984     double r  = 0.0;
01985     double rw = 0.0;
01986     double s  = 0.0;
01987     double sw = 0.0;
01988     double t  = 0.0;
01989     double tw = 0.0;
01990 
01991     short where = 0;
01992     double weight = 0.0;
01993 
01994     int dh_dim[] = {27,3};
01995 
01996     tensor dh(2, dh_dim, 0.0);
01997 
01998     stresstensor stress_at_GP(0.0);
01999 
02000     double det_of_Jacobian = 0.0;
02001 
02002     tensor Jacobian;
02003     tensor JacobianINV;
02004     tensor dhGlobal;
02005 
02006     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
02007       {
02008         r = get_Gauss_p_c( r_integration_order, GP_c_r );
02009         rw = get_Gauss_p_w( r_integration_order, GP_c_r );
02010 
02011         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
02012           {
02013             s = get_Gauss_p_c( s_integration_order, GP_c_s );
02014             sw = get_Gauss_p_w( s_integration_order, GP_c_s );
02015 
02016             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
02017               {
02018                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
02019                 tw = get_Gauss_p_w( t_integration_order, GP_c_t );
02020 
02021                 // this short routine is supposed to calculate position of
02022                 // Gauss point from 3D array of short's
02023                 where =
02024                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
02025                 //.....
02026                 //.....::printf("TwentySevenNodeBrick::iterative_nodal_forces(void)  ----**************** where = %d \n", where);
02027                 //.....::printf("UPDATE ");
02028                 //.....::printf("   GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
02029                 //.....                           GP_c_r,GP_c_s,GP_c_t);
02030                 // derivatives of local coordiantes with respect to local coordiantes
02031                 dh = dh_drst_at(r,s,t);
02032 
02033                 // Jacobian tensor ( matrix )
02034                 Jacobian = Jacobian_3D(dh);
02035                 //....                Jacobian.print("J");
02036 
02037                 // Inverse of Jacobian tensor ( matrix )
02038                 JacobianINV = Jacobian_3Dinv(dh);
02039                 //....                JacobianINV.print("JINV");
02040 
02041                 // determinant of Jacobian tensor ( matrix )
02042                 det_of_Jacobian  = Jacobian.determinant();
02043                 //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
02044 
02045                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
02046                 //dhGlobal = dh("ij") * JacobianINV("jk");// Zhaohui 09-02-2001
02047                 dhGlobal = dh("ij") * JacobianINV("kj");
02048 
02049                 //weight
02050                 weight = rw * sw * tw * det_of_Jacobian;
02051 
02052                 //                   stress_at_GP = (GPstress)->operator[](where);
02053                 //stress_at_GP = GPiterative_stress[where];
02054 
02055     //stress_at_GP = ( matpoint[where].getTrialEPS() )->getStress();
02056                 stress_at_GP = matpoint[where]->getStressTensor();
02057                 stress_at_GP.reportshortpqtheta("\n iterative_stress at GAUSS point in iterative_nodal_force\n");
02058 
02059                 // nodal forces See Zienkievicz part 1 pp 108
02060                 nodal_forces =
02061                   nodal_forces + dhGlobal("ib")*stress_at_GP("ab")*weight;
02062                 //nodal_forces.print("nf","\n TwentySevenNodeBrick::iterative_nodal_forces Nodal Forces ~~~~\n");
02063 
02064               }
02065           }
02066       }
02067 
02068 
02069     return nodal_forces;
02070 
02071   }
02072 
02074 // returns nodal forces for given constant stress field in the element
02075 tensor TwentySevenNodeBrick::nodal_forces_from_stress(stresstensor & stress)
02076   {
02077     int force_dim[] = {27,3};
02078 
02079     tensor nodal_forces(2,force_dim,0.0);
02080 
02081     double r  = 0.0;
02082     double rw = 0.0;
02083     double s  = 0.0;
02084     double sw = 0.0;
02085     double t  = 0.0;
02086     double tw = 0.0;
02087 
02088     double weight = 0.0;
02089 
02090     int dh_dim[] = {27,3};
02091 
02092     tensor dh(2, dh_dim, 0.0);
02093 
02094     double det_of_Jacobian = 0.0;
02095 
02096     tensor Jacobian;
02097     tensor JacobianINV;
02098     tensor dhGlobal;
02099 
02100     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
02101       {
02102         r = get_Gauss_p_c( r_integration_order, GP_c_r );
02103         rw = get_Gauss_p_w( r_integration_order, GP_c_r );
02104 
02105         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
02106           {
02107             s = get_Gauss_p_c( s_integration_order, GP_c_s );
02108             sw = get_Gauss_p_w( s_integration_order, GP_c_s );
02109 
02110             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
02111               {
02112                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
02113                 tw = get_Gauss_p_w( t_integration_order, GP_c_t );
02114 
02115                 // this short routine is supposed to calculate position of
02116                 // Gauss point from 3D array of short's
02117                 //--                where =
02118                 //--                ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
02119                 //.....
02120                 //.....::printf("TwentySevenNodeBrick::iterative_nodal_forces(void)  ----**************** where = %d \n", where);
02121                 //.....::printf("UPDATE ");
02122                 //.....::printf("   GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
02123                 //.....                           GP_c_r,GP_c_s,GP_c_t);
02124                 // derivatives of local coordiantes with respect to local coordiantes
02125                 dh = dh_drst_at(r,s,t);
02126 
02127                 // Jacobian tensor ( matrix )
02128                 Jacobian = Jacobian_3D(dh);
02129                 //....                Jacobian.print("J");
02130 
02131                 // Inverse of Jacobian tensor ( matrix )
02132                 JacobianINV = Jacobian_3Dinv(dh);
02133                 //....                JacobianINV.print("JINV");
02134 
02135                 // determinant of Jacobian tensor ( matrix )
02136                 det_of_Jacobian  = Jacobian.determinant();
02137                 //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
02138 
02139                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
02140                 //dhGlobal = dh("ij") * JacobianINV("jk");// Zhaohui 09-02-2001
02141                 dhGlobal = dh("ij") * JacobianINV("kj");
02142 
02143                 //weight
02144                 weight = rw * sw * tw * det_of_Jacobian;
02145 
02146                 //                   stress_at_GP = (GPstress)->operator[](where);
02147                 //                stress_at_GP = GPiterative_stress[where];
02148                 //GPiterative_stress[where].reportshortpqtheta("\n iterative_stress at GAUSS point in iterative_nodal_force\n");
02149 
02150                 // nodal forces See Zienkievicz part 1 pp 108
02151                 nodal_forces =
02152                   nodal_forces + dhGlobal("ib")*stress("ab")*weight;
02153                 //nodal_forces.print("nf","\n TwentySevenNodeBrick::iterative_nodal_forces Nodal Forces ~~~~\n");
02154 
02155               }
02156           }
02157       }
02158 
02159     return nodal_forces;
02160 
02161   }
02162 
02163 
02165 // returns nodal forces for given incremental strain field in an element
02166 // by using the linearized constitutive tensor from the begining of the step !
02167 tensor TwentySevenNodeBrick::linearized_nodal_forces(void)
02168   {
02169     int force_dim[] = {27,3};
02170 
02171     tensor linearized_nodal_forces(2,force_dim,0.0);
02172 
02173     double r  = 0.0;
02174     double rw = 0.0;
02175     double s  = 0.0;
02176     double sw = 0.0;
02177     double t  = 0.0;
02178     double tw = 0.0;
02179 
02180     short where = 0;
02181     double weight = 0.0;
02182 
02183     int dh_dim[] = {27,3};
02184 
02185     tensor dh(2, dh_dim, 0.0);
02186 
02187     tensor Constitutive( 4, def_dim_4, 0.0);
02188 
02189     double det_of_Jacobian = 0.0;
02190 
02191     static int disp_dim[] = {27,3};
02192 
02193     tensor incremental_displacements(2,disp_dim,0.0);
02194 
02195     straintensor incremental_strain;
02196 
02197     tensor Jacobian;
02198     tensor JacobianINV;
02199     tensor dhGlobal;
02200 
02201     stresstensor final_linearized_stress;
02202     //    stresstensor incremental_stress;
02203     // tensor of incremental displacements taken from node objects for this element !
02204     incremental_displacements = incr_disp();
02205     //incremental_displacements.print("disp","\n incremental_displacements tensor at GAUSS point in iterative_Update\n");
02206 
02207     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
02208       {
02209         r = get_Gauss_p_c( r_integration_order, GP_c_r );
02210         rw = get_Gauss_p_w( r_integration_order, GP_c_r );
02211 
02212         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
02213           {
02214             s = get_Gauss_p_c( s_integration_order, GP_c_s );
02215             sw = get_Gauss_p_w( s_integration_order, GP_c_s );
02216 
02217             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
02218               {
02219                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
02220                 tw = get_Gauss_p_w( t_integration_order, GP_c_t );
02221 
02222                 // this short routine is supposed to calculate position of
02223                 // Gauss point from 3D array of short's
02224                 where =
02225                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
02226 
02227                 // derivatives of local coordiantes with respect to local coordiantes
02228                 dh = dh_drst_at(r,s,t);
02229 
02230                 // Jacobian tensor ( matrix )
02231                 Jacobian = Jacobian_3D(dh);
02232                 //....                Jacobian.print("J");
02233 
02234                 // Inverse of Jacobian tensor ( matrix )
02235                 JacobianINV = Jacobian_3Dinv(dh);
02236                 //....                JacobianINV.print("JINV");
02237 
02238                 // determinant of Jacobian tensor ( matrix )
02239                 det_of_Jacobian  = Jacobian.determinant();
02240                 //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
02241 
02242                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
02243                 //dhGlobal = dh("ij") * JacobianINV("jk");// Zhaohui 09-02-2001
02244           dhGlobal = dh("ij") * JacobianINV("kj");
02245 
02246                 //weight
02247                 weight = rw * sw * tw * det_of_Jacobian;
02248                 //..::printf("\n\nIN THE nodal forces ----**************** where = %d \n", where);
02249                 //..::printf("                    GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
02250                 //..                           GP_c_r,GP_c_s,GP_c_t);
02251                 //..::printf("WEIGHT = %f", weight);
02252                 //..::printf("determinant of Jacobian = %f", det_of_Jacobian);
02253                 // incremental straines at this Gauss point
02254                 // now in Update we know the incremental displacements so let's find
02255                 // the incremental strain
02256                 incremental_strain =
02257                  (dhGlobal("ib")*incremental_displacements("ia")).symmetrize11();
02258                 incremental_strain.null_indices();
02259                 //incremental_strain.reportshort("\n incremental_strain tensor at GAUSS point in iterative_Update\n");
02260 
02261                 //Constitutive = GPtangent_E[where];
02262 
02263           //EPState *tmp_eps = (matpoint[where]).getEPS();
02264           //NDMaterial *tmp_ndm = (matpoint[where]).getNDMat();
02265 
02266     //if ( tmp_eps ) {     //Elasto-plastic case
02267     //    mmodel->setEPS( *tmp_eps );
02268     if ( ! (matpoint[where]->matmodel)->setTrialStrainIncr( incremental_strain)  )
02269       opserr << "TwentySevenNodeBrick::linearized_nodal_forces (tag: " << this->getTag() << "), not converged\n";
02270 
02271     Constitutive = (matpoint[where]->matmodel)->getTangentTensor();
02272           //    matpoint[where].setEPS( mmodel->getEPS() ); //Set the new EPState back
02273     //}
02274     //else if ( tmp_ndm ) { //Elastic case
02275     //    (matpoint[where].p_matmodel)->setTrialStrainIncr( incremental_strain );
02276     //    Constitutive = (matpoint[where].p_matmodel)->getTangentTensor();
02277     //}
02278     //else {
02279                  //   g3ErrorHandler->fatal("TwentySevenNodeBrick::incremental_Update (tag: %d), could not getTangentTensor", this->getTag());
02280     //   exit(1);
02281     //}
02282 
02283     //Constitutive = ( matpoint[where].getEPS() )->getEep();
02284                 //..//GPtangent_E[where].print("\n tangent E at GAUSS point \n");
02285 
02286                 final_linearized_stress =
02287                   Constitutive("ijkl") * incremental_strain("kl");
02288 
02289                 // nodal forces See Zienkievicz part 1 pp 108
02290                 linearized_nodal_forces = linearized_nodal_forces +
02291                           dhGlobal("ib")*final_linearized_stress("ab")*weight;
02292                 //::::::                   nodal_forces.print("nf","\n\n Nodal Forces \n");
02293 
02294               }
02295           }
02296       }
02297 
02298 
02299     return linearized_nodal_forces;
02300 
02301   }
02302 
02303 //....////#############################################################################
02304 //....// updates Gauss point stresses and strains from given displacements
02305 //....void TwentySevenNodeBrick::update_stress_strain(tensor & displacementsT)
02306 //....  {
02307 //....//    int force_dim[] = {20,3};
02308 //....//    tensor nodal_forces(2,force_dim,0.0);
02309 //....
02310 //....    double r  = 0.0;
02311 //....    double rw = 0.0;
02312 //....    double s  = 0.0;
02313 //....    double sw = 0.0;
02314 //....    double t  = 0.0;
02315 //....    double tw = 0.0;
02316 //....
02317 //....    short where = 0;
02318 //....    double weight = 0.0;
02319 //....
02320 //....    int dh_dim[] = {20,3};
02321 //....    tensor dh(2, dh_dim, 0.0);
02322 //....
02323 //....    stresstensor stress_at_GP(0.0);
02324 //....    straintensor strain_at_GP(0.0);
02325 //....
02326 //....    double det_of_Jacobian = 0.0;
02327 //....
02328 //....    tensor Jacobian;
02329 //....    tensor JacobianINV;
02330 //....    tensor dhGlobal;
02331 //....
02332 //....    for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
02333 //....      {
02334 //....        r = get_Gauss_p_c( r_integration_order, GP_c_r );
02335 //....        rw = get_Gauss_p_w( r_integration_order, GP_c_r );
02336 //....
02337 //....        for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
02338 //....          {
02339 //....            s = get_Gauss_p_c( s_integration_order, GP_c_s );
02340 //....            sw = get_Gauss_p_w( s_integration_order, GP_c_s );
02341 //....
02342 //....            for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
02343 //....              {
02344 //....                t = get_Gauss_p_c( t_integration_order, GP_c_t );
02345 //....                tw = get_Gauss_p_w( t_integration_order, GP_c_t );
02346 //....
02347 //....// this short routine is supposed to calculate position of
02348 //....// Gauss point from 3D array of short's
02349 //....                where =
02350 //....                ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
02351 //....
02352 //....//........................................................
02353 //....//........................................................
02354 //....// interpolation functions
02355 //....                tensor h = b3darray[0].interp_poli_at(r,s,t);
02356 //....                ::printf("\n\n r = %f, s = %f, t = %f\n", r, s, t);
02357 //....//  h.print("h");
02358 //....
02359 //....// displacements
02360 //....//....   tensor disp_at_rst = h("i")*displacementsT("ia");
02361 //....//....   disp_at_rst.print("disp");
02362 //....
02363 //....// derivatives of interpolation functions
02364 //....                dh = dh_drst_at(r,s,t);
02365 //....//                ::printf("\n\n r = %f, s = %f, t = %f\n", r, s, t);
02366 //....//  dh.print("dh");
02367 //....
02368 //....                Jacobian = b3darray[0].Jacobian_3D(dh);
02369 //....//                Jacobian.print("J");
02370 //....
02371 //....                JacobianINV = b3darray[0].Jacobian_3Dinv(dh);
02372 //....//                JacobianINV.print("JINV");
02373 //....
02374 //....//                det_of_Jacobian = Jacobian.determinant();
02375 //....//                ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
02376 //....
02377 //....// Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
02378 //....                dhGlobal = dh("ij") * JacobianINV("jk");
02379 //....// straines
02380 //....//  strain = (dh("ib")*displacements("ia")).symmetrize11();
02381 //....                strain = (dhGlobal("ib")*displacementsT("ia")).symmetrize11();
02382 //....//  straintensor strain = dh("ib")*displacements("ia");
02383 //....                strain.reportshort("\n strain tensor\n");
02384 //....                strain.null_indices();
02385 //....
02386 //....//                tensor E = mmElastic.ElasticStiffness();
02387 //....
02388 //....//stresses
02389 //....                stress = E("ijkl") * strain("kl");
02390 //....                stress.reportshort("\n\n stress tensor \n");
02391 //....//...
02392 //....//........................................................
02393 //....//........................................................
02394 //....//........................................................
02395 //....//........................................................
02396 //....//........................................................
02397 //....//........................................................
02398 //....//........................................................
02399 //....
02400 //....
02401 //....              }
02402 //....          }
02403 //....      }
02404 //....
02405 //....  }
02406 
02409 //double TwentySevenNodeBrick::get_first_q_ast(void)
02410 //  {
02411 //    double ret = matpoint[0].kappa_cone_get();
02412 //
02413 //    return ret;
02414 //
02415 //  }
02417 //double TwentySevenNodeBrick::get_first_etacone(void)
02418 //  {
02419 //    double ret = matpoint[0].etacone();
02420 //
02421 //    return ret;
02422 //
02423 //  }
02424 //
02425 
02426 //#############################################################################
02427 void TwentySevenNodeBrick::report(char * msg)
02428   {
02429     if ( msg ) ::printf("** %s",msg);
02430     ::printf("\n Element Number = %d\n", this->getTag() );
02431     ::printf("\n Number of nodes in a TwentySevenNodebrick = %d\n",
02432                                               nodes_in_brick);
02433     ::printf("\n Determinant of Jacobian (! ==0 before comp.) = %f\n",
02434                                                   determinant_of_Jacobian);
02435 
02436     ::printf("Node numbers \n");
02437     ::printf(".....1.....2.....3.....4.....5.....6.....7.....8.....9.....0.....1.....2\n");
02438            for ( int i=0 ; i<27 ; i++ )
02439       //::printf("%6d",G_N_numbs[i]);
02440       ::printf("%6d",connectedExternalNodes(i));
02441     ::printf("\n");
02442     //           for ( int j=8 ; j<20 ; j++ )
02443     //             ::printf("%6d",G_N_numbs[j]);     // Commented by Xiaoyan
02444     ::printf("\n\n");
02445 
02446     //    ::printf("Node existance array \n");
02447     //           for ( int k=0 ; k<15 ; k++ )
02448     //             ::printf("%6d",node_existance[k]);
02449     //           ::printf("\n\n");          // Commented by Xiaoyan
02450 
02451 
02452     int total_number_of_Gauss_points = r_integration_order*
02453                                        s_integration_order*
02454                                        t_integration_order;
02455     if ( total_number_of_Gauss_points != 0 )
02456       {
02457            // report from Node class
02458            //for ( int in=0 ; in<8 ; in++ )
02459            //             (nodes[G_N_numbs[in]]).report("nodes from within element (first 8)\n");
02460            //Xiaoyan changed .report to . Print in above line 09/27/00
02461      //  (nodes[G_N_numbs[in]]).Print(opserr);
02462 
02463      theNodes[0]->Print(opserr);
02464      theNodes[1]->Print(opserr);
02465      theNodes[2]->Print(opserr);
02466      theNodes[3]->Print(opserr);
02467      theNodes[4]->Print(opserr);
02468      theNodes[5]->Print(opserr);
02469            theNodes[6]->Print(opserr);
02470      theNodes[7]->Print(opserr);
02471      theNodes[8]->Print(opserr);
02472      theNodes[9]->Print(opserr);
02473      theNodes[10]->Print(opserr);
02474       theNodes[11]->Print(opserr);
02475       theNodes[12]->Print(opserr);
02476      theNodes[13]->Print(opserr);
02477      theNodes[14]->Print(opserr);
02478      theNodes[15]->Print(opserr);
02479      theNodes[16]->Print(opserr);
02480      theNodes[17]->Print(opserr);
02481      theNodes[18]->Print(opserr);
02482      theNodes[19]->Print(opserr);
02483      theNodes[20]->Print(opserr);
02484      theNodes[21]->Print(opserr);
02485      theNodes[22]->Print(opserr);
02486      theNodes[23]->Print(opserr);
02487      theNodes[24]->Print(opserr);
02488      theNodes[25]->Print(opserr);
02489      theNodes[26]->Print(opserr);
02490 
02491 
02492 
02493 
02494      //           for ( int jn=8 ; jn<20 ; jn++ )
02495            //             (nodes[G_N_numbs[jn]]).report("nodes from within element (last 15)\n");
02496            // Commented by Xiaoyan
02497       }
02498 
02499     ::printf("\n\nGauss-Legendre integration order\n");
02500     ::printf("Integration order in r direction = %d\n",r_integration_order);
02501     ::printf("Integration order in s direction = %d\n",s_integration_order);
02502     ::printf("Integration order in t direction = %d\n\n",t_integration_order);
02503 
02504 
02505 
02506     for( int GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
02507       {
02508         for( int GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
02509           {
02510             for( int GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
02511               {
02512                 // this short routine is supposed to calculate position of
02513                 // Gauss point from 3D array of short's
02514                 short where =
02515                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
02516 
02517                 ::printf("\n\n----------------**************** where = %d \n", where);
02518                 ::printf("                    GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
02519                             GP_c_r,GP_c_s,GP_c_t);
02520                 matpoint[where]->report("Material Point\n");
02521                 //GPstress[where].reportshort("stress at Gauss Point");
02522                 //GPstrain[where].reportshort("strain at Gauss Point");
02523                 //matpoint[where].report("Material model  at Gauss Point");
02524               }
02525           }
02526       }
02527 
02528   }
02529 
02530 
02531 //#############################################################################
02532 void TwentySevenNodeBrick::reportshort(char * msg)
02533   {
02534     if ( msg ) ::printf("** %s",msg);
02535     ::printf("\n Element Number = %d\n", this->getTag() );
02536     ::printf("\n Number of nodes in a TwentySevenNodeBrick = %d\n",
02537                                               nodes_in_brick);
02538     ::printf("\n Determinant of Jacobian (! ==0 before comp.) = %f\n",
02539                                                   determinant_of_Jacobian);
02540 
02541     ::printf("Node numbers \n");
02542     ::printf(".....1.....2.....3.....4.....5.....6.....7.....8.....9.....0.....1.....2\n");
02543            for ( int i=0 ; i<nodes_in_brick ; i++ )
02544              //::printf("%6d",G_N_numbs[i]);
02545              ::printf( "%6d",connectedExternalNodes(i) );
02546 
02547      ::printf("\n");
02548            //           for ( int j=8 ; j<20 ; j++ )
02549            //             ::printf("%6d",G_N_numbs[j]);   //// Commented by Xiaoyan
02550            ::printf("\n\n");
02551 
02552            //    ::printf("Node existance array \n");
02553            //           for ( int k=0 ; k<15 ; k++ )
02554            //             ::printf("%6d",node_existance[k]);     // Commented by Xiaoyan
02555            ::printf("\n\n");
02556 
02557   }
02558 
02559 
02560 
02561 
02562 //#############################################################################
02563 void TwentySevenNodeBrick::reportPAK(char * msg)
02564   {
02565     if ( msg ) ::printf("%s",msg);
02566     ::printf("%10d   ",  this->getTag());
02567     for ( int i=0 ; i<nodes_in_brick ; i++ )
02568        ::printf( "%6d",connectedExternalNodes(i) );
02569        //::printf("%6d",G_N_numbs[i]);
02570 
02571     printf("\n");
02572   }
02573 
02574 
02575 //#############################################################################
02576 void TwentySevenNodeBrick::reportpqtheta(int GP_numb)
02577   {
02578     short where = GP_numb-1;
02579     matpoint[where]->reportpqtheta("");
02580   }
02581 
02582 //#############################################################################
02583 //void TwentySevenNodeBrick::reportLM(char * msg)
02584 //  {
02585 //    if ( msg ) ::printf("%s",msg);
02586 //    ::printf("Element # %d, LM->", this->get_Brick_Number());
02587 //    for (int count = 0 ; count < 24 ; count++)
02588 //      {
02589 //        ::printf(" %d", LM[count]);
02590 //      }
02591 //    ::printf("\n");
02592 //
02593 //  }
02594 
02595 //#############################################################################
02596 //Compute Gauss Point coordinates and store it in global GaussCoord
02597 void TwentySevenNodeBrick::computeGaussPoint(void)
02598 {
02599     //    if ( msg ) ::printf("** %s\n",msg);
02600 
02601     // special case for 8 nodes only
02602     // special case for 8 nodes only
02603     int count;
02604     count = FixedOrder*FixedOrder*FixedOrder;
02605     //Vector GaussCoord(count*3+1); //+1: number of Gauss point in element
02606     GaussCoord(0) = count;
02607 
02608     double r  = 0.0;
02609     double s  = 0.0;
02610     double t  = 0.0;
02611 
02612     short where = 0;
02613 
02614     // special case for 8 nodes only
02615     static const int dim[] = {3, 27}; // static-> see ARM pp289-290
02616     static const int dim27[] = {3, count}; // static-> see ARM pp289-290 Joey found a bug: dimension count is integr. points dependent
02617     tensor NodalCoord(2, dim, 0.0);
02618     tensor matpointCoord(2, dim27, 0.0);
02619     int h_dim[] = {81,3};
02620     tensor H(2, h_dim, 0.0);
02621 
02622     //for (int ncount = 1 ; ncount <= 8 ; ncount++ )
02624     //  {
02625     //  //int global_node_number = get_global_number_of_node(ncount-1);
02626     //  // printf("global node num %d",global_node_number);
02627     //
02628     //    //   NodalCoord.val(1,ncount) = nodes[global_node_number].x_coordinate();
02629     //    //   NodalCoord.val(2,ncount) = nodes[global_node_number].y_coordinate();
02630     //    //   NodalCoord.val(3,ncount) = nodes[global_node_number].z_coordinate();
02631     //    // Xiaoyan changed to the following:  09/27/00
02632     //  Vector Coordinates = nodes[global_node_number].getCrds();
02633     //
02634     //    NodalCoord.val(1,ncount) = Coordinates(0);
02635     //    NodalCoord.val(2,ncount) = Coordinates(1);
02636     //    NodalCoord.val(3,ncount) = Coordinates(2);
02637     //printf("global point %d     x=%+.6e   y=%+.6e   z=%+.6e \n ", global_node_number,
02638     //                                                      NodalCoord.val(1,ncount),
02639     //                  NodalCoord.val(2,ncount),
02640     //                  NodalCoord.val(3,ncount));
02641     //}
02642 
02643     //Zhaohui using node pointers, which come from the Domain
02644     const Vector &nd1Crds = theNodes[0]->getCrds();
02645     const Vector &nd2Crds = theNodes[1]->getCrds();
02646     const Vector &nd3Crds = theNodes[2]->getCrds();
02647     const Vector &nd4Crds = theNodes[3]->getCrds();
02648 
02649     const Vector &nd5Crds = theNodes[4]->getCrds();
02650     const Vector &nd6Crds = theNodes[5]->getCrds();
02651     const Vector &nd7Crds = theNodes[6]->getCrds();
02652     const Vector &nd8Crds = theNodes[7]->getCrds();
02653 
02654     const Vector &nd9Crds  = theNodes[8]->getCrds();
02655     const Vector &nd10Crds = theNodes[9]->getCrds();
02656     const Vector &nd11Crds = theNodes[10]->getCrds();
02657     const Vector &nd12Crds = theNodes[11]->getCrds();
02658 
02659     const Vector &nd13Crds = theNodes[12]->getCrds();
02660     const Vector &nd14Crds = theNodes[13]->getCrds();
02661     const Vector &nd15Crds = theNodes[14]->getCrds();
02662     const Vector &nd16Crds = theNodes[15]->getCrds();
02663 
02664     const Vector &nd17Crds = theNodes[16]->getCrds();
02665     const Vector &nd18Crds = theNodes[17]->getCrds();
02666     const Vector &nd19Crds = theNodes[18]->getCrds();
02667     const Vector &nd20Crds = theNodes[19]->getCrds();
02668 
02669     const Vector &nd21Crds = theNodes[20]->getCrds();
02670     const Vector &nd22Crds = theNodes[21]->getCrds();
02671     const Vector &nd23Crds = theNodes[22]->getCrds();
02672     const Vector &nd24Crds = theNodes[23]->getCrds();
02673     const Vector &nd25Crds = theNodes[24]->getCrds();
02674     const Vector &nd26Crds = theNodes[25]->getCrds();
02675     const Vector &nd27Crds = theNodes[26]->getCrds();
02676 
02677 
02678 
02679     NodalCoord.val(1, 1)=nd1Crds( 0); NodalCoord.val(2, 1)=nd1Crds( 1); NodalCoord.val(3, 1)=nd1Crds( 2);
02680     NodalCoord.val(1, 2)=nd2Crds( 0); NodalCoord.val(2, 2)=nd2Crds( 1); NodalCoord.val(3, 2)=nd2Crds( 2);
02681     NodalCoord.val(1, 3)=nd3Crds( 0); NodalCoord.val(2, 3)=nd3Crds( 1); NodalCoord.val(3, 3)=nd3Crds( 2);
02682     NodalCoord.val(1, 4)=nd4Crds( 0); NodalCoord.val(2, 4)=nd4Crds( 1); NodalCoord.val(3, 4)=nd4Crds( 2);
02683     NodalCoord.val(1, 5)=nd5Crds( 0); NodalCoord.val(2, 5)=nd5Crds( 1); NodalCoord.val(3, 5)=nd5Crds( 2);
02684     NodalCoord.val(1, 6)=nd6Crds( 0); NodalCoord.val(2, 6)=nd6Crds( 1); NodalCoord.val(3, 6)=nd6Crds( 2);
02685     NodalCoord.val(1, 7)=nd7Crds( 0); NodalCoord.val(2, 7)=nd7Crds( 1); NodalCoord.val(3, 7)=nd7Crds( 2);
02686     NodalCoord.val(1, 8)=nd8Crds( 0); NodalCoord.val(2, 8)=nd8Crds( 1); NodalCoord.val(3, 8)=nd8Crds( 2);
02687     NodalCoord.val(1, 9)=nd9Crds( 0); NodalCoord.val(2, 9)=nd9Crds( 1); NodalCoord.val(3, 9)=nd9Crds( 2);
02688     NodalCoord.val(1,10)=nd10Crds(0); NodalCoord.val(2,10)=nd10Crds(1); NodalCoord.val(3,10)=nd10Crds(2);
02689     NodalCoord.val(1,11)=nd11Crds(0); NodalCoord.val(2,11)=nd11Crds(1); NodalCoord.val(3,11)=nd11Crds(2);
02690     NodalCoord.val(1,12)=nd12Crds(0); NodalCoord.val(2,12)=nd12Crds(1); NodalCoord.val(3,12)=nd12Crds(2);
02691     NodalCoord.val(1,13)=nd13Crds(0); NodalCoord.val(2,13)=nd13Crds(1); NodalCoord.val(3,13)=nd13Crds(2);
02692     NodalCoord.val(1,14)=nd14Crds(0); NodalCoord.val(2,14)=nd14Crds(1); NodalCoord.val(3,14)=nd14Crds(2);
02693     NodalCoord.val(1,15)=nd15Crds(0); NodalCoord.val(2,15)=nd15Crds(1); NodalCoord.val(3,15)=nd15Crds(2);
02694     NodalCoord.val(1,16)=nd16Crds(0); NodalCoord.val(2,16)=nd16Crds(1); NodalCoord.val(3,16)=nd16Crds(2);
02695     NodalCoord.val(1,17)=nd17Crds(0); NodalCoord.val(2,17)=nd17Crds(1); NodalCoord.val(3,17)=nd17Crds(2);
02696     NodalCoord.val(1,18)=nd18Crds(0); NodalCoord.val(2,18)=nd18Crds(1); NodalCoord.val(3,18)=nd18Crds(2);
02697     NodalCoord.val(1,19)=nd19Crds(0); NodalCoord.val(2,19)=nd19Crds(1); NodalCoord.val(3,19)=nd19Crds(2);
02698     NodalCoord.val(1,20)=nd20Crds(0); NodalCoord.val(2,20)=nd20Crds(1); NodalCoord.val(3,20)=nd20Crds(2);
02699     NodalCoord.val(1,21)=nd21Crds(0); NodalCoord.val(2,21)=nd21Crds(1); NodalCoord.val(3,21)=nd21Crds(2);
02700     NodalCoord.val(1,22)=nd22Crds(0); NodalCoord.val(2,22)=nd22Crds(1); NodalCoord.val(3,22)=nd22Crds(2);
02701     NodalCoord.val(1,23)=nd23Crds(0); NodalCoord.val(2,23)=nd23Crds(1); NodalCoord.val(3,23)=nd23Crds(2);
02702     NodalCoord.val(1,24)=nd24Crds(0); NodalCoord.val(2,24)=nd24Crds(1); NodalCoord.val(3,24)=nd24Crds(2);
02703     NodalCoord.val(1,25)=nd25Crds(0); NodalCoord.val(2,25)=nd25Crds(1); NodalCoord.val(3,25)=nd25Crds(2);
02704     NodalCoord.val(1,26)=nd26Crds(0); NodalCoord.val(2,26)=nd26Crds(1); NodalCoord.val(3,26)=nd26Crds(2);
02705     NodalCoord.val(1,27)=nd27Crds(0); NodalCoord.val(2,27)=nd27Crds(1); NodalCoord.val(3,27)=nd27Crds(2);
02706 
02707     //NodalCoord.print("NC");
02708 
02709     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
02710       {
02711         r = get_Gauss_p_c( r_integration_order, GP_c_r );
02712         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
02713           {
02714             s = get_Gauss_p_c( s_integration_order, GP_c_s );
02715             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
02716               {
02717                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
02718                 // this short routine is supposed to calculate position of
02719                 // Gauss point from 3D array of short's
02720                 where =
02721                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
02722                 // derivatives of local coordinates with respect to local coordinates
02723 
02724                H = H_3D(r,s,t);
02725          //H.print("H");
02726 
02727           for (int encount=1 ; encount <= nodes_in_brick; encount++ )
02728                //         for (int encount=0 ; encount <= 7 ; encount++ )
02729          {
02730                   //  matpointCoord.val(1,where+1) =+NodalCoord.val(1,where+1) * H.val(encount*3-2,1);
02731                   //  matpointCoord.val(2,where+1) =+NodalCoord.val(2,where+1) * H.val(encount*3-1,2);
02732                   //  matpointCoord.val(3,where+1) =+NodalCoord.val(3,where+1) * H.val(encount*3-0,3);
02733                   matpointCoord.val(1,where+1) +=NodalCoord.val(1,encount) * H.val(encount*3-2,1);
02734                   //::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) );
02735                   matpointCoord.val(2,where+1) +=NodalCoord.val(2,encount) * H.val(encount*3-1,2);
02736                   matpointCoord.val(3,where+1) +=NodalCoord.val(3,encount) * H.val(encount*3-0,3);
02737          }
02738 
02739                //::printf("gauss point# %d   %+.6e %+.6e %+.6e \n", where+1,
02740                //                               matpointCoord.val(1,where+1),
02741                //                               matpointCoord.val(2,where+1),
02742                //                               matpointCoord.val(3,where+1));
02743 
02744          GaussCoord(where*3+1) = matpointCoord.val(1,where+1);
02745          GaussCoord(where*3+2) = matpointCoord.val(2,where+1);
02746          GaussCoord(where*3+3) = matpointCoord.val(3,where+1);
02747 
02748 
02749               }
02750           }
02751       }
02752       //return GaussCoord;
02753 
02754  }
02755 
02756 
02758 
02759 //#############################################################################
02760 //void TwentySevenNodeBrick::reportTensor(char * msg)
02761 // ZHaohui added to print gauss point coord. to file fp
02762 
02763 void TwentySevenNodeBrick::reportTensorF(FILE * fp)
02764   {
02765     //if ( msg ) ::printf("** %s\n",msg);
02766 
02767     // special case for 8 nodes only
02768     // special case for 8 nodes only
02769     double r  = 0.0;
02770     double s  = 0.0;
02771     double t  = 0.0;
02772 
02773     short where = 0;
02774 
02775     // special case for 8 nodes only
02776     static const int dim[] = {3, 27}; // static-> see ARM pp289-290
02777     tensor NodalCoord(2, dim, 0.0);
02778     tensor matpointCoord(2, dim, 0.0);
02779     int h_dim[] = {81,3};  // Guanzhou changed from {60,3} to {81,3} for 27 nodes
02780 
02781     tensor H(2, h_dim, 0.0);
02782 
02783     //for (int ncount = 1 ; ncount <= 8 ; ncount++ )
02784     //  // for (int ncount = 0 ; ncount <= 7 ; ncount++ )
02785     //  {
02786     //  int global_node_number = get_global_number_of_node(ncount-1);
02787     //  // printf("global node num %d",global_node_number);
02788     //
02789     //    //        NodalCoord.val(1,ncount) = nodes[global_node_number].x_coordinate();
02790     //    //        NodalCoord.val(2,ncount) = nodes[global_node_number].y_coordinate();
02791     //    //        NodalCoord.val(3,ncount) = nodes[global_node_number].z_coordinate();
02792     //    // Xiaoyan changed to the following:  09/27/00
02793     //  Vector Coordinates = nodes[global_node_number].getCrds();
02794     //    NodalCoord.val(1,ncount) = Coordinates(0);
02795     //    NodalCoord.val(2,ncount) = Coordinates(1);
02796     //    NodalCoord.val(3,ncount) = Coordinates(2);
02797     //printf("global point %d     x=%+.6e   y=%+.6e   z=%+.6e \n ", global_node_number,
02798     //                                                      NodalCoord.val(1,ncount),
02799     //                  NodalCoord.val(2,ncount),
02800     //                  NodalCoord.val(3,ncount));
02801     //  }
02802 
02803     //Zhaohui using node pointers, which come from the Domain
02804     const Vector &nd1Crds = theNodes[0]->getCrds();
02805     const Vector &nd2Crds = theNodes[1]->getCrds();
02806     const Vector &nd3Crds = theNodes[2]->getCrds();
02807     const Vector &nd4Crds = theNodes[3]->getCrds();
02808     const Vector &nd5Crds = theNodes[4]->getCrds();
02809     const Vector &nd6Crds = theNodes[5]->getCrds();
02810     const Vector &nd7Crds = theNodes[6]->getCrds();
02811     const Vector &nd8Crds = theNodes[7]->getCrds();
02812     const Vector &nd9Crds  =  theNodes[8]->getCrds();
02813     const Vector &nd10Crds = theNodes[9]->getCrds();
02814     const Vector &nd11Crds = theNodes[10]->getCrds();
02815     const Vector &nd12Crds = theNodes[11]->getCrds();
02816     const Vector &nd13Crds = theNodes[12]->getCrds();
02817     const Vector &nd14Crds = theNodes[13]->getCrds();
02818     const Vector &nd15Crds = theNodes[14]->getCrds();
02819     const Vector &nd16Crds = theNodes[15]->getCrds();
02820     const Vector &nd17Crds = theNodes[16]->getCrds();
02821     const Vector &nd18Crds = theNodes[17]->getCrds();
02822     const Vector &nd19Crds = theNodes[18]->getCrds();
02823     const Vector &nd20Crds = theNodes[19]->getCrds();
02824     const Vector &nd21Crds = theNodes[20]->getCrds();
02825     const Vector &nd22Crds = theNodes[21]->getCrds();
02826     const Vector &nd23Crds = theNodes[22]->getCrds();
02827     const Vector &nd24Crds = theNodes[23]->getCrds();
02828     const Vector &nd25Crds = theNodes[24]->getCrds();
02829     const Vector &nd26Crds = theNodes[25]->getCrds();
02830     const Vector &nd27Crds = theNodes[26]->getCrds();
02831 
02832 
02833 
02834     NodalCoord.val(1,1)=nd1Crds(0); NodalCoord.val(2,1)=nd1Crds(1); NodalCoord.val(3,1)=nd1Crds(2);
02835     NodalCoord.val(1,2)=nd2Crds(0); NodalCoord.val(2,2)=nd2Crds(1); NodalCoord.val(3,2)=nd2Crds(2);
02836     NodalCoord.val(1,3)=nd3Crds(0); NodalCoord.val(2,3)=nd3Crds(1); NodalCoord.val(3,3)=nd3Crds(2);
02837     NodalCoord.val(1,4)=nd4Crds(0); NodalCoord.val(2,4)=nd4Crds(1); NodalCoord.val(3,4)=nd4Crds(2);
02838     NodalCoord.val(1,5)=nd5Crds(0); NodalCoord.val(2,5)=nd5Crds(1); NodalCoord.val(3,5)=nd5Crds(2);
02839     NodalCoord.val(1,6)=nd6Crds(0); NodalCoord.val(2,6)=nd6Crds(1); NodalCoord.val(3,6)=nd6Crds(2);
02840     NodalCoord.val(1,7)=nd7Crds(0); NodalCoord.val(2,7)=nd7Crds(1); NodalCoord.val(3,7)=nd7Crds(2);
02841     NodalCoord.val(1,8)=nd8Crds(0); NodalCoord.val(2,8)=nd8Crds(1); NodalCoord.val(3,8)=nd8Crds(2);
02842     NodalCoord.val(1,9)=nd9Crds(0); NodalCoord.val(2,9)=nd9Crds(1); NodalCoord.val(3,9)=nd9Crds(2);
02843     NodalCoord.val(1,10)=nd10Crds(0); NodalCoord.val(2,10)=nd10Crds(1); NodalCoord.val(3,10)=nd10Crds(2);
02844     NodalCoord.val(1,11)=nd11Crds(0); NodalCoord.val(2,11)=nd11Crds(1); NodalCoord.val(3,11)=nd11Crds(2);
02845     NodalCoord.val(1,12)=nd12Crds(0); NodalCoord.val(2,12)=nd12Crds(1); NodalCoord.val(3,12)=nd12Crds(2);
02846     NodalCoord.val(1,13)=nd13Crds(0); NodalCoord.val(2,13)=nd13Crds(1); NodalCoord.val(3,13)=nd13Crds(2);
02847     NodalCoord.val(1,14)=nd14Crds(0); NodalCoord.val(2,14)=nd14Crds(1); NodalCoord.val(3,14)=nd14Crds(2);
02848     NodalCoord.val(1,15)=nd15Crds(0); NodalCoord.val(2,15)=nd15Crds(1); NodalCoord.val(3,15)=nd15Crds(2);
02849     NodalCoord.val(1,16)=nd16Crds(0); NodalCoord.val(2,16)=nd16Crds(1); NodalCoord.val(3,16)=nd16Crds(2);
02850     NodalCoord.val(1,17)=nd17Crds(0); NodalCoord.val(2,17)=nd17Crds(1); NodalCoord.val(3,17)=nd17Crds(2);
02851     NodalCoord.val(1,18)=nd18Crds(0); NodalCoord.val(2,18)=nd18Crds(1); NodalCoord.val(3,18)=nd18Crds(2);
02852     NodalCoord.val(1,19)=nd19Crds(0); NodalCoord.val(2,19)=nd19Crds(1); NodalCoord.val(3,19)=nd19Crds(2);
02853     NodalCoord.val(1,20)=nd20Crds(0); NodalCoord.val(2,20)=nd20Crds(1); NodalCoord.val(3,20)=nd20Crds(2);
02854     NodalCoord.val(1,21)=nd21Crds(0); NodalCoord.val(2,21)=nd21Crds(1); NodalCoord.val(3,21)=nd21Crds(2);
02855     NodalCoord.val(1,22)=nd22Crds(0); NodalCoord.val(2,22)=nd22Crds(1); NodalCoord.val(3,22)=nd22Crds(2);
02856     NodalCoord.val(1,23)=nd23Crds(0); NodalCoord.val(2,23)=nd23Crds(1); NodalCoord.val(3,23)=nd23Crds(2);
02857     NodalCoord.val(1,24)=nd24Crds(0); NodalCoord.val(2,24)=nd24Crds(1); NodalCoord.val(3,24)=nd24Crds(2);
02858     NodalCoord.val(1,25)=nd25Crds(0); NodalCoord.val(2,25)=nd25Crds(1); NodalCoord.val(3,25)=nd25Crds(2);
02859     NodalCoord.val(1,26)=nd26Crds(0); NodalCoord.val(2,26)=nd26Crds(1); NodalCoord.val(3,26)=nd26Crds(2);
02860     NodalCoord.val(1,27)=nd27Crds(0); NodalCoord.val(2,27)=nd27Crds(1); NodalCoord.val(3,27)=nd27Crds(2);
02861 
02862     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
02863       {
02864         r = get_Gauss_p_c( r_integration_order, GP_c_r );
02865         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
02866           {
02867             s = get_Gauss_p_c( s_integration_order, GP_c_s );
02868             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
02869               {
02870                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
02871                 // this short routine is supposed to calculate position of
02872                 // Gauss point from 3D array of short's
02873                 where =
02874                 ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
02875                 // derivatives of local coordinates with respect to local coordinates
02876 
02877                H = H_3D(r,s,t);
02878 
02879           for (int encount=1 ; encount <= nodes_in_brick ; encount++ )
02880                 //         for (int encount=0 ; encount <= 7 ; encount++ )
02881          {
02882                   //  matpointCoord.val(1,where+1) =+NodalCoord.val(1,where+1) * H.val(encount*3-2,1);
02883                   //  matpointCoord.val(2,where+1) =+NodalCoord.val(2,where+1) * H.val(encount*3-1,2);
02884                   //  matpointCoord.val(3,where+1) =+NodalCoord.val(3,where+1) * H.val(encount*3-0,3);
02885                   matpointCoord.val(1,where+1) +=NodalCoord.val(1,encount) * H.val(encount*3-2,1);
02886                   //::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) );
02887                   matpointCoord.val(2,where+1) +=NodalCoord.val(2,encount) * H.val(encount*3-1,2);
02888                   matpointCoord.val(3,where+1) +=NodalCoord.val(3,encount) * H.val(encount*3-0,3);
02889 
02890          }
02891 
02892     fprintf(fp, "gauss point# %d   %+.6e %+.6e %+.6e \n", where+1,
02893                                                           matpointCoord.val(1,where+1),
02894                                                           matpointCoord.val(2,where+1),
02895                                                           matpointCoord.val(3,where+1));
02896 
02897     //matpoint[where].reportTensor("");
02898 
02899 
02900               }
02901           }
02902       }
02903 
02904  }
02905 
02906 //=============================================================================
02907 //  The following are come from FourNodeQuad.cc   Xiaoyan 07/06/00
02908 //  The following are come from FourNodeQuad.cc   Xiaoyan 07/06/00
02909 //  The following are come from FourNodeQuad.cc   Xiaoyan 07/06/00
02910 //=============================================================================
02911 
02912 
02913 //=============================================================================
02914 int TwentySevenNodeBrick::getNumExternalNodes () const
02915 {
02916     return nodes_in_brick;
02917 }
02918 
02919 
02920 //=============================================================================
02921 const ID& TwentySevenNodeBrick::getExternalNodes ()
02922 {
02923     return connectedExternalNodes;
02924 }
02925 
02926 Node **
02927 TwentySevenNodeBrick::getNodePtrs(void)
02928 {
02929   return theNodes;
02930 }
02931 
02932 //=============================================================================
02933 int TwentySevenNodeBrick::getNumDOF ()
02934 {
02935     return 3*nodes_in_brick;
02936 }
02937 
02938 //=============================================================================
02939 void TwentySevenNodeBrick::setDomain (Domain *theDomain)
02940 {
02941     // Check Domain is not null - invoked when object removed from a domain
02942     if (theDomain == 0) {
02943   theNodes[0] = 0;
02944   theNodes[1] = 0;
02945   theNodes[2] = 0;
02946   theNodes[3] = 0;
02947   theNodes[4] = 0;
02948   theNodes[5] = 0;
02949   theNodes[6] = 0;
02950   theNodes[7] = 0;
02951   theNodes[8] = 0;
02952         theNodes[9] = 0;
02953         theNodes[10] = 0;
02954         theNodes[11] = 0;
02955         theNodes[12] = 0;
02956         theNodes[13] = 0;
02957         theNodes[14] = 0;
02958         theNodes[15] = 0;
02959         theNodes[16] = 0;
02960         theNodes[17] = 0;
02961         theNodes[18] = 0;
02962         theNodes[19] = 0;
02963         theNodes[20] = 0;
02964         theNodes[21] = 0;
02965         theNodes[22] = 0;
02966         theNodes[23] = 0;
02967         theNodes[24] = 0;
02968         theNodes[25] = 0;
02969         theNodes[26] = 0;
02970 
02971     }
02972 
02973     //Added if-else for found a bug when trying removeElement from theDomain  07-19-2001 Zhaohui
02974     else {
02975       int Nd1 = connectedExternalNodes(0);
02976       int Nd2 = connectedExternalNodes(1);
02977       int Nd3 = connectedExternalNodes(2);
02978       int Nd4 = connectedExternalNodes(3);
02979       //Xiaoyan added 5-8  07/06/00
02980 
02981       int Nd5 = connectedExternalNodes(4);
02982       int Nd6 = connectedExternalNodes(5);
02983       int Nd7 = connectedExternalNodes(6);
02984       int Nd8 = connectedExternalNodes(7);
02985       int Nd9  = connectedExternalNodes(8);
02986       int Nd10 = connectedExternalNodes(9);
02987       int Nd11 = connectedExternalNodes(10);
02988       int Nd12 = connectedExternalNodes(11);
02989       int Nd13 = connectedExternalNodes(12);
02990       int Nd14 = connectedExternalNodes(13);
02991       int Nd15 = connectedExternalNodes(14);
02992       int Nd16 = connectedExternalNodes(15);
02993       int Nd17 = connectedExternalNodes(16);
02994       int Nd18 = connectedExternalNodes(17);
02995       int Nd19 = connectedExternalNodes(18);
02996       int Nd20 = connectedExternalNodes(19);
02997       int Nd21 = connectedExternalNodes(20);
02998       int Nd22 = connectedExternalNodes(21);
02999       int Nd23 = connectedExternalNodes(22);
03000       int Nd24 = connectedExternalNodes(23);
03001       int Nd25 = connectedExternalNodes(24);
03002       int Nd26 = connectedExternalNodes(25);
03003       int Nd27 = connectedExternalNodes(26);
03004 
03005 
03006       theNodes[0] = theDomain->getNode(Nd1);
03007       theNodes[1] = theDomain->getNode(Nd2);
03008       theNodes[2] = theDomain->getNode(Nd3);
03009       theNodes[3] = theDomain->getNode(Nd4);
03010       theNodes[4] = theDomain->getNode(Nd5);
03011       theNodes[5] = theDomain->getNode(Nd6);
03012       theNodes[6] = theDomain->getNode(Nd7);
03013       theNodes[7] = theDomain->getNode(Nd8);
03014       theNodes[8] = theDomain->getNode(Nd9);
03015       theNodes[9] = theDomain->getNode(Nd10);
03016       theNodes[10] = theDomain->getNode(Nd11);
03017       theNodes[11] = theDomain->getNode(Nd12);
03018       theNodes[12] = theDomain->getNode(Nd13);
03019       theNodes[13] = theDomain->getNode(Nd14);
03020       theNodes[14] = theDomain->getNode(Nd15);
03021       theNodes[15] = theDomain->getNode(Nd16);
03022       theNodes[16] = theDomain->getNode(Nd17);
03023       theNodes[17] = theDomain->getNode(Nd18);
03024       theNodes[18] = theDomain->getNode(Nd19);
03025       theNodes[19] = theDomain->getNode(Nd20);
03026       theNodes[20] = theDomain->getNode(Nd21);
03027       theNodes[21] = theDomain->getNode(Nd22);
03028       theNodes[22] = theDomain->getNode(Nd23);
03029       theNodes[23] = theDomain->getNode(Nd24);
03030       theNodes[24] = theDomain->getNode(Nd25);
03031       theNodes[25] = theDomain->getNode(Nd26);
03032       theNodes[26] = theDomain->getNode(Nd27);
03033 
03034 
03035       if (theNodes[0]  == 0 || theNodes[1]  == 0 || theNodes[2]  == 0 || theNodes[3]  == 0 ||
03036           theNodes[4]  == 0 || theNodes[5]  == 0 || theNodes[6]  == 0 || theNodes[7]  == 0 ||
03037     theNodes[8]  == 0 || theNodes[9] == 0 || theNodes[10] == 0 || theNodes[11] == 0 ||
03038           theNodes[12] == 0 || theNodes[13] == 0 || theNodes[14] == 0 || theNodes[15] == 0 ||
03039           theNodes[16] == 0 || theNodes[17] == 0 || theNodes[18] == 0 || theNodes[19] == 0 ||
03040           theNodes[20] == 0 || theNodes[21] == 0 || theNodes[22] == 0 || theNodes[23] == 0 ||
03041           theNodes[24] == 0 || theNodes[25] == 0 || theNodes[26] == 0) {
03042 
03043         opserr << "FATAL ERROR TwentySevenNodeBrick (tag: " << this->getTag() << " ), node not found in domain\n";
03044   exit(-1);
03045       }
03046 
03047       int dofNd1 = theNodes[0]->getNumberDOF();
03048       int dofNd2 = theNodes[1]->getNumberDOF();
03049       int dofNd3 = theNodes[2]->getNumberDOF();
03050       int dofNd4 = theNodes[3]->getNumberDOF();
03051       int dofNd5 = theNodes[4]->getNumberDOF();
03052       int dofNd6 = theNodes[5]->getNumberDOF();
03053       int dofNd7 = theNodes[6]->getNumberDOF();
03054       int dofNd8 = theNodes[7]->getNumberDOF();
03055       int dofNd9 = theNodes[8]->getNumberDOF();
03056       int dofNd10 = theNodes[9]->getNumberDOF();
03057       int dofNd11 = theNodes[10]->getNumberDOF();
03058       int dofNd12 = theNodes[11]->getNumberDOF();
03059       int dofNd13 = theNodes[12]->getNumberDOF();
03060       int dofNd14 = theNodes[13]->getNumberDOF();
03061       int dofNd15 = theNodes[14]->getNumberDOF();
03062       int dofNd16 = theNodes[15]->getNumberDOF();
03063       int dofNd17 = theNodes[16]->getNumberDOF();
03064       int dofNd18 = theNodes[17]->getNumberDOF();
03065       int dofNd19 = theNodes[18]->getNumberDOF();
03066       int dofNd20 = theNodes[19]->getNumberDOF();
03067       int dofNd21 = theNodes[20]->getNumberDOF();
03068       int dofNd22 = theNodes[21]->getNumberDOF();
03069       int dofNd23 = theNodes[22]->getNumberDOF();
03070       int dofNd24 = theNodes[23]->getNumberDOF();
03071       int dofNd25 = theNodes[24]->getNumberDOF();
03072       int dofNd26 = theNodes[25]->getNumberDOF();
03073       int dofNd27 = theNodes[26]->getNumberDOF();
03074 
03075 
03076       if (dofNd1  != 3 || dofNd2  != 3 || dofNd3  != 3 || dofNd4  != 3 ||
03077           dofNd5  != 3 || dofNd6  != 3 || dofNd7  != 3 || dofNd8  != 3 ||
03078           dofNd9  != 3 || dofNd10 != 3 || dofNd11 != 3 || dofNd12 != 3 ||
03079           dofNd13 != 3 || dofNd14 != 3 || dofNd15 != 3 || dofNd16 != 3 ||
03080           dofNd17 != 3 || dofNd18 != 3 || dofNd19 != 3 || dofNd20 != 3 ||
03081           dofNd21 != 3 || dofNd22 != 3 || dofNd23 != 3 || dofNd24 != 3 ||
03082           dofNd25 != 3 || dofNd26 != 3 || dofNd27 != 3){
03083         opserr << "FATAL ERROR TwentySevenNodeBrick (tag: " << this->getTag() <<
03084     "), has differing number of DOFs at its nodes\n";
03085   exit(-1);
03086       }
03087       this->DomainComponent::setDomain(theDomain);
03088     }
03089 }
03090 
03091 //=============================================================================
03092 int TwentySevenNodeBrick::commitState ()
03093 {
03094   int retVal = 0;
03095 
03096   // call element commitState to do any base class stuff
03097   if ((retVal = this->Element::commitState()) != 0) {
03098     opserr << "TwentySevenNodeBrick::commitState () - failed in base class";
03099   }
03100 
03101     // int order = theQuadRule->getOrder();     // Commented by Xiaoyan
03102 
03103     int i;
03104     //int j, k;      // Xiaoyan added k for three dimension
03105 
03106     // Loop over the integration points and commit the material states
03107     int count  = r_integration_order* s_integration_order * t_integration_order;
03108     //for (i = 0; i < r_integration_order; i++)        // Xiaoyan chaneged order to
03109     //  for (j = 0; j < s_integration_order; j++)      // r_integration_order,
03110     //                  // s_integration_order, and
03111     //      for (k = 0; k < t_integration_order; k++)      // added t_integration_order,
03112     //         retVal += (GaussPtheMaterial[i][j][k]).commitState();
03113 
03114     Vector pp = getResistingForce();
03115 
03116     //if ( this->getTag() == 1 || this->getTag() == 700)
03117     //{
03118       for (i = 0; i < count; i++)
03119       //for (i = 0; i < 27; i++)
03120       {
03121          retVal += matpoint[i]->commitState();
03122          //if (i == 4 && strcmp(matpoint[i]->matmodel->getType(),"Template3Dep") == 0)
03123          stresstensor st;
03124    stresstensor prin;
03125          straintensor stn;
03126          straintensor stnprin;
03127 
03128          st = matpoint[i]->getStressTensor();
03129           prin = st.principal();
03130          stn = matpoint[i]->getStrainTensor();
03131           stnprin = stn.principal();
03132          /*
03133    opserr << "\nGauss Point: " << i << endln;
03134    opserr << "sigma11: "<< st.cval(1, 1) << " "<< st.cval(1, 2) << " " << st.cval(1, 3) << endln;
03135    opserr << "sigma21: "<< st.cval(2, 1) << " "<< st.cval(2, 2) << " " << st.cval(2, 3) << endln;
03136     opserr << "sigma31: "<< st.cval(3, 1) << " "<< st.cval(3, 2) << " " << st.cval(3, 3) << endln << endln;
03137    */
03138    //opserr << "strain11: "<< stn.cval(1, 1) << " "<< stn.cval(1, 2) << " " << stn.cval(1, 3) << endln;
03139    //opserr << "strain21: "<< stn.cval(2, 1) << " "<< stn.cval(2, 2) << " " << stn.cval(2, 3) << endln;
03140     //opserr << "strain31: "<< stn.cval(3, 1) << " "<< stn.cval(3, 2) << " " << stn.cval(3, 3) << endln;
03141 
03142    double  p = -1*( prin.cval(1, 1)+ prin.cval(2, 2) +prin.cval(3, 3) )/3.0;
03143    double  ev = -1*( stnprin.cval(1, 1)+ stnprin.cval(2, 2) + stnprin.cval(3, 3) )/3.0;
03144    //opserr << "   " << p;
03145 
03146    //if (p < 0)
03147    //  opserr  << "gs pnt:" << i << "  p="<< p;
03148 
03149 
03150    double q;
03151    //if ( fabs(prin.cval(1, 1) - prin.cval(2, 2) ) <=  0.0001 )
03152          if ( fabs(prin.cval(1, 1) - prin.cval(2, 2) ) <=  0.001 )
03153          {
03154              q = prin.cval(1, 1) - prin.cval(3, 3);
03155              //opserr << "1 = 2";
03156          }
03157          else
03158              q = prin.cval(3, 3) - prin.cval(1, 1);
03159 
03160    //Triaxial compr.  fabs
03161          //opserr << "     " << st.cval(2, 3); //tau_yz
03162    //opserr << "     " << q;
03164 
03165          //opserr << "     " << ev << endln;
03166 
03167 //out22Jan2001   if (strcmp(matpoint[i]->matmodel->getType(),"Template3Dep") == 0)
03168 //out22Jan2001          {
03169 //out22Jan2001           st = ( ((Template3Dep *)(matpoint[i]->matmodel))->getEPS())->getStress();
03170 //out22Jan2001           prin = st.principal();
03171 //out22Jan2001    }
03172 //out22Jan2001    else
03173 //out22Jan2001    {
03174 //out22Jan2001            st = matpoint[i]->getStressTensor();
03175 //out22Jan2001           prin = st.principal();
03176 //out22Jan2001
03177 //out22Jan2001    }
03178 
03179     //double  p = st.p_hydrostatic();
03180     //double  p = -1*( prin.cval(1, 1)+ prin.cval(2, 2) +prin.cval(3, 3) )/3.0;
03181           //opserr << "\n " << prin.cval(1, 1) << "   " << prin.cval(2, 2) << "  " <<  prin.cval(3, 3) << endln;
03182           //if ( getTag() == 981)
03183           //opserr << " El= " << getTag() << " , p    " << p << endln;
03184 
03185     //printf(stderr, " Gauss Point i = %d ", (i+1));
03186     //printf(stderr, " Gauss Point i = %d ", (i+1));
03187 
03188 
03189           //if ( p < 0 )
03190     //{
03191     //  opserr << getTag();
03192     //  opserr << " ***p  =    " << p << endln;
03193     //}
03194           //J2D
03195           //opserr << "        " << st.q_deviatoric();
03196 
03197           //double q;
03198           //if ( fabs(prin.cval(1, 1) - prin.cval(2, 2) ) <=  0.0001 )
03199           //{
03200           //    q = prin.cval(1, 1) - prin.cval(3, 3);
03201           //    //opserr << "1 = 2";
03202           //}
03203           //else
03204           //    q = prin.cval(3, 3) - prin.cval(1, 1);
03205 
03206           //Triaxial compr.
03207           //opserr << "        " << q;
03208          //}
03209       }
03210 
03211       //opserr << " at elements " << this->getTag() << endln;
03212 
03213 
03214       //output nodal force
03215       //opserr << "    " << pp(2) << endln;
03216     //}
03217 
03218     return retVal;
03219 }
03220 
03221 //=============================================================================
03222 int TwentySevenNodeBrick::revertToLastCommit ()
03223 {
03224   //  int order = theQuadRule->getOrder();  // Commented by Xiaoyan
03225     int i;
03226     //int j, k;     // Xiaoyan added k for three dimension
03227     int retVal = 0;
03228 
03229     // Loop over the integration points and revert to last committed material states
03230     int count  = r_integration_order* s_integration_order * t_integration_order;
03231     //for (i = 0; i < r_integration_order; i++)       // Xiaoyan chaneged order to
03232     //  for (j = 0; j < s_integration_order; j++)     // r_integration_order,
03233     //      for (k = 0; k < t_integration_order; k++)     // s_integration_order, and
03234                        // added t_integration_order,
03235       //retVal += (theMaterial[i][j][k]).revertToLastCommit();
03236 
03237     for (i = 0; i < count; i++)
03238        retVal += matpoint[i]->revertToLastCommit();
03239 
03240 
03241     return retVal;
03242 }
03243 
03244 //=============================================================================
03245 int TwentySevenNodeBrick::revertToStart ()
03246 {
03247     int i;     // Xiaoyan added k for three dimension
03248     int retVal = 0;
03249 
03250     // Loop over the integration points and revert to last committed material states
03251     //for (i = 0; i < r_integration_order; i++)       // Xiaoyan chaneged order to
03252     //  for (j = 0; j < s_integration_order; j++)     // r_integration_order,
03253     //      for (k = 0; k < t_integration_order; k++)     // s_integration_order, and
03254                  // added t_integration_order,
03255     //      retVal += (theMaterial[i][j][k]).revertToLastCommit();
03256 
03257     int count  = r_integration_order* s_integration_order * t_integration_order;
03258 
03259     for (i = 0; i < count; i++)
03260        retVal += matpoint[i]->revertToStart();
03261 
03262 
03263     return retVal;
03264 
03265     // Loop over the integration points and revert to initial material states
03266    }
03267 
03268 
03269 //=============================================================================
03270 const Matrix &TwentySevenNodeBrick::getTangentStiff ()
03271 {
03272      tensor stifftensor = getStiffnessTensor();
03273      int Ki=0;
03274      int Kj=0;
03275 
03276      for ( int i=1 ; i<=nodes_in_brick ; i++ )
03277      {
03278         for ( int j=1 ; j<=nodes_in_brick ; j++ )
03279         {
03280            for ( int k=1 ; k<=3 ; k++ )
03281            {
03282               for ( int l=1 ; l<=3 ; l++ )
03283               {
03284                  Ki = k+3*(i-1);
03285                  Kj = l+3*(j-1);
03286                  K( Ki-1 , Kj-1 ) = stifftensor.cval(i,k,l,j);
03287               }
03288            }
03289         }
03290      }
03291 
03292      //opserr << " K " << K << endln;
03293      //K.Output(opserr);
03294      return K;
03295 }
03296 
03297 //=============================================================================
03298 const Matrix &TwentySevenNodeBrick::getInitialStiff ()
03299 {
03300   //opserr << "WARNING - TwentySevenNodeBrick::getInitialStiff() - not yet implemented\n";
03301   return this->getTangentStiff();
03302 }
03303 
03304 //=============================================================================
03305 //Get lumped mass
03306 //const Matrix &TwentySevenNodeBrick::getMass ()
03307 const Matrix &TwentySevenNodeBrick::getConsMass ()
03308 {
03309      tensor masstensor = getMassTensor();
03310      //int Ki=0;
03311      //int Kj=0;
03312 
03313      //double tot_mass = 0.0;
03314      //double diag_mass = 0.0;
03315      double column_mass;
03316 
03317      for ( int i=1 ; i<=nodes_in_brick*3 ; i++ )
03318      {
03319         column_mass = 0.0;
03320   for ( int j=1 ; j<=nodes_in_brick*3 ; j++ )
03321         {
03322 
03323      //M( i-1 , j-1 ) = masstensor.cval(i,j);
03324 
03325      column_mass += masstensor.cval(i,j);
03326      M( i-1 , j-1 ) = 0;
03327      //tot_mass += M( i-1 , j-1 );
03328      //if (i == j)
03329      //   diag_mass += M( i-1 , j-1 );
03330         }
03331   M( i-1 , i-1 ) = column_mass;
03332 
03333      }
03334 
03335      //opserr << " tot_mass= "<< tot_mass << " column_mass =" << column_mass << " diag_mass= " <<  diag_mass << endln;
03336      //opserr << "" << M.Output(opserr);
03337      //opserr << " M " << M;
03338 
03339      return M;
03340 }
03341 
03342 //=============================================================================
03343 //Get consistent mass
03344 //const Matrix &TwentySevenNodeBrick::getConsMass ()
03345 const Matrix &TwentySevenNodeBrick::getMass ()
03346 {
03347      tensor masstensor = getMassTensor();
03348      //int Ki=0;
03349      //int Kj=0;
03350 
03351      //double tot_mass = 0.0;
03352      //double diag_mass = 0.0;
03353      //double column_mass;
03354 
03355      for ( int i=1 ; i<=nodes_in_brick*3 ; i++ )
03356      {
03357         //column_mass = 0.0;
03358   for ( int j=1 ; j<=nodes_in_brick*3 ; j++ )
03359         {
03360      M( i-1 , j-1 ) = masstensor.cval(i,j);
03361 
03362      //column_mass += masstensor.cval(i,j);
03363      //M( i-1 , j-1 ) = 0;
03364      //tot_mass += M( i-1 , j-1 );
03365      //if (i == j)
03366      //   diag_mass += M( i-1 , j-1 );
03367         }
03368   //M( i-1 , i-1 ) = column_mass;
03369 
03370      }
03371 
03372      //opserr << " tot_mass= "<< tot_mass << " column_mass =" << column_mass << " diag_mass= " <<  diag_mass << endln;
03373      //opserr << "" << M.Output(opserr);
03374      //opserr << " M " << M;
03375 
03376      return M;
03377 }
03378 
03379 //=============================================================================
03380 void TwentySevenNodeBrick::zeroLoad(void)
03381 {
03382      Q.Zero();
03383 }
03384 
03385 
03386 //=============================================================================
03387 int
03388 TwentySevenNodeBrick::addLoad(ElementalLoad *theLoad, double loadFactor)
03389 {
03390     //g3ErrorHandler->warning("TwentySevenNodeBrick::addLoad - load type unknown for ele with tag: %d\n",
03391     //                        this->getTag());
03392 
03393     int type;
03394     const Vector &data = theLoad->getData(type, loadFactor);
03395     if (type == LOAD_TAG_BrickSelfWeight) {
03396 
03397       Vector bforce(81);
03398       // Check for a quick return
03399       //opserr << "rho " << rho << endln;
03400       if (rho == 0.0)
03401         return 0;
03402 
03403       Vector ba(81), bfx(3);
03404       bfx(0) = bf(0) * loadFactor;
03405       bfx(1) = bf(1) * loadFactor;
03406       bfx(2) = bf(2) * loadFactor;
03407 
03408       ba( 0) = bfx(0);
03409       ba( 1) = bfx(1);
03410       ba( 2) = bfx(2);
03411       ba( 3) = bfx(0);
03412       ba( 4) = bfx(1);
03413       ba( 5) = bfx(2);
03414       ba( 6) = bfx(0);
03415       ba( 7) = bfx(1);
03416       ba( 8) = bfx(2);
03417       ba( 9) = bfx(0);
03418       ba(10) = bfx(1);
03419       ba(11) = bfx(2);
03420       ba(12) = bfx(0);
03421       ba(13) = bfx(1);
03422       ba(14) = bfx(2);
03423       ba(15) = bfx(0);
03424       ba(16) = bfx(1);
03425       ba(17) = bfx(2);
03426       ba(18) = bfx(0);
03427       ba(19) = bfx(1);
03428       ba(20) = bfx(2);
03429       ba(21) = bfx(0);
03430       ba(22) = bfx(1);
03431       ba(23) = bfx(2);
03432       ba(24) = bfx(0);
03433       ba(25) = bfx(1);
03434       ba(26) = bfx(2);
03435       ba(27) = bfx(0);
03436       ba(28) = bfx(1);
03437       ba(29) = bfx(2);
03438       ba(30) = bfx(0);
03439       ba(31) = bfx(1);
03440       ba(32) = bfx(2);
03441       ba(33) = bfx(0);
03442       ba(34) = bfx(1);
03443       ba(35) = bfx(2);
03444       ba(36) = bfx(0);
03445       ba(37) = bfx(1);
03446       ba(38) = bfx(2);
03447       ba(39) = bfx(0);
03448       ba(40) = bfx(1);
03449       ba(41) = bfx(2);
03450       ba(42) = bfx(0);
03451       ba(43) = bfx(1);
03452       ba(44) = bfx(2);
03453       ba(45) = bfx(0);
03454       ba(46) = bfx(1);
03455       ba(47) = bfx(2);
03456       ba(48) = bfx(0);
03457       ba(49) = bfx(1);
03458       ba(50) = bfx(2);
03459       ba(51) = bfx(0);
03460       ba(52) = bfx(1);
03461       ba(53) = bfx(2);
03462       ba(54) = bfx(0);
03463       ba(55) = bfx(1);
03464       ba(56) = bfx(2);
03465       ba(57) = bfx(0);
03466       ba(58) = bfx(1);
03467       ba(59) = bfx(2);
03468       ba(60) = bfx(0);
03469       ba(61) = bfx(1);
03470       ba(62) = bfx(2);
03471       ba(63) = bfx(0);
03472       ba(64) = bfx(1);
03473       ba(65) = bfx(2);
03474       ba(66) = bfx(0);
03475       ba(67) = bfx(1);
03476       ba(68) = bfx(2);
03477       ba(69) = bfx(0);
03478       ba(70) = bfx(1);
03479       ba(71) = bfx(2);
03480       ba(72) = bfx(0);
03481       ba(73) = bfx(1);
03482       ba(74) = bfx(2);
03483       ba(75) = bfx(0);
03484       ba(76) = bfx(1);
03485       ba(77) = bfx(2);
03486       ba(78) = bfx(0);
03487       ba(79) = bfx(1);
03488       ba(80) = bfx(2);
03489 
03490 
03491 
03492 
03493       //Form equivalent body force
03494       this->getMass();
03495       bforce.addMatrixVector(0.0, M, ba, 1.0);
03496       Q.addVector(1.0, bforce, 1.0);
03497     } else  {
03498       opserr << "TwentySevenNodeBrick::addLoad() - 20NodeBrick " << this->getTag() <<
03499   ",load type " << type << " unknown\n";
03500       return -1;
03501     }
03502 
03503   return 0;
03504 }
03505 
03506 
03508 //int  TwentySevenNodeBrick::addLoad(const Vector &addLoad)
03509 //{
03510 //     if (addLoad.Size() != 81) {
03511 //       opserr << "TwentySevenNodeBrick::addLoad %s\n",
03512 //           "Vector not of correct size");
03513 //       return -1;
03514 //     }
03515 //
03516 //     // Add to the external nodal loads
03517 //     Q += addLoad;
03518 //
03519 //     return 0;
03520 //}
03521 
03522 //=============================================================================
03523 int TwentySevenNodeBrick::addInertiaLoadToUnbalance(const Vector &accel)
03524 {
03525   // Check for a quick return
03526   if (rho == 0.0)
03527     return 0;
03528 
03529   // Get R * accel from the nodes
03530   const Vector &Raccel1  = theNodes[0]->getRV(accel);
03531   const Vector &Raccel2  = theNodes[1]->getRV(accel);
03532   const Vector &Raccel3  = theNodes[2]->getRV(accel);
03533   const Vector &Raccel4  = theNodes[3]->getRV(accel);
03534   const Vector &Raccel5  = theNodes[4]->getRV(accel);
03535   const Vector &Raccel6  = theNodes[5]->getRV(accel);
03536   const Vector &Raccel7  = theNodes[6]->getRV(accel);
03537   const Vector &Raccel8  = theNodes[7]->getRV(accel);
03538   const Vector &Raccel9  = theNodes[8]->getRV(accel);
03539   const Vector &Raccel10 = theNodes[9]->getRV(accel);
03540   const Vector &Raccel11 = theNodes[10]->getRV(accel);
03541   const Vector &Raccel12 = theNodes[11]->getRV(accel);
03542   const Vector &Raccel13 = theNodes[12]->getRV(accel);
03543   const Vector &Raccel14 = theNodes[13]->getRV(accel);
03544   const Vector &Raccel15 = theNodes[14]->getRV(accel);
03545   const Vector &Raccel16 = theNodes[15]->getRV(accel);
03546   const Vector &Raccel17 = theNodes[16]->getRV(accel);
03547   const Vector &Raccel18 = theNodes[17]->getRV(accel);
03548   const Vector &Raccel19 = theNodes[18]->getRV(accel);
03549   const Vector &Raccel20 = theNodes[19]->getRV(accel);
03550   const Vector &Raccel21 = theNodes[20]->getRV(accel);
03551   const Vector &Raccel22 = theNodes[21]->getRV(accel);
03552   const Vector &Raccel23 = theNodes[22]->getRV(accel);
03553   const Vector &Raccel24 = theNodes[23]->getRV(accel);
03554   const Vector &Raccel25 = theNodes[24]->getRV(accel);
03555   const Vector &Raccel26 = theNodes[25]->getRV(accel);
03556   const Vector &Raccel27 = theNodes[26]->getRV(accel);
03557 
03558 
03559     if (3 != Raccel1.Size()  || 3 != Raccel2.Size()  || 3 != Raccel3.Size()  || 3 != Raccel4.Size() ||
03560         3 != Raccel5.Size()  || 3 != Raccel6.Size()  || 3 != Raccel7.Size()  || 3 != Raccel8.Size() ||
03561         3 != Raccel9.Size()  || 3 != Raccel10.Size() || 3 != Raccel11.Size() || 3 != Raccel12.Size()||
03562         3 != Raccel13.Size() || 3 != Raccel14.Size() || 3 != Raccel15.Size() || 3 != Raccel16.Size()||
03563         3 != Raccel17.Size() || 3 != Raccel18.Size() || 3 != Raccel19.Size() || 3 != Raccel20.Size()||
03564         3 != Raccel21.Size() || 3 != Raccel22.Size() || 3 != Raccel23.Size() || 3 != Raccel24.Size()||
03565         3 != Raccel25.Size() || 3 != Raccel26.Size() || 3 != Raccel27.Size()){
03566   // Xiaoyan changed 2 to 3 and added Racce15-18  09/27/00
03567 opserr << "TwentySevenNodeBrick::addInertiaLoadToUnbalance " <<
03568   "matrix and vector sizes are incompatable\n";
03569     return -1;
03570     }
03571 
03572   static Vector ra(81);  // Changed form 60 to 81  Guanzhou Oct. 2003
03573 
03574   ra( 0) = Raccel1(0);
03575   ra( 1) = Raccel1(1);
03576   ra( 2) = Raccel1(2);
03577   ra( 3) = Raccel2(0);
03578   ra( 4) = Raccel2(1);
03579   ra( 5) = Raccel2(2);
03580   ra( 6) = Raccel3(0);
03581   ra( 7) = Raccel3(1);
03582   ra( 8) = Raccel3(2);
03583   ra( 9) = Raccel4(0);
03584   ra(10) = Raccel4(1);
03585   ra(11) = Raccel4(2);
03586       ra(12) = Raccel5(0);
03587   ra(13) = Raccel5(1);
03588   ra(14) = Raccel5(2);
03589   ra(15) = Raccel6(0);
03590   ra(16) = Raccel6(1);
03591   ra(17) = Raccel6(2);
03592   ra(18) = Raccel7(0);
03593   ra(19) = Raccel7(1);
03594   ra(20) = Raccel7(2);
03595   ra(21) = Raccel8(0);
03596   ra(22) = Raccel8(1);
03597   ra(23) = Raccel8(2);
03598   ra(24) = Raccel9(0);
03599    ra(25) = Raccel9(1);
03600   ra(26) = Raccel9(2);
03601   ra(27) = Raccel10(0);
03602   ra(28) = Raccel10(1);
03603   ra(29) = Raccel10(2);
03604   ra(30) = Raccel11(0);
03605   ra(31) = Raccel11(1);
03606   ra(32) = Raccel11(2);
03607   ra(33) = Raccel12(0);
03608   ra(34) = Raccel12(1);
03609   ra(35) = Raccel12(2);
03610   ra(36) = Raccel13(0);
03611   ra(37) = Raccel13(1);
03612   ra(38) = Raccel13(2);
03613   ra(39) = Raccel14(0);
03614   ra(40) = Raccel14(1);
03615   ra(41) = Raccel14(2);
03616   ra(42) = Raccel15(0);
03617   ra(43) = Raccel15(1);
03618   ra(44) = Raccel15(2);
03619   ra(45) = Raccel16(0);
03620   ra(46) = Raccel16(1);
03621   ra(47) = Raccel16(2);
03622   ra(48) = Raccel17(0);
03623   ra(49) = Raccel17(1);
03624   ra(50) = Raccel17(2);
03625   ra(51) = Raccel18(0);
03626   ra(52) = Raccel18(1);
03627   ra(53) = Raccel18(2);
03628   ra(54) = Raccel19(0);
03629   ra(55) = Raccel19(1);
03630   ra(56) = Raccel19(2);
03631   ra(57) = Raccel20(0);
03632   ra(58) = Raccel20(1);
03633   ra(59) = Raccel20(2);
03634   ra(60) = Raccel21(0);
03635   ra(61) = Raccel21(1);
03636   ra(62) = Raccel21(2);
03637   ra(63) = Raccel22(0);
03638   ra(64) = Raccel22(1);
03639   ra(65) = Raccel22(2);
03640   ra(66) = Raccel23(0);
03641   ra(67) = Raccel23(1);
03642   ra(68) = Raccel23(2);
03643   ra(69) = Raccel24(0);
03644   ra(70) = Raccel24(1);
03645   ra(71) = Raccel24(2);
03646   ra(72) = Raccel25(0);
03647   ra(73) = Raccel25(1);
03648   ra(74) = Raccel25(2);
03649   ra(75) = Raccel26(0);
03650   ra(76) = Raccel26(1);
03651   ra(77) = Raccel26(2);
03652   ra(78) = Raccel27(0);
03653   ra(79) = Raccel27(1);
03654   ra(80) = Raccel27(2);
03655 
03656 
03657 
03658     // Want to add ( - fact * M R * accel ) to unbalance
03659     // Take advantage of lumped mass matrix
03660     // Mass matrix is computed in setDomain()
03661 
03662     //double column_mass = 0;
03663     //for (int i = 0; i < 24; i++)
03664     //   column_mass += M(1,i);
03665     //column_mass = column_mass/3.0;
03666 
03667     //opserr << " addInerti... column_mass " << column_mass << endln;
03668 
03669     //for (int i = 0; i < nodes_in_brick*3; i++)
03670     //    Q(i) += -M(i,i)*ra(i);
03671     Q.addMatrixVector(1.0, M, ra, -1.0);
03672 
03673     return 0;
03674 }
03675 
03676 //=============================================================================
03677 const Vector TwentySevenNodeBrick::FormEquiBodyForce(void)
03678 {
03679     Vector bforce(81);
03680 
03681     // Check for a quick return
03682     //opserr << "rho " << rho << endln;
03683     if (rho == 0.0)
03684       return bforce;
03685 
03686     Vector ba(81);
03687 
03688     ba( 0) = bf(0);
03689     ba( 1) = bf(1);
03690     ba( 2) = bf(2);
03691     ba( 3) = bf(0);
03692     ba( 4) = bf(1);
03693     ba( 5) = bf(2);
03694     ba( 6) = bf(0);
03695     ba( 7) = bf(1);
03696     ba( 8) = bf(2);
03697     ba( 9) = bf(0);
03698     ba(10) = bf(1);
03699     ba(11) = bf(2);
03700     ba(12) = bf(0);
03701     ba(13) = bf(1);
03702     ba(14) = bf(2);
03703     ba(15) = bf(0);
03704     ba(16) = bf(1);
03705     ba(17) = bf(2);
03706     ba(18) = bf(0);
03707     ba(19) = bf(1);
03708     ba(20) = bf(2);
03709     ba(21) = bf(0);
03710     ba(22) = bf(1);
03711     ba(23) = bf(2);
03712     ba(24) = bf(0);
03713     ba(25) = bf(1);
03714     ba(26) = bf(2);
03715     ba(27) = bf(0);
03716     ba(28) = bf(1);
03717     ba(29) = bf(2);
03718     ba(30) = bf(0);
03719     ba(31) = bf(1);
03720     ba(32) = bf(2);
03721     ba(33) = bf(0);
03722     ba(34) = bf(1);
03723     ba(35) = bf(2);
03724     ba(36) = bf(0);
03725     ba(37) = bf(1);
03726     ba(38) = bf(2);
03727     ba(39) = bf(0);
03728     ba(40) = bf(1);
03729     ba(41) = bf(2);
03730     ba(42) = bf(0);
03731     ba(43) = bf(1);
03732     ba(44) = bf(2);
03733     ba(45) = bf(0);
03734     ba(46) = bf(1);
03735     ba(47) = bf(2);
03736     ba(48) = bf(0);
03737     ba(49) = bf(1);
03738     ba(50) = bf(2);
03739     ba(51) = bf(0);
03740     ba(52) = bf(1);
03741     ba(53) = bf(2);
03742     ba(54) = bf(0);
03743     ba(55) = bf(1);
03744     ba(56) = bf(2);
03745     ba(57) = bf(0);
03746     ba(58) = bf(1);
03747     ba(59) = bf(2);
03748     ba(60) = bf(0);
03749     ba(61) = bf(1);
03750     ba(62) = bf(2);
03751     ba(63) = bf(0);
03752     ba(64) = bf(1);
03753     ba(65) = bf(2);
03754     ba(66) = bf(0);
03755     ba(67) = bf(1);
03756     ba(68) = bf(2);
03757     ba(69) = bf(0);
03758     ba(70) = bf(1);
03759     ba(71) = bf(2);
03760     ba(72) = bf(0);
03761     ba(73) = bf(1);
03762     ba(74) = bf(2);
03763     ba(75) = bf(0);
03764     ba(76) = bf(1);
03765     ba(77) = bf(2);
03766     ba(78) = bf(0);
03767     ba(79) = bf(1);
03768     ba(80) = bf(2);
03769 
03770 
03771     //Form equivalent body force
03772     bforce.addMatrixVector(0.0, M, ba, 1.0);
03773     //opserr << " ba " << ba;
03774     //opserr << " M " << M;
03775     //if (getTag() == 886)
03776     //opserr << " @@@@@ FormEquiBodyForce  " << bforce;
03777 
03778     return bforce;
03779 }
03780 
03781 //=============================================================================
03782 // Setting initial E according to the initial pressure p
03783 //void TwentySevenNodeBrick::setInitE(void)
03784 //{
03785 //    //Get the coors of each node
03786 //
03787 //    const Vector &nd1Crds = theNodes[0]->getCrds();
03788 //    const Vector &nd2Crds = theNodes[1]->getCrds();
03789 //    const Vector &nd3Crds = theNodes[2]->getCrds();
03790 //    const Vector &nd4Crds = theNodes[3]->getCrds();
03791 //    const Vector &nd5Crds = theNodes[4]->getCrds();
03792 //    const Vector &nd6Crds = theNodes[5]->getCrds();
03793 //    const Vector &nd7Crds = theNodes[6]->getCrds();
03794 //    const Vector &nd8Crds = theNodes[7]->getCrds();
03795 //
03796 //    //dir is the ID for vertial direction, e.g. 1 means x-dir is vertical...
03797 //    double Zavg = nd1Crds( dir-1)+
03798 //           nd2Crds( dir-1)+
03799 //           nd3Crds( dir-1)+
03800 //           nd4Crds( dir-1)+
03801 //           nd5Crds( dir-1)+
03802 //           nd6Crds( dir-1)+
03803 //           nd7Crds( dir-1)+
03804 //           nd8Crds( dir-1);
03805 //    Zavg = Zavg / 8;
03806 //
03807 //    //Estimate the pressure at that depth
03808 //    double sigma_v = (Zavg - surflevel) * rho * 9.81; //units in SI system
03809 //    double ko = 0.5;
03810 //    double p_est = sigma_v*( 2.0*ko+1.0)/3.0;
03811 //    //opserr << " Initial P " << p_est << endln;
03812 //
03813 //    int i;
03814 //
03815 //    // Loop over the integration points and set the initial material state
03816 //    int count  = r_integration_order* s_integration_order * t_integration_order;
03817 //
03818 //    //For elastic-isotropic material
03819 //    if (strcmp(matpoint[i]->matmodel->getType(),"ElasticIsotropic3D") == 0)
03820 //    {
03821 //       for (i = 0; i < count; i++)
03822 //           (matpoint[i]->matmodel)->setElasticStiffness( p_est );
03823 //    }
03824 //
03825 //    //return ;
03826 //}
03827 
03828 
03829 //=============================================================================
03830 const Vector &TwentySevenNodeBrick::getResistingForce ()
03831 {
03832     int force_dim[] = {27,3};
03833     tensor nodalforces(2,force_dim,0.0);
03834 
03835     nodalforces = nodal_forces();
03836 
03837     //converting nodalforce tensor to vector
03838     for (int i = 0; i< nodes_in_brick; i++)
03839       for (int j = 0; j < 3; j++)
03840   P(i *3 + j) = nodalforces.cval(i+1, j+1);
03841 
03842     //opserr << "P" << P;
03843     //opserr << "Q" << Q;
03844 
03845     P = P - Q;
03846 
03847     //opserr << "P-Q" << P;
03848     return P;
03849 }
03850 
03851 //=============================================================================
03852 const Vector &TwentySevenNodeBrick::getResistingForceIncInertia ()
03853 {
03854 
03855   this->getResistingForce();
03856 
03857   //
03858   // now add dynamic terms
03859   // P += M * a + C * v
03860   //
03861 
03862   if (rho != 0.0) {
03863 
03864     // form the mass matrix
03865     this->getMass();
03866 
03867     const Vector &accel1 = theNodes[0]->getTrialAccel();
03868     const Vector &accel2 = theNodes[1]->getTrialAccel();
03869     const Vector &accel3 = theNodes[2]->getTrialAccel();
03870     const Vector &accel4 = theNodes[3]->getTrialAccel();
03871     const Vector &accel5 = theNodes[4]->getTrialAccel();
03872     const Vector &accel6 = theNodes[5]->getTrialAccel();
03873     const Vector &accel7 = theNodes[6]->getTrialAccel();
03874     const Vector &accel8 = theNodes[7]->getTrialAccel();
03875     const Vector &accel9 = theNodes[8]->getTrialAccel();
03876     const Vector &accel10 = theNodes[9]->getTrialAccel();
03877     const Vector &accel11 = theNodes[10]->getTrialAccel();
03878     const Vector &accel12 = theNodes[11]->getTrialAccel();
03879     const Vector &accel13 = theNodes[12]->getTrialAccel();
03880     const Vector &accel14 = theNodes[13]->getTrialAccel();
03881     const Vector &accel15 = theNodes[14]->getTrialAccel();
03882     const Vector &accel16 = theNodes[15]->getTrialAccel();
03883     const Vector &accel17 = theNodes[16]->getTrialAccel();
03884     const Vector &accel18 = theNodes[17]->getTrialAccel();
03885     const Vector &accel19 = theNodes[18]->getTrialAccel();
03886     const Vector &accel20 = theNodes[19]->getTrialAccel();
03887     const Vector &accel21 = theNodes[20]->getTrialAccel();
03888     const Vector &accel22 = theNodes[21]->getTrialAccel();
03889     const Vector &accel23 = theNodes[22]->getTrialAccel();
03890     const Vector &accel24 = theNodes[23]->getTrialAccel();
03891     const Vector &accel25 = theNodes[24]->getTrialAccel();
03892     const Vector &accel26 = theNodes[25]->getTrialAccel();
03893     const Vector &accel27 = theNodes[26]->getTrialAccel();
03894 
03895     static Vector a(81);  // originally 8
03896 
03897     a( 0) = accel1(0);
03898     a( 1) = accel1(1);
03899     a( 2) = accel1(2);
03900     a( 3) = accel2(0);
03901     a( 4) = accel2(1);
03902     a( 5) = accel2(2);
03903     a( 6) = accel3(0);
03904     a( 7) = accel3(1);
03905     a( 8) = accel3(2);
03906     a( 9) = accel4(0);
03907     a(10) = accel4(1);
03908     a(11) = accel4(2);
03909     a(12) = accel5(0);
03910     a(13) = accel5(1);
03911     a(14) = accel5(2);
03912     a(15) = accel6(0);
03913     a(16) = accel6(1);
03914     a(17) = accel6(2);
03915     a(18) = accel7(0);
03916     a(19) = accel7(1);
03917     a(20) = accel7(2);
03918     a(21) = accel8(0);
03919     a(22) = accel8(1);
03920     a(23) = accel8(2);
03921     a(24) = accel9(0);
03922     a(25) = accel9(1);
03923     a(26) = accel9(2);
03924     a(27) = accel10(0);
03925     a(28) = accel10(1);
03926     a(29) = accel10(2);
03927     a(30) = accel11(0);
03928     a(31) = accel11(1);
03929     a(32) = accel11(2);
03930     a(33) = accel12(0);
03931     a(34) = accel12(1);
03932     a(35) = accel12(2);
03933     a(36) = accel13(0);
03934     a(37) = accel13(1);
03935     a(38) = accel13(2);
03936     a(39) = accel14(0);
03937     a(40) = accel14(1);
03938     a(41) = accel14(2);
03939     a(42) = accel15(0);
03940     a(43) = accel15(1);
03941     a(44) = accel15(2);
03942     a(45) = accel16(0);
03943     a(46) = accel16(1);
03944     a(47) = accel16(2);
03945     a(48) = accel17(0);
03946     a(49) = accel17(1);
03947     a(50) = accel17(2);
03948     a(51) = accel18(0);
03949     a(52) = accel18(1);
03950     a(53) = accel18(2);
03951     a(54) = accel19(0);
03952     a(55) = accel19(1);
03953     a(56) = accel19(2);
03954     a(57) = accel20(0);
03955     a(58) = accel20(1);
03956     a(59) = accel20(2);
03957     a(60) = accel21(0);
03958     a(61) = accel21(1);
03959     a(62) = accel21(2);
03960     a(63) = accel22(0);
03961     a(64) = accel22(1);
03962     a(65) = accel22(2);
03963     a(66) = accel23(0);
03964     a(67) = accel23(1);
03965     a(68) = accel23(2);
03966     a(69) = accel24(0);
03967     a(70) = accel24(1);
03968     a(71) = accel24(2);
03969     a(72) = accel25(0);
03970     a(73) = accel25(1);
03971     a(74) = accel25(2);
03972     a(75) = accel26(0);
03973     a(76) = accel26(1);
03974     a(77) = accel26(2);
03975     a(78) = accel27(0);
03976     a(79) = accel27(1);
03977     a(80) = accel27(2);
03978 
03979 
03980 
03981     // P += M * a
03982     P.addMatrixVector(1.0, M, a, 1.0);
03983 
03984     // add the damping forces if rayleigh damping
03985     if (alphaM != 0.0 || betaK != 0.0 || betaK0 != 0.0 || betaKc != 0.0)
03986       P += this->getRayleighDampingForces();
03987 
03988   } else {
03989 
03990     // add the damping forces if rayleigh damping
03991     if (betaK != 0.0 || betaK0 != 0.0 || betaKc != 0.0)
03992       P += this->getRayleighDampingForces();
03993 
03994   }
03995 
03996   return P;
03997 }
03998 
03999 //=============================================================================
04000 int TwentySevenNodeBrick::sendSelf (int commitTag, Channel &theChannel)
04001 {
04002      // Not implemtented yet
04003      return 0;
04004 }
04005 
04006 //=============================================================================
04007 int TwentySevenNodeBrick::recvSelf (int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
04008 {
04009      // Not implemtented yet
04010      return 0;
04011 }
04012 
04013 
04014 //=============================================================================
04015 int TwentySevenNodeBrick::displaySelf (Renderer &theViewer, int displayMode, float fact)
04016 {
04017     //needs more work...Zhaohui 08-19-2001
04018 
04019     // first determine the end points of the quad based on
04020     // the display factor (a measure of the distorted image)
04021     // store this information in 4 3d vectors v1 through v4
04022     const Vector &end1Crd = theNodes[0]->getCrds();
04023     const Vector &end2Crd = theNodes[1]->getCrds();
04024     const Vector &end3Crd = theNodes[2]->getCrds();
04025     const Vector &end4Crd = theNodes[3]->getCrds();
04026     const Vector &end5Crd = theNodes[4]->getCrds();
04027     const Vector &end6Crd = theNodes[5]->getCrds();
04028     const Vector &end7Crd = theNodes[6]->getCrds();
04029     const Vector &end8Crd = theNodes[7]->getCrds();
04030 
04031     const Vector &end1Disp = theNodes[0]->getDisp();
04032     const Vector &end2Disp = theNodes[1]->getDisp();
04033     const Vector &end3Disp = theNodes[2]->getDisp();
04034     const Vector &end4Disp = theNodes[3]->getDisp();
04035     const Vector &end5Disp = theNodes[4]->getDisp();
04036     const Vector &end6Disp = theNodes[5]->getDisp();
04037     const Vector &end7Disp = theNodes[6]->getDisp();
04038     const Vector &end8Disp = theNodes[7]->getDisp();
04039 
04040     static Vector v1(3);
04041     static Vector v2(3);
04042     static Vector v3(3);
04043     static Vector v4(3);
04044     static Vector v5(3);
04045     static Vector v6(3);
04046     static Vector v7(3);
04047     static Vector v8(3);
04048 
04049     for (int i = 0; i < 2; i++)
04050     {
04051       v1(i) = end1Crd(i) + end1Disp(i)*fact;
04052       v2(i) = end2Crd(i) + end2Disp(i)*fact;
04053       v3(i) = end3Crd(i) + end3Disp(i)*fact;
04054       v4(i) = end4Crd(i) + end4Disp(i)*fact;
04055       v5(i) = end5Crd(i) + end5Disp(i)*fact;
04056       v6(i) = end6Crd(i) + end6Disp(i)*fact;
04057       v7(i) = end7Crd(i) + end7Disp(i)*fact;
04058       v8(i) = end8Crd(i) + end8Disp(i)*fact;
04059     }
04060 
04061     int error = 0;
04062 
04063     error += theViewer.drawLine (v1, v2, 1.0, 1.0);
04064     error += theViewer.drawLine (v2, v3, 1.0, 1.0);
04065     error += theViewer.drawLine (v3, v4, 1.0, 1.0);
04066     error += theViewer.drawLine (v4, v1, 1.0, 1.0);
04067 
04068     error += theViewer.drawLine (v5, v6, 1.0, 1.0);
04069     error += theViewer.drawLine (v6, v7, 1.0, 1.0);
04070     error += theViewer.drawLine (v7, v8, 1.0, 1.0);
04071     error += theViewer.drawLine (v8, v5, 1.0, 1.0);
04072 
04073     error += theViewer.drawLine (v1, v5, 1.0, 1.0);
04074     error += theViewer.drawLine (v2, v6, 1.0, 1.0);
04075     error += theViewer.drawLine (v3, v7, 1.0, 1.0);
04076     error += theViewer.drawLine (v4, v8, 1.0, 1.0);
04077 
04078     return error;
04079 
04080 }
04081 
04082 //=============================================================================
04083 void TwentySevenNodeBrick::Print(OPS_Stream &s, int flag)
04084 {
04085     //report(" TwentySevenNodeBrick ");
04086     s << "TwentySevenNodeBrick, element id:  " << this->getTag() << endln;
04087     s << "Connected external nodes:  " << connectedExternalNodes;
04088 
04089     int total_number_of_Gauss_points = r_integration_order*
04090                                        s_integration_order*
04091                                        t_integration_order;
04092     if ( total_number_of_Gauss_points != 0 )
04093       {
04094      theNodes[0]->Print(opserr);
04095      theNodes[1]->Print(opserr);
04096      theNodes[2]->Print(opserr);
04097      theNodes[3]->Print(opserr);
04098      theNodes[4]->Print(opserr);
04099      theNodes[5]->Print(opserr);
04100            theNodes[6]->Print(opserr);
04101      theNodes[7]->Print(opserr);
04102      theNodes[8]->Print(opserr);
04103      theNodes[9]->Print(opserr);
04104      theNodes[10]->Print(opserr);
04105      theNodes[11]->Print(opserr);
04106      theNodes[12]->Print(opserr);
04107      theNodes[13]->Print(opserr);
04108      theNodes[14]->Print(opserr);
04109      theNodes[15]->Print(opserr);
04110      theNodes[16]->Print(opserr);
04111      theNodes[17]->Print(opserr);
04112      theNodes[18]->Print(opserr);
04113      theNodes[19]->Print(opserr);
04114         theNodes[20]->Print(opserr);
04115      theNodes[21]->Print(opserr);
04116      theNodes[22]->Print(opserr);
04117      theNodes[23]->Print(opserr);
04118      theNodes[24]->Print(opserr);
04119      theNodes[25]->Print(opserr);
04120      theNodes[26]->Print(opserr);
04121 
04122 
04123     }
04124     s << "Element mass density:  " << rho << endln << endln;
04125     s << "Material model:  " << endln;
04126 
04127     for( int GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
04128     {
04129       for( int GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
04130       {
04131         for( int GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
04132         {
04133            // this short routine is supposed to calculate position of
04134            // Gauss point from 3D array of short's
04135            short where =
04136            ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
04137 
04138            s << "\n where = " << where << endln;
04139            s << " GP_c_r= " << GP_c_r << "GP_c_s = " << GP_c_s << " GP_c_t = " << GP_c_t << endln;
04140            matpoint[where]->report("Material Point\n");
04141            //GPstress[where].reportshort("stress at Gauss Point");
04142            //GPstrain[where].reportshort("strain at Gauss Point");
04143            //matpoint[where].report("Material model  at Gauss Point");
04144         }
04145       }
04146     }
04147 
04148 }
04149 
04150 //=============================================================================
04151 Response * TwentySevenNodeBrick::setResponse (const char **argv, int argc, Information &eleInformation)
04152 {
04153     //========================================================
04154     if (strcmp(argv[0],"force") == 0 || strcmp(argv[0],"forces") == 0)
04155     return new ElementResponse(this, 1, P);
04156 
04157     //========================================================
04158     else if (strcmp(argv[0],"stiff") == 0 || strcmp(argv[0],"stiffness") == 0)
04159         return new ElementResponse(this, 5, K);
04160 
04161     //========================================================
04162     else if (strcmp(argv[0],"plastic") == 0 || strcmp(argv[0],"plastified") == 0)
04163     {
04165        //int count  = r_integration_order* s_integration_order * t_integration_order;
04166        //straintensor pl_stn;
04167        //int plastify = 0;
04168        //
04169        //for (int i = 0; i < count; i++) {
04170        //  pl_stn = matpoint[i]->getPlasticStrainTensor();
04171        //   double  p_plastc = pl_stn.p_hydrostatic();
04172        //
04173        //   if (  fabs(p_plastc) > 0 ) {
04174        //      plastify = 1;
04175        //      break;
04176        //   }
04177        //}
04178 
04179        return new ElementResponse(this, 2, InfoPlastic);
04180     }
04181     //========================================================
04182     //Specially designed for moment computation of solid pile elements Zhaohui Yang UCDavis August 1, 2001
04183     else if (strcmp(argv[0],"PileM") == 0 || strcmp(argv[0],"PileM") == 0)
04184     {
04185        return new ElementResponse(this, 3, InfoStress);
04186     }
04187     //========================================================
04188     else if (strcmp(argv[0],"stress") == 0 || strcmp(argv[0],"stresses") == 0)
04189     {
04190        return new ElementResponse(this, 4, InfoStress);
04191     }
04192 
04193     //========================================================
04194     else if (strcmp(argv[0],"pq") == 0 || strcmp(argv[0],"PQ") == 0)
04195     {
04196        return new ElementResponse(this, 41, Info_pq2);
04197     }
04198 
04199     //========================================================
04200     else if (strcmp(argv[0],"GaussPoint") == 0 || strcmp(argv[0],"gausspoint") == 0)
04201     {
04202        return new ElementResponse(this, 6, GaussCoord);
04203     }
04204     /*else if (strcmp(argv[0],"material") == 0 || strcmp(argv[0],"integrPoint") == 0) {
04205         int pointNum = atoi(argv[1]);
04206   if (pointNum > 0 && pointNum <= 4)
04207     return theMaterial[pointNum-1]->setResponse(&argv[2], argc-2, eleInfo);
04208         else
04209           return 0;
04210     }*/
04211 
04212     // otherwise response quantity is unknown for the quad class
04213     else
04214    return 0;
04215 }
04216 
04217 //=============================================================================
04218 int TwentySevenNodeBrick::getResponse (int responseID, Information &eleInfo)
04219 {
04220        switch (responseID) {
04221 
04222      case 1:
04223        return eleInfo.setVector( this->getResistingForce() );
04224 
04225      case 2:
04226                {
04227     //checking if element plastified
04228                  int count  = r_integration_order* s_integration_order * t_integration_order;
04229 
04230                  //Vector GaussCoord(81+1);  // 27*3 + count
04231     //GaussCoord = this->reportGaussPoint();
04232     this->computeGaussPoint();
04233 
04234     //Vector Info(109); // count * 4 +1
04235     InfoPlastic(0) = GaussCoord(0);
04236 
04237                  straintensor pl_stn;
04238 
04239     int plastify;
04240                  for (int i = 0; i < count; i++) {
04241                    plastify = 0;
04242          InfoPlastic(i*4+1) = GaussCoord(i*3+1); //x
04243          InfoPlastic(i*4+2) = GaussCoord(i*3+2); //y
04244          InfoPlastic(i*4+3) = GaussCoord(i*3+3); //z
04245                    pl_stn = matpoint[i]->getPlasticStrainTensor();
04246                    //double  p_plastc = pl_stn.p_hydrostatic();
04247                    double  q_plastc = pl_stn.q_deviatoric();
04248 
04249       //if (  fabs(p_plastc) > 0 ) {
04250                    //   plastify = 1;
04251                    //}
04252       //else
04253       //   plastify = 0;
04254 
04255          InfoPlastic(i*4+4) = q_plastc; //plastify; //Plastified?
04256 
04257                  }
04258        return eleInfo.setVector( InfoPlastic );
04259     //return plastify;
04260 
04261         }
04262      case 3:
04263         {
04264                  int count = r_integration_order* s_integration_order * t_integration_order;
04265                 stresstensor sts;
04266                  //Vector GaussCoord(81+1);  // 27*3 + count
04267     this->computeGaussPoint();
04268     Vector wt(9);
04269     int i, rs;
04270 
04271     //Vector Info(109 + 3 ); //Z values, x-disp. and corresponding avg. moment
04272     InfoMoment(0) = GaussCoord(0);
04273     Vector Mt(3), Q(3);
04274 
04275     //Vector Zcoor(3);
04276     InfoMoment(109+0) = GaussCoord(6); //Zcoor of middle layer
04277 
04278                 //Computing Height of element
04279     const Vector &coor = theNodes[17]->getCrds();
04280                 const Vector &TotDis = theNodes[17]->getTrialDisp();
04281           //checking Z-coor. of moddile layer gauss point
04282     //if ( (coor(2) - GaussCoord(6)) > 0.0001 )
04283     //  opserr << " Warning: Middle layer Gauss Point Z-coor. wrong...\n";
04284 
04285     //InfoMoment(109+0) = GaussCoord(6);
04286     InfoMoment(109+1) = TotDis(0); //x-displacement ...Lateral displacement
04287     //InfoMoment(109+3) = GaussCoord(6);
04288     //InfoMoment(109+6) = GaussCoord(9);
04289     //opserr << " Zz " << GaussCoord(3) << " " << GaussCoord(6) << " "<< GaussCoord(9) << endln;
04290 
04291                 const char *tp = matpoint[1]->getType();
04292                 int tag = matpoint[1]->getTag();
04293     //opserr << "Materail Tag:" << tag << endln;
04294     //tp = "ElasticIsotropic3D";
04295     float height = 1;
04296              //opserr << "height" << height;
04297     double offset[30];
04298     //single pile group My ---- change multiplier to y
04299     offset[1] = -0.000;/*pile no. 1 */  offset[4] = -0.000;/*pile no. 4 3X3*/
04300     offset[2] =  0.000;/*pile no. 2 */  offset[5] =  0.000;/*pile no. 5    */
04301     offset[3] =  0.000;/*pile no. 3 */  offset[6] =  0.000;/*pile no. 6    */
04302 
04303     //3X3 pile group My ---- change multiplier to y
04304     //offset[1] = -1.287;/*pile no. 1 */  offset[4] = -1.287;/*pile no. 4 3X3 or 2X2*/
04305     //offset[2] =  0.000;/*pile no. 2 */  offset[5] =  0.000;/*pile no. 5    */
04306     //offset[3] =  1.287;/*pile no. 3 */  offset[6] =  1.287;/*pile no. 6    */
04307 
04308     //3X3 pile group Mx ---- change multiplier to y
04309     //offset[1] = 1.287;/*pile no. 1 */  offset[4] = 0.0000;/*pile no. 4 3X3*/
04310     //offset[2] = 1.287;/*pile no. 2 */  offset[5] = 0.0000;/*pile no. 5    */
04311     //offset[3] = 1.287;/*pile no. 3 */  offset[6] = 0.0000;/*pile no. 6    */
04312 
04313     //4X3 pile group My  ---- change multiplier to x
04314     //offset[1] = -1.9305;/*pile no. 1*/  offset[5] = -1.9305;/*pile no. 4 4X3*/
04315     //offset[2] = -0.6435;/*pile no. 2*/  offset[6] = -0.6435;/*pile no. 5    */
04316     //offset[3] =  0.6435;/*pile no. 3*/  offset[7] =  0.6435;/*pile no. 6    */
04317     //offset[4] =  1.9305;/*pile no. 3*/  offset[8] =  1.9305;/*pile no. 6    */
04318 
04319     //4X3 pile group Mx  ---- change multiplier to y
04320     //offset[1] = 1.287;/*pile no. 1*/  offset[5] = 0.0000;/*pile no. 4 4X3*/
04321     //offset[2] = 1.287;/*pile no. 2*/  offset[6] = 0.0000;/*pile no. 5    */
04322     //offset[3] = 1.287;/*pile no. 3*/  offset[7] = 0.0000;/*pile no. 6    */
04323     //offset[4] = 1.287;/*pile no. 3*/  offset[8] = 0.0000;/*pile no. 6    */
04324 
04325 
04326     if (strcmp(tp, "ElasticIsotropic3D") == 0 )
04327     {
04328        wt = getWeightofGP();
04329              const Vector &end1Crd = theNodes[0]->getCrds();
04330                    const Vector &end5Crd = theNodes[4]->getCrds();
04331        height = end1Crd(2) - end5Crd(2);
04332        //if  (getTag() == 432) {
04333        //   opserr << getTag() << " height " << height << endln;
04334        //   opserr << " Weight " << wt << endln;
04335        //}
04336     }
04337 
04338 
04339     Mt(0) = 0; Mt(1) = 0; Mt(2) = 0;
04340     //Q(0) = 0; Q(1) = 0; Q(2) = 0;
04341 
04342 
04343                 for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
04344                 {
04345                     //r = get_Gauss_p_c( r_integration_order, GP_c_r );
04346                     for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
04347                     {
04348                         //s = get_Gauss_p_c( s_integration_order, GP_c_s );
04349                         rs = (GP_c_r-1)*s_integration_order+GP_c_s-1;
04350 
04351       for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
04352                         {
04353               //for (int i = 0; i < count; i++)
04354                           i =
04355                              ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
04356 
04357                           sts = matpoint[i]->getStressTensor();
04358            InfoMoment(i*4+1) = GaussCoord(i*3+1); //x
04359            InfoMoment(i*4+2) = GaussCoord(i*3+2); //y
04360            InfoMoment(i*4+3) = GaussCoord(i*3+3); //z
04361            InfoMoment(i*4+4) = sts.cval(3,3);//Assign sigma_zz
04362               //if  (getTag() == 432) {
04363         //    sts.print();
04364         //    opserr << " rs " << rs << "\n "<< InfoMoment(i*4+1) << " " ;
04365         //    opserr << InfoMoment(i*4+2) << " "<< InfoMoment(i*4+3)<< " sts "<< InfoMoment(i*4+4) << "\n ";
04366               //}
04367         if (strcmp(tp, "ElasticIsotropic3D") == 0 ){
04368            Mt(GP_c_t-1) += wt(rs)*sts.cval(3,3)*( InfoMoment(i*4+1)-offset[tag] )/height;//x--Calculating Moment_y wt(ts) / height = Area corresponding to the gauss point stress
04369            //Mt(GP_c_t-1) += wt(rs)*sts.cval(3,3)*( InfoMoment(i*4+2)-offset[tag] )/height; //y--Calculating Moment_x wt(ts) / height = Area corresponding to the gauss point stress
04370                       //Q(GP_c_t-1) += wt(rs)*sts.cval(3,1)/ height;   //Calculating Q
04371         }
04372 
04373               //if  (getTag() == 432) {
04374         //   opserr << (GP_c_t-1) << " " << Mt(GP_c_t-1) << endln ;
04375         //   opserr << (GP_c_t-1) << " " << Q(GP_c_t-1) << endln ;
04376                     //}
04377             }
04378         }
04379     }
04380     //Storing avg. M and Q to InfoMoment
04381     InfoMoment(109+2) = ( Mt(0)+Mt(1)+Mt(2) )*0.3333;
04382     //InfoMoment(109+3) = (  Q(0)+ Q(1)+ Q(2) )*0.3333;
04383     //InfoMoment(109+4) = Mt(1);
04384     //InfoMoment(109+5) = Q(1);
04385     //InfoMoment(109+7) = Mt(2);
04386     //InfoMoment(109+8) = Q(2);
04387 
04388     //opserr << " Mt " << Mt(0) << " " << Mt(1) << " "<< Mt(2) << endln;
04389         return eleInfo.setVector( InfoMoment );
04390         }
04391      case 4:
04392         {
04393                  int count = r_integration_order* s_integration_order * t_integration_order;
04394     int i;
04395                 stresstensor sts;
04396                  //Vector GaussCoord(81+1);  // 8*3 + count
04397     //GaussCoord = this->reportTensor("Gauss Point Coor.");
04398 
04399     //Vector InfoMoment(109 + 3 ); //Z values, x-disp. and corresponding avg. moment
04400     InfoStress(0) = count;
04401 
04402                 for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
04403                 {
04404                     //r = get_Gauss_p_c( r_integration_order, GP_c_r );
04405                     for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
04406                     {
04407                         //s = get_Gauss_p_c( s_integration_order, GP_c_s );
04408                         //rs = (GP_c_r-1)*s_integration_order+GP_c_s-1;
04409 
04410       for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
04411                         {
04412               //for (int i = 0; i < count; i++)
04413                           i =
04414                              ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
04415 
04416                           sts = matpoint[i]->getStressTensor();
04417            InfoStress(i*6+1) = sts.cval(1,1); //sigma_xx
04418            InfoStress(i*6+2) = sts.cval(2,2); //sigma_yy
04419            InfoStress(i*6+3) = sts.cval(3,3); //sigma_zz
04420            InfoStress(i*6+4) = sts.cval(1,2); //Assign sigma_xy
04421            InfoStress(i*6+5) = sts.cval(1,3); //Assign sigma_xz
04422            InfoStress(i*6+6) = sts.cval(2,3); //Assign sigma_yz
04423             }
04424         }
04425     }
04426         return eleInfo.setVector( InfoStress );
04427         }
04428      //Added Joey 03-12-03
04429      case 41:
04430         {
04431                  int count = r_integration_order* s_integration_order * t_integration_order;
04432     count = count / 2;
04433                 stresstensor sts;
04434                 sts = matpoint[count]->getStressTensor();
04435     Info_pq2(0) =sts.p_hydrostatic();
04436     Info_pq2(1) =sts.q_deviatoric();
04437         return eleInfo.setVector( Info_pq2 );
04438         }
04439      case 5:
04440        return eleInfo.setMatrix(this->getTangentStiff());
04441 
04442      case 6:
04443      {
04444     this->computeGaussPoint();
04445        return eleInfo.setVector( GaussCoord );
04446      }
04447 
04448      default:
04449        return -1;
04450   }
04451      //return 0;
04452 }
04453 
04454 
04455 
04457 Vector TwentySevenNodeBrick::getWeightofGP(void)
04458   {
04459     //int M_dim[] = {8,3,3,8};
04460     //int M_dim[] = {81,81};
04461     //tensor Mm(2,M_dim,0.0);
04462 
04463     Vector Weight( FixedOrder * FixedOrder );
04464 
04465     double r  = 0.0;
04466     double rw = 0.0;
04467     double s  = 0.0;
04468     double sw = 0.0;
04469     double t  = 0.0;
04470     double tw = 0.0;
04471 
04472     short where = 0;
04473     short rs = 0;
04474     double tmp = 0;
04475 
04476     double weight = 0.0;
04477 
04478     int dh_dim[] = {27,3};
04479 
04480     tensor dh(2, dh_dim, 0.0);
04481 
04482     double det_of_Jacobian = 0.0;
04483 
04484     tensor Jacobian;
04485 
04486     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
04487       {
04488         r = get_Gauss_p_c( r_integration_order, GP_c_r );
04489         rw = get_Gauss_p_w( r_integration_order, GP_c_r );
04490         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
04491           {
04492             s = get_Gauss_p_c( s_integration_order, GP_c_s );
04493             sw = get_Gauss_p_w( s_integration_order, GP_c_s );
04494 
04495             rs = (GP_c_r-1)*s_integration_order+GP_c_s-1;
04496       Weight(rs) = 0;
04497 
04498             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
04499               {
04500                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
04501                 tw = get_Gauss_p_w( t_integration_order, GP_c_t );
04502                 // this short routine is supposed to calculate position of
04503                 // Gauss point from 3D array of short's
04504                 //where =
04505                 //((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
04506                 // derivatives of local coordinates with respect to local coordinates
04507                 dh = dh_drst_at(r,s,t);
04508                 // Jacobian tensor ( matrix )
04509                 Jacobian = Jacobian_3D(dh);
04510                 det_of_Jacobian  = Jacobian.determinant();
04511 
04512     //H = H_3D(r,s,t);
04513 
04514                 weight = rw * sw * tw * det_of_Jacobian;
04515     Weight(rs) += weight;//Volume calculation
04516                 //opserr << " where " << where << " r  " << r << " s  " << s << " t " << t << endln;
04517 
04518     //Mm = Mm + H("ib")*H("kb")*weight;
04519           //  printf("\n +++++++++++++++++++++++++ \n\n");
04520           //Mm.printshort("M");
04521               }
04522         //opserr << " rs " << rs << " " << Weight(rs) << endln;
04523         tmp += Weight(rs);
04524           }
04525       }
04526     //M = Mm;
04527     //Mm.printshort("M");
04528     //opserr << " total: " << tmp << endln;
04529 
04530     return Weight;
04531   }
04532 
04533 
04535 
04536 
04537 
04538 
04539 //=============================================================================
04540 
04541 //const Matrix&
04542 //TwentySevenNodeBrick::getTangentStiff ()
04543 //{
04544 //  int order = theQuadRule->getOrder();
04545 //  const Vector &intPt = theQuadRule->getIntegrPointCoords();
04546 //  const Vector &intWt = theQuadRule->getIntegrPointWeights();
04547 //
04548 //  const Vector &disp1 = theNodes[0]->getTrialDisp();
04549 //        const Vector &disp2 = theNodes[1]->getTrialDisp();
04550 //  const Vector &disp3 = theNodes[2]->getTrialDisp();
04551 //        const Vector &disp4 = theNodes[3]->getTrialDisp();
04552 //       // Xiaoyan added 5-8 07/06/00
04553 //        const Vector &disp5 = theNodes[4]->getTrialDisp();
04554 //        const Vector &disp6 = theNodes[5]->getTrialDisp();
04555 //  const Vector &disp7 = theNodes[6]->getTrialDisp();
04556 //        const Vector &disp8 = theNodes[7]->getTrialDisp();
04557 //
04558 //  static Vector u(24);      //Changed from u(8) to u(24) Xiaoyn 07/06/00
04559 //
04560 //  u(0) = disp1(0);
04561 //  u(1) = disp1(1);
04562 //        u(2) = disp1(2);
04563 //  u(3) = disp2(0);
04564 //  u(4) = disp2(1);
04565 //  u(5) = disp2(2);
04566 //        u(6) = disp3(0);
04567 //  u(7) = disp3(1);
04568 //  u(8) = disp3(2);
04569 //  u(9) = disp4(0);
04570 //  u(10) = disp4(1);
04571 //  u(11) = disp4(2);
04572 //  u(12) = disp5(0);
04573 //  u(13) = disp5(1);
04574 //  u(14) = disp5(2);
04575 //  u(15) = disp6(0);
04576 //  u(16) = disp6(1);
04577 //  u(17) = disp6(2);
04578 //  u(18) = disp7(0);
04579 //  u(19) = disp7(1);
04580 //  u(20) = disp7(2);
04581 //  u(21) = disp8(0);
04582 //  u(22) = disp8(1);
04583 //  u(23) = disp8(2);
04584 
04585 
04586 //  static Vector eps (6);      // Changed eps(3) to eps(6) Xiaoyan 07/06/00
04587 
04588 //  K.Zero();
04589 
04590 //  // Loop over the integration points
04591 //  for (int i = 0; i < order; i++)
04592 //  {
04593 //    for (int j = 0; j < order; j++)
04594 //    {
04595 //
04596 //      // Determine Jacobian for this integration point
04597 //      this->setJacobian (intPt(i), intPt(j));
04598 //
04599 //      // Interpolate strains
04600 //      this->formBMatrix (intPt(i), intPt(j));
04601 //      eps = B*u;
04602 //
04603 //      // Set the material strain
04604 //      (theMaterial[i][j])->setTrialStrain (eps);
04605 //
04606 //      // Get the material tangent
04607 //      const Matrix &D = (theMaterial[i][j])->getTangent();
04608 //
04609 //      // Form the Jacobian of the coordinate transformation
04610 //      double detJ = this->formDetJ (intPt(i), intPt(j));
04611 //
04612 //      // Perform numerical integration
04613 //      K = K + (B^ D * B) * intWt(i)*intWt(j) * detJ;
04614 //    }
04615 //  }
04616 //
04617 //  K = K * thickness;
04618 //
04619 //  return K;
04620 //}
04621 
04622 //const Matrix&
04623 //TwentySevenNodeBrick::getSecantStiff ()
04624 //{
04625 //  return K;
04626 //}
04627 
04628 //Commented by Xiaoyan     Use the form like Brick3d
04629 //const Matrix & TwentySevenNodeBrick::getDamp ()
04630 //{
04631 //  return C;
04632 //}
04633 // Commented by Xiaoyan 08/04/00
04634 
04635 //const Matrix&
04636 //TwentySevenNodeBrick::getMass ()
04637 //{
04638 //  int order = theQuadRule->getOrder();
04639 //  const Vector &intPt = theQuadRule->getIntegrPointCoords();
04640 //  const Vector &intWt = theQuadRule->getIntegrPointWeights();
04641 //
04642 //  M.Zero();
04643 //
04644 //  int i, j;
04645 //
04646 //  // Loop over the integration points
04647 //  for (i = 0; i < order; i++)
04648 //  {
04649 //    for (j = 0; j < order; j++)
04650 //    {
04651 //      // Determine Jacobian for this integration point
04652 //      this->setJacobian (intPt(i), intPt(j));
04653 //
04654 //      // Interpolate strains
04655 //      this->formNMatrix (intPt(i), intPt(j));
04656 //
04657 //      // Form the Jacobian of the coordinate transformation
04658 //      double detJ = this->formDetJ (intPt(i), intPt(j));
04659 //
04660 //      // Perform numerical integration
04661 //      M = M + (N^ N) * intWt(i)*intWt(j) * detJ;
04662 //    }
04663 //  }
04664 //
04665 //  M = M * thickness * rho;
04666 //
04667 //  // Lumped mass ... can be optional
04668 //  for (i = 0; i < 24; i++)       // Changed 8 to 24  Xiaoyan 07/06/00
04669 //  {
04670 //    double sum = 0.0;
04671 //    for (j = 0; j < 24; j++)    // Changed 8 to 24  Xiaoyan 07/06/00
04672 //    {
04673 //      sum += M(i,j);
04674 //      M(i,j) = 0.0;
04675 //    }
04676 //    M(i,i) = sum;
04677 //  }
04678 //
04679 //  return M;
04680 //}
04681 //
04682 //const Vector&
04683 //TwentySevenNodeBrick::getResistingForce ()
04684 //{
04685 //  int order = theQuadRule->getOrder();
04686 //  const Vector &intPt = theQuadRule->getIntegrPointCoords();
04687 //  const Vector &intWt = theQuadRule->getIntegrPointWeights();
04688 //
04689 //  const Vector &disp1 = theNodes[0]->getTrialDisp();
04690 //        const Vector &disp2 = theNodes[1]->getTrialDisp();
04691 //  const Vector &disp3 = theNodes[2]->getTrialDisp();
04692 //        const Vector &disp4 = theNodes[3]->getTrialDisp();
04693 //  //6-8 added by Xiaoyan 07/06/00
04694 //  const Vector &disp5 = theNodes[4]->getTrialDisp();
04695 //        const Vector &disp6 = theNodes[5]->getTrialDisp();
04696 //  const Vector &disp7 = theNodes[6]->getTrialDisp();
04697 //        const Vector &disp8 = theNodes[7]->getTrialDisp();
04698 //
04699 //
04700 //  static Vector u(24);      //Changed from u(8) to u(24) Xiaoyn 07/06/00
04701 //
04702 //  u(0) = disp1(0);
04703 //  u(1) = disp1(1);
04704 //        u(2) = disp1(2);
04705 //  u(3) = disp2(0);
04706 //  u(4) = disp2(1);
04707 //  u(5) = disp2(2);
04708 //        u(6) = disp3(0);
04709 //  u(7) = disp3(1);
04710 //  u(8) = disp3(2);
04711 //  u(9) = disp4(0);
04712 //  u(10) = disp4(1);
04713 //  u(11) = disp4(2);
04714 //  u(12) = disp5(0);
04715 //  u(13) = disp5(1);
04716 //  u(14) = disp5(2);
04717 //  u(15) = disp6(0);
04718 //  u(16) = disp6(1);
04719 //  u(17) = disp6(2);
04720 //  u(18) = disp7(0);
04721 //  u(19) = disp7(1);
04722 //  u(20) = disp7(2);
04723 //  u(21) = disp8(0);
04724 //  u(22) = disp8(1);
04725 //  u(23) = disp8(2);
04726 //
04727 //  eps (6);      //Changed eps(3) to eps(6) Xiaoyan 07/06/00
04728 //
04729 //  P.Zero();
04730 //
04731 //  // Loop over the integration points
04732 //  for (int i = 0; i < order; i++)
04733 //  {
04734 //    for (int j = 0; j < order; j++)
04735 //    {
04736 //      // Determine Jacobian for this integration point
04737 //      this->setJacobian (intPt(i), intPt(j));
04738 //
04739 //      // Interpolate strains
04740 //      this->formBMatrix (intPt(i), intPt(j));
04741 //      eps = B*u;
04742 //
04743 //      // Set the material strain
04744 //      (theMaterial[i][j])->setTrialStrain (eps);
04745 //
04746 //      // Get material stress response
04747 //      const Vector &sigma = (theMaterial[i][j])->getStress();
04748 //
04749 //      // Form the Jacobian of the coordinate transformation
04750 //      double detJ = this->formDetJ (intPt(i), intPt(j));
04751 //
04752 //      // Perform numerical integration
04753 //      P = P + (B^ sigma) * intWt(i)*intWt(j) * detJ;
04754 //    }
04755 //  }
04756 //
04757 //  P = P * thickness * -1;
04758 //
04759 //  return P;
04760 //}
04761 //
04762 //const Vector&
04763 //TwentySevenNodeBrick::getResistingForceIncInertia ()
04764 //{
04765 //  // Yet to implement
04766 //  return P;
04767 //}
04768 //
04769 //
04770 //
04771 //void
04772 //TwentySevenNodeBrick::Print (OPS_Stream &s, int flag)
04773 //{
04774 //  s << "TwentySevenNodeBrick, element id:  " << this->getTag() << endln;
04775 //  s << "Connected external nodes:  " << connectedExternalNodes;
04776 //  s << "Material model:  " << theMaterial[0][0]->getType() << endln;
04777 //  s << "Element thickness:  " << thickness << endln;
04778 //  s << "Element mass density:  " << rho << endln << endln;
04779 //}
04780 //
04781 //
04782 //int
04783 //TwentySevenNodeBrick::displaySelf (Renderer &theViewer, int displayMode, float fact)
04784 //{
04785     // first determine the end points of the quad based on
04786     // the display factor (a measure of the distorted image)
04787     // store this information in 2 3d vectors v1 and v2
04788 //        const Vector &end1Crd = theNodes[0]->getCrds();
04789 //        const Vector &end2Crd = theNodes[1]->getCrds();
04790 //  const Vector &end3Crd = theNodes[2]->getCrds();
04791 //  const Vector &end4Crd = theNodes[3]->getCrds();
04792 //  // 5-8 were added by Xiaoyan
04793 //        const Vector &end5Crd = theNodes[4]->getCrds();
04794 //        const Vector &end6Crd = theNodes[5]->getCrds();
04795 //  const Vector &end7Crd = theNodes[6]->getCrds();
04796 //  const Vector &end8Crd = theNodes[7]->getCrds();
04798 //      const Vector &end1Disp = theNodes[0]->getDisp();
04799 //  const Vector &end2Disp = theNodes[1]->getDisp();
04800 //  const Vector &end3Disp = theNodes[2]->getDisp();
04801 //  const Vector &end4Disp = theNodes[3]->getDisp();
04802 //
04803   // 5-8 were added by Xiaoyan
04804 //        const Vector &end5Disp = theNodes[4]->getDisp();
04805 //  const Vector &end6Disp = theNodes[5]->getDisp();
04806 //  const Vector &end7Disp = theNodes[6]->getDisp();
04807 //  const Vector &end8Disp = theNodes[7]->getDisp();
04808 //
04809 //  Vector v1(3);
04810 //  Vector v2(3);
04811 //  Vector v3(3);
04812 //  Vector v4(3);
04813 //  //5-8 added by Xiaoyan 07/06/00
04814 //  Vector v5(3);
04815 //  Vector v6(3);
04816 //  Vector v7(3);
04817 //  Vector v8(3);
04818 //
04819 //  for (int i = 0; i < 3; i++)      //Changed from i<2 to i<3, Xiaonyan 07/06/00
04820 //  {
04821 //    v1(i) = end1Crd(i) + end1Disp(i)*fact;
04822 //    v2(i) = end2Crd(i) + end2Disp(i)*fact;
04823 //    v3(i) = end3Crd(i) + end3Disp(i)*fact;
04824 //    v4(i) = end4Crd(i) + end4Disp(i)*fact;
04825 //
04826 //    //5-8 added by Xiaoyan 07/06/00
04827 //       v5(i) = end5Crd(i) + end1Disp(i)*fact;
04828 //    v6(i) = end6Crd(i) + end2Disp(i)*fact;
04829 //    v7(i) = end7Crd(i) + end3Disp(i)*fact;
04830 //    v8(i) = end8Crd(i) + end4Disp(i)*fact;
04831 //  }
04832 //  int error = 0;
04833 //
04834 //  error += theViewer.drawLine (v1, v2, 1.0, 1.0);
04835 //  error += theViewer.drawLine (v2, v3, 1.0, 1.0);
04836 //  error += theViewer.drawLine (v3, v4, 1.0, 1.0);
04837 //  error += theViewer.drawLine (v4, v5, 1.0, 1.0);   // 5-8 added by Xiaoyan 07/06/00
04838 //  error += theViewer.drawLine (v5, v6, 1.0, 1.0);
04839 //  error += theViewer.drawLine (v6, v7, 1.0, 1.0);
04840 //  error += theViewer.drawLine (v7, v8, 1.0, 1.0);
04841 //  error += theViewer.drawLine (v8, v1, 1.0, 1.0);
04842 //
04843 //  return error;
04844 //}
04845 // The following are all commented by  Xiaoyan. We use the Brick3D to form these
04846 
04847 //
04848 //void
04849 //TwentySevenNodeBrick::formNMatrix (double r, double s,double t)
04851 //{
04852 //  N.Zero();
04853 //
04858 //
04860 // The shape functions have been changed from N(2,8) to N(3,24)
04861 // I take the node order according to Bathe's book p344-345. Xiaoyan
04862 //        N(0,0)=N(1,1)=N(2,2)=1/8.*(1.0+r)*(1.0+s)*(1.0+t);
04863 //  N(0,3)=N(1,4)=N(2,5)=1/8.*(1.0-r)*(1.0+s)*(1.0+t);
04864 //  N(0,6)=N(1,7)=N(2,8)=1/8.*(1.0-r)*(1.0-s)*(1.0+t);
04865 //  N(0,9)=N(1,10)=N(2,11)=1/8.*(1.0+r)*(1.0-s)*(1.0+t);
04866 //  N(0,15)=N(1,13)=N(2,14)=1/8.*(1.0+r)*(1.0+s)*(1.0-t);
04867 //  N(0,15)=N(1,16)=N(2,17)=1/8.*(1.0-r)*(1.0+s)*(1.0-t);
04868 //  N(0,18)=N(1,19)=N(2,20)=1/8.*(1.0-r)*(1.0-s)*(1.0-t);
04869 //  N(0,21)=N(1,22)=N(2,23)=1/8.*(1.0+r)*(1.0-s)*(1.0-t);
04870 // }
04871 //void
04872 //TwentySevenNodeBrick::setJacobian (double r, double s, double t)
04874 //{
04875 //  const Vector &nd1Crds = theNodes[0]->getCrds();
04876 //  const Vector &nd2Crds = theNodes[1]->getCrds();
04877 //  const Vector &nd3Crds = theNodes[2]->getCrds();
04878 //  const Vector &nd4Crds = theNodes[3]->getCrds();
04879 //  // Xiaoyan added 5-8 07/06/00
04880 //  const Vector &nd5Crds = theNodes[4]->getCrds();
04881 //  const Vector &nd6Crds = theNodes[5]->getCrds();
04882 //  const Vector &nd7Crds = theNodes[6]->getCrds();
04883 //  const Vector &nd8Crds = theNodes[7]->getCrds();
04884 //
04888 //  J(0,1) = -nd1Crds(0)*(1.0-xi) - nd2Crds(0)*(1.0+xi) +
04889 //        nd3Crds(0)*(1.0+xi) + nd4Crds(0)*(1.0-xi);
04890 //
04891 //  J(1,0) = -nd1Crds(1)*(1.0-eta) + nd2Crds(1)*(1.0-eta) +
04892 //        nd3Crds(1)*(1.0+eta) - nd4Crds(1)*(1.0+eta);
04893 //
04894 //  J(1,1) = -nd1Crds(1)*(1.0-xi) - nd2Crds(1)*(1.0+xi) +
04895 //        nd3Crds(1)*(1.0+xi) + nd4Crds(1)*(1.0-xi);
04896 //      J = J * 0.25;
04897 //
04898 //  // For 3D problem Jacobi Matrix changed from J(2,2) to J(3,3)
04899 //  // Xiaoyan  changed 07/06/00
04900 //
04901 //
04902 //  J(0,0) = nd1Crds(0)*(1.0+s)*(1.0+t) - nd2Crds(0)*(1.0+s)*(1.0+t) -
04903 //     nd3Crds(0)*(1.0-s)*(1.0+t) + nd4Crds(0)*(1.0-s)*(1.0+t) +
04904 //     nd5Crds(0)*(1.0+s)*(1.0-t) - nd6Crds(0)*(1.0+s)*(1.0-t) -
04905 //     nd7Crds(0)*(1.0-s)*(1.0-t) + nd8Crds(0)*(1.0-s)*(1.0-t);
04906 //
04907 //  J(0,1) = nd1Crds(1)*(1.0+s)*(1.0+t) - nd2Crds(1)*(1.0+s)*(1.0+t) -
04908 //     nd3Crds(1)*(1.0-s)*(1.0+t) + nd4Crds(1)*(1.0-s)*(1.0+t) +
04909 //     nd5Crds(1)*(1.0+s)*(1.0-t) - nd6Crds(1)*(1.0+s)*(1.0-t) -
04910 //     nd7Crds(1)*(1.0-s)*(1.0-t) + nd8Crds(1)*(1.0-s)*(1.0-t);
04911 //
04912 //  J(0,2) = nd1Crds(2)*(1.0+s)*(1.0+t) - nd2Crds(2)*(1.0+s)*(1.0+t) -
04913 //     nd3Crds(2)*(1.0-s)*(1.0+t) + nd4Crds(2)*(1.0-s)*(1.0+t) +
04914 //     nd5Crds(2)*(1.0+s)*(1.0-t) - nd6Crds(2)*(1.0+s)*(1.0-t) -
04915 //     nd7Crds(2)*(1.0-s)*(1.0-t) + nd8Crds(2)*(1.0-s)*(1.0-t);
04916 //
04917 //  J(1,0) = nd1Crds(0)*(1.0+r)*(1.0+t) + nd2Crds(0)*(1.0-r)*(1.0+t) -
04918 //     nd3Crds(0)*(1.0-r)*(1.0+t) - nd4Crds(0)*(1.0+r)*(1.0+t) +
04919 //     nd5Crds(0)*(1.0+r)*(1.0-t) + nd6Crds(0)*(1.0-r)*(1.0-t) -
04920 //     nd7Crds(0)*(1.0-r)*(1.0-t) - nd8Crds(0)*(1.0+r)*(1.0-t);
04921 //
04922 //  J(1,1) = nd1Crds(1)*(1.0+r)*(1.0+t) + nd2Crds(1)*(1.0-r)*(1.0+t) -
04923 //     nd3Crds(1)*(1.0-r)*(1.0+t) - nd4Crds(1)*(1.0+r)*(1.0+t) +
04924 //     nd5Crds(1)*(1.0+r)*(1.0-t) + nd6Crds(1)*(1.0-r)*(1.0-t) -
04925 //     nd7Crds(1)*(1.0-r)*(1.0-t) - nd8Crds(1)*(1.0+r)*(1.0-t);
04926 //
04927 //        J(1,2) = nd1Crds(2)*(1.0+r)*(1.0+t) + nd2Crds(2)*(1.0-r)*(1.0+t) -
04928 //     nd3Crds(2)*(1.0-r)*(1.0+t) - nd4Crds(2)*(1.0+r)*(1.0+t) +
04929 //     nd5Crds(2)*(1.0+r)*(1.0-t) + nd6Crds(2)*(1.0-r)*(1.0-t) -
04930 //     nd7Crds(2)*(1.0-r)*(1.0-t) - nd8Crds(2)*(1.0+r)*(1.0-t);
04931 //
04932 //  J(2,0) = nd1Crds(0)*(1.0+r)*(1.0+s) + nd2Crds(0)*(1.0-r)*(1.0+s) +
04933 //     nd3Crds(0)*(1.0-r)*(1.0-s) + nd4Crds(0)*(1.0+r)*(1.0-s) -
04934 //     nd5Crds(0)*(1.0+r)*(1.0+s) - nd6Crds(0)*(1.0-r)*(1.0+s) -
04935 //     nd7Crds(0)*(1.0-r)*(1.0-s) - nd8Crds(0)*(1.0+r)*(1.0-s);
04936 //
04937 //  J(2,1) = nd1Crds(1)*(1.0+r)*(1.0+s) + nd2Crds(1)*(1.0-r)*(1.0+s) +
04938 //     nd3Crds(1)*(1.0-r)*(1.0-s) + nd4Crds(1)*(1.0+r)*(1.0-s) -
04939 //     nd5Crds(1)*(1.0+r)*(1.0+s) - nd6Crds(1)*(1.0-r)*(1.0+s) -
04940 //     nd7Crds(1)*(1.0-r)*(1.0-s) - nd8Crds(1)*(1.0+r)*(1.0-s);
04941 //
04942 //  J(2,2) = nd1Crds(2)*(1.0+r)*(1.0+s) + nd2Crds(2)*(1.0-r)*(1.0+s) +
04943 //     nd3Crds(2)*(1.0-r)*(1.0-s) + nd4Crds(2)*(1.0+r)*(1.0-s) -
04944 //     nd5Crds(2)*(1.0+r)*(1.0+s) - nd6Crds(2)*(1.0-r)*(1.0+s) -
04945 //     nd7Crds(2)*(1.0-r)*(1.0-s) - nd8Crds(2)*(1.0+r)*(1.0-s);
04946 //
04947 //   J=J*0.155
04948 //
04949 //    // L = inv(J)  Changed from L(2,2) to L(3,3)  07/07/00
04950 //
04951 //  L(0,0)=-J(1,2)*J(2,1) + J(1,1)*J(2,2);
04952 //  L(0.1)= J(0,2)*J(2,1) - J(0,1)*J(2,2);
04953 //  L(0,3)=-J(0,2)*J(1,1) + J(0,1)*J(1,2);
04954 //  L(1,0)= J(1,2)*J(2,0) - J(1,0)*J(2,2);
04955 //  L(1,1)=-J(0,2)*J(2,0) + J(0,0)*J(2.2);
04956 //  L(1,2)= J(0,2)*J(1,0) - J(0,0)*J(1,2);
04957 //  L(2,0)=-J(1,1)*J(2,0) + J(1,0)*J(2,1);
04958 //  L(2,1)= J(0,1)*J(2,0) - J(0,0)*J(2,1);
04959 //  L(2,2)=-J(0,1)*J(1,0) + J(0,0)*J(1,1);
04960 //  L=L/formDetJ(r,s,t)
04961 //
04962 //  L(0,0) = J(1,1);
04963 //  L(1,0) = -J(0,1);
04964 //  L(0,1) = -J(1,0);
04965 //  L(1,1) = J(0,0);
04966 
04967 //  L = L / formDetJ (xi, eta);
04968 //}
04969 //
04970 //void
04971 //TwentySevenNodeBrick::formBMatrix (double r, double s, double t)
04973 //{
04974 //    B.Zero();
04975 //
04976 //    //Changed by Xiaoyan 07/06/00
04977 //    double L00 = L(0,0);
04978 //    double L01 = L(0,1);
04979 //    double L02 = L(0,1);
04980 //    double L10 = L(1,0);
04981 //    double L11 = L(1,1);
04982 //    double L15 = L(1,2);
04983 //    double L20 = L(2,0);
04984 //    double L21 = L(2,1);
04985 //    double L22 = L(2,2);
04986 //
04987 //    // See Cook, Malkus, Plesha p. 169 for the derivation of these terms
04988 //    B(0,0) = L00*-0.25*(1.0-eta) + L01*-0.25*(1.0-xi);    // N_1,1
04989 //    B(0,2) = L00*0.25*(1.0-eta) + L01*-0.25*(1.0+xi);    // N_2,1
04990 //    B(0,4) = L00*0.25*(1.0+eta) + L01*0.25*(1.0+xi);    // N_3,1
04991 //    B(0,6) = L00*-0.25*(1.0+eta) + L01*0.25*(1.0-xi);    // N_4,1
04992 //
04993 //    B(1,1) = L10*-0.25*(1.0-eta) + L11*-0.25*(1.0-xi);    // N_1,2
04994 //    B(1,3) = L10*0.25*(1.0-eta) + L11*-0.25*(1.0+xi);    // N_2,2
04995 //    B(1,5) = L10*0.25*(1.0+eta) + L11*0.25*(1.0+xi);    // N_3,2
04996 //    B(1,7) = L10*-0.25*(1.0+eta) + L11*0.25*(1.0-xi);    // N_4,2
04997 //
04998 //    B(2,0) = B(1,1);
04999 //    B(2,1) = B(0,0);
05000 //    B(2,2) = B(1,3);
05001 //    B(2,3) = B(0,2);
05002 //    B(2,4) = B(1,5);
05003 //    B(2,5) = B(0,4);
05004 //    B(2,6) = B(1,7);
05005 //    B(2,7) = B(0,6);
05006 //}
05007 //
05008 //
05009 //
05012 //double  dh1dr=0.155*(1+s)*(1+t);
05013 //double  dh1ds=0.155*(1+r)*(1+t);
05014 //double  dh1dt=0.155*(1+r)*(1+s);
05015 //
05016 //double  dh2dr=-0.155*(1+s)*(1+t);
05017 //double  dh2ds=0.155*(1-r)*(1+t);
05018 //double  dh2dt=0.155*(1-r)*(1+s);
05019 //
05020 //double  dh3dr=-0.155*(1-s)*(1+t);
05021 //double  dh3ds=-0.155*(1-r)*(1+t);
05022 //double  dh3dt=0.155*(1-r)*(1-s);
05023 //
05024 //double  dh4dr=0.155*(1-s)*(1+t);
05025 //double  dh4ds=-0.155*(1+r)*(1+t);
05026 //double  dh4dt=0.155*(1+r)*(1-s);
05027 //
05028 //double  dh5dr=0.155*(1+s)*(1-t);
05029 //double  dh5ds=0.155*(1+r)*(1-t);
05030 //double  dh5dt=-0.155*(1+r)*(1+s);
05031 //
05032 //double  dh6dr=-0.155*(1+s)*(1-t);
05033 //double  dh6ds=0.155*(1-r)*(1-t);
05034 //double  dh6dt=-0.155*(1-r)*(1+s);
05035 //
05036 //double  dh7dr=-0.155*(1-s)*(1-t);
05037 //double  dh7ds=-0.155*(1-r)*(1-t);
05038 //double  dh7dt=-0.155*(1-r)*(1-s);
05039 //
05040 //double  dh8dr=0.155*(1-s)*(1-t);
05041 //double  dh8ds=-0.155*(1+r)*(1-t);
05042 //double  dh8dt=-0.155*(1+r)*(1-s);
05043 //
05045 //B(0,0)=L00*dh1dr+L01*dh1ds+L02*dh1dt;
05046 //B(0,3)=L00*dh2dr+L01*dh2ds+L02*dh2dt;
05047 //B(0,6)=L00*dh3dr+L01*dh3ds+L02*dh3dt;
05048 //B(0,9)=L00*dh4dr+L01*dh4ds+L02*dh4dt;
05049 //B(0,15)=L00*dh5dr+L01*dh5ds+L02*dh5dt;
05050 //B(0,15)=L00*dh6dr+L01*dh6ds+L02*dh6dt;
05051 //B(0,18)=L00*dh7dr+L01*dh7ds+L02*dh7dt;
05052 //B(0,21)=L00*dh8dr+L01*dh8ds+L02*dh8dt;
05053 //
05054 //B(1,1)=L10*dh1dr+L11*dh1ds+L15*dh1dt;
05055 //B(1,4)=L10*dh2dr+L11*dh2ds+L15*dh2dt;
05056 //B(1,7)=L10*dh3dr+L11*dh3ds+L15*dh3dt;
05057 //B(1,10)=L10*dh4dr+L11*dh4ds+L15*dh4dt;
05058 //B(1,13)=L10*dh5dr+L11*dh5ds+L15*dh5dt;
05059 //B(1,16)=L10*dh6dr+L11*dh6ds+L15*dh6dt;
05060 //B(1,19)=L10*dh7dr+L11*dh7ds+L15*dh7dt;
05061 //B(1,22)=L10*dh8dr+L11*dh8ds+L15*dh8dt;
05062 //
05063 //B(2,2)=L20d*h1dr+L21*dh1ds+L22*dh1dt;
05064 //B(2,5)=L20d*h2dr+L21*dh2ds+L22*dh2dt;
05065 //B(2,8)=L20d*h3dr+L21*dh3ds+L22*dh3dt;
05066 //B(2,11)=L20*dh4dr+L21*dh4ds+L22*dh4dt;
05067 //B(2,14)=L20*dh5dr+L21*dh5ds+L22*dh5dt;
05068 //B(2,17)=L20*dh6dr+L21*dh6ds+L22*dh6dt;
05069 //B(2,20)=L20*dh7dr+L21*dh7ds+L22*dh7dt;
05070 //B(2,23)=L20*dh8dr+L21*dh8ds+L22*dh8dt;
05071 //
05072 //B(3,0)=B(1,1);
05073 //B(3,1)=B(0,0);
05074 //B(3,3)=B(1,4);
05075 //B(3,4)=B(0,3);
05076 //B(3,6)=B(1,7);
05077 //B(3,7)=B(0,6);
05078 //B(3,9)=B(1,10);
05079 //B(3,10)=B(0,9);
05080 //B(3,15)=B(1,13);
05081 //B(3,13)=B(0,15);
05082 //B(3,15)=B(1,16);
05083 //B(3,16)=B(0,15);
05084 //B(3,18)=B(1,19);
05085 //B(3,19)=B(0,18);
05086 //B(3,21)=B(1,22);
05087 //B(3,22)=B(0,21);
05088 //
05089 //B(4,1)=B(2,2);
05090 //B(4,2)=B(1,1);
05091 //B(4,4)=B(2,5);
05092 //B(4,5)=B(1,4);
05093 //B(4,7)=B(2,8);
05094 //B(4,8)=B(1,7);
05095 //B(4,10)=B(2,11);
05096 //B(4,11)=B(1,10);
05097 //B(4,13)=B(2,14);
05098 //B(4,14)=B(1,13);
05099 //B(4,16)=B(2,17);
05100 //B(4,17)=B(1,16);
05101 //B(4,19)=B(2,20);
05102 //B(4,20)=B(1,19);
05103 //B(4,21)=B(2,23);
05104 //B(4,23)=B(1,22);
05105 //
05106 //B(5,0)=B(2,2);
05107 //B(5,2)=B(0,0);
05108 //B(5,3)=B(2,5);
05109 //B(5,5)=B(0,3);
05110 //B(5,6)=B(2,8);
05111 //B(5,8)=B(0,6);
05112 //B(5,9)=B(2,11);
05113 //B(5,11)=B(0,9);
05114 //B(5,15)=B(2,14);
05115 //B(5,14)=B(0,15);
05116 //B(5,15)=B(2,17);
05117 //B(5,17)=B(0,15);
05118 //B(5,18)=B(2,20);
05119 //B(5,20)=B(2,18);
05120 //B(5,21)=B(0,23);
05121 //B(5,23)=B(0,21);
05122 //
05123 //B(3,3)= L00*dh2dr+L01*dh2ds+L02*dh2dt;
05124 //B(3,6)= L00*dh3dr+L01*dh3ds+L02*dh3dt;
05125 //B(3,9)= L00*dh4dr+L01*dh4ds+L02*dh4dt;
05126 //B(3,15)=L00*dh5dr+L01*dh5ds+L02*dh5dt;
05127 //B(3,15)=L00*dh6dr+L01*dh6ds+L02*dh6dt;
05128 //B(3,18)=L00*dh7dr+L01*dh7ds+L02*dh7dt;
05129 //B(3,21)=L00*dh8dr+L01*dh8ds+L02*dh8dt;
05130 //double
05131 //TwentySevenNodeBrick::formDetJ (double r, double s, double t)
05132 //{
05133 //    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)
05134 //         - 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);
05135 //}
05136 
05137 
05138 double TwentySevenNodeBrick::get_Gauss_p_c(short order, short point_numb)
05139   {
05140 //  Abscissae coefficient of the Gaussian quadrature formula
05141 // starting from 1 not from 0
05142     static double Gauss_coordinates[7][7];
05143 
05144     Gauss_coordinates[1][1] = 0.0 ;
05145     Gauss_coordinates[2][1] = -0.577350269189626;
05146     Gauss_coordinates[2][2] = -Gauss_coordinates[2][1];
05147     Gauss_coordinates[3][1] = -0.774596669241483;
05148     Gauss_coordinates[3][2] = 0.0;
05149     Gauss_coordinates[3][3] = -Gauss_coordinates[3][1];
05150     Gauss_coordinates[4][1] = -0.861136311594053;
05151     Gauss_coordinates[4][2] = -0.339981043584856;
05152     Gauss_coordinates[4][3] = -Gauss_coordinates[4][2];
05153     Gauss_coordinates[4][4] = -Gauss_coordinates[4][1];
05154     Gauss_coordinates[5][1] = -0.906179845938664;
05155     Gauss_coordinates[5][2] = -0.538469310105683;
05156     Gauss_coordinates[5][3] = 0.0;
05157     Gauss_coordinates[5][4] = -Gauss_coordinates[5][2];
05158     Gauss_coordinates[5][5] = -Gauss_coordinates[5][1];
05159     Gauss_coordinates[6][1] = -0.932469514203152;
05160     Gauss_coordinates[6][2] = -0.661509386466265;
05161     Gauss_coordinates[6][3] = -0.238619188183197;
05162     Gauss_coordinates[6][4] = -Gauss_coordinates[6][3];
05163     Gauss_coordinates[6][5] = -Gauss_coordinates[6][2];
05164     Gauss_coordinates[6][6] = -Gauss_coordinates[6][1];
05165 
05166     return Gauss_coordinates[order][point_numb];
05167  }
05168 
05169 double TwentySevenNodeBrick::get_Gauss_p_w(short order, short point_numb)
05170   {
05171 //  Weight coefficient of the Gaussian quadrature formula
05172 // starting from 1 not from 0
05173     static double Gauss_weights[7][7]; // static data ??
05174 
05175     Gauss_weights[1][1] = 2.0;
05176     Gauss_weights[2][1] = 1.0;
05177     Gauss_weights[2][2] = 1.0;
05178     Gauss_weights[3][1] = 0.555555555555556;
05179     Gauss_weights[3][2] = 0.888888888888889;
05180     Gauss_weights[3][3] = Gauss_weights[3][1];
05181     Gauss_weights[4][1] = 0.347854845137454;
05182     Gauss_weights[4][2] = 0.652145154862546;
05183     Gauss_weights[4][3] = Gauss_weights[4][2];
05184     Gauss_weights[4][4] = Gauss_weights[4][1];
05185     Gauss_weights[5][1] = 0.236926885056189;
05186     Gauss_weights[5][2] = 0.478628670499366;
05187     Gauss_weights[5][3] = 0.568888888888889;
05188     Gauss_weights[5][4] = Gauss_weights[5][2];
05189     Gauss_weights[5][5] = Gauss_weights[5][1];
05190     Gauss_weights[6][1] = 0.171324492379170;
05191     Gauss_weights[6][2] = 0.381761573048139;
05192     Gauss_weights[6][3] = 0.467913934572691;
05193     Gauss_weights[6][4] = Gauss_weights[6][3];
05194     Gauss_weights[6][5] = Gauss_weights[6][2];
05195     Gauss_weights[6][6] = Gauss_weights[6][1];
05196 
05197     return Gauss_weights[order][point_numb];
05198   }
05199 
05200 int TwentySevenNodeBrick::update()  //Guanzhou added May 6, 2004
05201   {
05202     double r  = 0.0;
05203     // double rw = 0.0;
05204     double s  = 0.0;
05205     // double sw = 0.0;
05206     double t  = 0.0;
05207     // double tw = 0.0;
05208 
05209     short where = 0;
05210     //,,,,,    double weight = 0.0;
05211 
05212     int dh_dim[] = {27,3};
05213     tensor dh(2, dh_dim, 0.0);
05214 
05215 
05216     static int disp_dim[] = {27,3};
05217     tensor incremental_displacements(2,disp_dim,0.0);
05218 
05219     straintensor incremental_strain;
05220 
05221     tensor Jacobian;
05222     tensor JacobianINV;
05223     tensor dhGlobal;
05224 
05225     incremental_displacements = incr_disp();
05226 
05227     for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
05228       {
05229         r = get_Gauss_p_c( r_integration_order, GP_c_r );
05230         //--        rw = get_Gauss_p_w( r_integration_order, GP_c_r );
05231         for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
05232           {
05233             s = get_Gauss_p_c( s_integration_order, GP_c_s );
05234             //--            sw = get_Gauss_p_w( s_integration_order, GP_c_s );
05235             for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
05236             {
05237                 t = get_Gauss_p_c( t_integration_order, GP_c_t );
05238                 //--                tw = get_Gauss_p_w( t_integration_order, GP_c_t );
05239                 // this short routine is supposed to calculate position of
05240                 // Gauss point from 3D array of short's
05241                 where =
05242                    ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
05243                 // derivatives of local coordiantes with respect to local coordiantes
05244                 dh = dh_drst_at(r,s,t);
05245                 // Jacobian tensor ( matrix )
05246                 Jacobian = Jacobian_3D(dh);
05247                 //....                Jacobian.print("J");
05248                 // Inverse of Jacobian tensor ( matrix )
05249                 JacobianINV = Jacobian_3Dinv(dh);
05250                 //....                JacobianINV.print("JINV");
05251                 // determinant of Jacobian tensor ( matrix )
05252                 //--                det_of_Jacobian  = Jacobian.determinant();
05253                 //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
05254                 // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
05255                 //dhGlobal = dh("ij") * JacobianINV("jk"); // Zhaohui 09-02-2001
05256                 dhGlobal = dh("ij") * JacobianINV("kj");
05257                 //....                dhGlobal.print("dh","dhGlobal");
05258                 //weight
05259                 //                weight = rw * sw * tw * det_of_Jacobian;
05260                 //::::::   ::printf("\n\nIN THE STIFFNESS TENSOR INTEGRATOR ----**************** where = %d \n", where);
05261                 //::::::   ::printf(" void TwentySevenNodeBrick::incremental_Update()\n");
05262                 //::::::   ::printf(" GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d    --->>>  where = %d \n",
05263                 //::::::                      GP_c_r,GP_c_s,GP_c_t,where);
05264                 //::::::   ::printf("WEIGHT = %f", weight);
05265                 //::::::   ::printf("determinant of Jacobian = %f", determinant_of_Jacobian);
05266                 //::::::   matpoint[where].report("Gauss Point\n");
05267                 // incremental straines at this Gauss point
05268                 // now in Update we know the incremental displacements so let's find
05269                 // the incremental strain
05270                 incremental_strain =
05271                     (dhGlobal("ib")*incremental_displacements("ia")).symmetrize11();
05272                 incremental_strain.null_indices();
05273                 //incremental_strain.reportshort("\n incremental_strain tensor at GAUSS point\n");
05274 
05275                 // here comes the final_stress calculation actually on only needs to copy stresses
05276                 // from the iterative data . . .
05277                 //(GPstress+where)->reportshortpqtheta("\n stress START GAUSS \n");
05278 
05279     if ( ( (matpoint[where]->matmodel)->setTrialStrainIncr( incremental_strain)) )
05280       opserr << "TwentySevenNodeBrick::update (tag: " << this->getTag() << "), update() failed\n";
05281             }
05282           }
05283       }
05284     return 0;
05285   }
05286 
05287 
05288 
05289 #endif

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