TwentyNodeBrick.cpp

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

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