Subversion Repositories OpenSees

Rev

Rev 584 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
568 jeremic 1
///////////////////////////////////////////////////////////////////////////////
2
//
586 jeremic 3
// COPYLEFT (C):     :-))
4
//``This  source code is Copyrighted in U.S., by the The Regents of the University
5
//of California, for an indefinite period, and anybody caught using it without our
6
//permission,  will  be  mighty  good friends of ourn, cause we don't give a darn.
7
//Hack  it.  Compile it. Debug it. Run it. Yodel it. Enjoy it. We wrote it, that's
8
//all we wanted to do.'' bj
9
//
10
//
11
//
568 jeremic 12
// PROJECT:           Object Oriented Finite Element Program
13
// FILE:              TwentyNodeBrick.cpp
14
// CLASS:             TwentyNodeBrick
15
// MEMBER FUNCTIONS:
16
//
17
// MEMBER VARIABLES
18
//
19
// PURPOSE:           Finite Element Class
20
// RETURN:
21
// VERSION:
22
// LANGUAGE:          C++
23
// TARGET OS:         DOS || UNIX || . . .
24
// DESIGNER:          Boris Jeremic, Zhaohui Yang and Xiaoyan Wu
25
// PROGRAMMER:        Boris Jeremic, Zhaohui Yang  and Xiaoyan Wu
26
// DATE:              Aug. 2001
27
// UPDATE HISTORY:
586 jeremic 28
//                                                                                                                                                       Sept 2001 optimized to some extent (static tensors...)
568 jeremic 29
//
30
//
31
//
32
///////////////////////////////////////////////////////////////////////////////
33
//
34
 
35
#ifndef TWENTYNODEBRICK_CPP
36
#define TWENTYNODEBRICK_CPP
37
 
38
#include <NDMaterial.h>
39
#include <Matrix.h>
40
#include <Vector.h>
41
#include <ID.h>
42
#include <Renderer.h>
43
#include <Domain.h>
44
#include <string.h>
45
#include <Information.h>
46
#include <Channel.h>
47
#include <FEM_ObjectBroker.h>
48
#include <ElementResponse.h>
49
 
50
#include "TwentyNodeBrick.h"
51
#define FixedOrder 3
52
 
586 jeremic 53
Matrix TwentyNodeBrick::K(60, 60);
54
Matrix TwentyNodeBrick::C(60, 60);
55
Matrix TwentyNodeBrick::M(60, 60);
56
Vector TwentyNodeBrick::P(60);
57
 
568 jeremic 58
//====================================================================
59
// Constructor
60
//====================================================================
61
 
62
TwentyNodeBrick::TwentyNodeBrick(int element_number,
63
                               int node_numb_1,  int node_numb_2,  int node_numb_3,  int node_numb_4,
64
                               int node_numb_5,  int node_numb_6,  int node_numb_7,  int node_numb_8,
65
                               int node_numb_9,  int node_numb_10, int node_numb_11, int node_numb_12,
66
                               int node_numb_13, int node_numb_14, int node_numb_15, int node_numb_16,
67
                               int node_numb_17, int node_numb_18, int node_numb_19, int node_numb_20,
68
                               NDMaterial * Globalmmodel, double b1, double b2,double b3,
69
                               double r, double p)
70
 
71
  :Element(element_number, ELE_TAG_TwentyNodeBrick ),
586 jeremic 72
  connectedExternalNodes(20), Q(60), bf(3),
568 jeremic 73
  rho(r), pressure(p)
74
  {
75
    //elem_numb = element_number;
76
    bf(0) = b1;
77
    bf(1) = b2;
78
    bf(2) = b3;
79
 
80
    determinant_of_Jacobian = 0.0;
81
 
82
    //r_integration_order = r_int_order;
83
    //s_integration_order = s_int_order;
84
    //t_integration_order = t_int_order;
85
    r_integration_order = FixedOrder; // Gauss-Legendre integration order in r direction
86
    s_integration_order = FixedOrder; // Gauss-Legendre integration order in s direction
87
    t_integration_order = FixedOrder; // Gauss-Legendre integration order in t direction
88
 
89
    //Not needed. Right now we have one NDMaterial for each material point
90
    //mmodel = Globalmmodel->getCopy( type ); // One global mat model
91
 
92
    int total_number_of_Gauss_points = r_integration_order*s_integration_order*t_integration_order;
93
 
94
 
95
    if ( total_number_of_Gauss_points != 0 )
96
      {
97
        matpoint  = new MatPoint3D * [total_number_of_Gauss_points];
98
      }
99
    else
100
      {
101
        matpoint  = 0;
102
      }
103
    ////////////////////////////////////////////////////////////////////
104
    short where = 0;
105
 
106
    for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
107
      {
108
        double r = get_Gauss_p_c( r_integration_order, GP_c_r );
109
        double rw = get_Gauss_p_w( r_integration_order, GP_c_r );
110
 
111
        for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
112
          {
113
            double s = get_Gauss_p_c( s_integration_order, GP_c_s );
114
            double sw = get_Gauss_p_w( s_integration_order, GP_c_s );
115
 
116
            for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
117
              {
118
                double t = get_Gauss_p_c( t_integration_order, GP_c_t );
119
                double tw = get_Gauss_p_w( t_integration_order, GP_c_t );
120
 
121
                // this short routine is supposed to calculate position of
122
                // Gauss point from 3D array of short's
123
                where =
124
                ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
125
 
126
                //DB::printf("\n\nBefore Initialization **************** where = %d \n",where);
127
                //DB::printf("GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
128
                //DB            GP_c_r,GP_c_s,GP_c_t);
129
                //DB
130
                //DBGPstress[where].reportshort("stress within before Initialization");
131
                //DBGPstrain[where].reportshort("strain within before Initialization");
132
                //DB
133
                //DB// I suspect that [] should be overloaded so that compiler knows which
134
                //DB// material model is returning a pointer and fot the purpose
135
                //DB//matpoint[where].report("mmodel within before Initialization");
136
                //DB//matpoint[where].report("mmodel within before Initialization"); // operator[] overloaded
137
                //DB(matpoint)->operator[](where).report("mmodel within before Initialization"); // operator[] overloaded
138
                //DB                                                               // for NDMaterial and
139
                //DB                                                               // derived types!
140
 
141
                              matpoint[where] = new MatPoint3D(GP_c_r,
142
                                                 GP_c_s,
143
                                                 GP_c_t,
144
                                                 r, s, t,
145
                                                 rw, sw, tw,
146
                                               //InitEPS,
147
                                                                                    Globalmmodel);
148
                                         //NMD);
149
                                         //&( GPstress[where] ), //&( GPiterative_stress[where] ), //IN_q_ast_iterative[where] ,//&( GPstrain[where] ),  //&( GPtangent_E[where] ),
150
                                         //&( (matpoint)->operator[](where) )
151
                                         // ugly syntax but it works! Still don't know what's wrong   // with the old style matpoint[where]
152
              }
153
          }
154
      }
155
 
156
      // Set connected external node IDs
157
      connectedExternalNodes( 0) = node_numb_1;
158
      connectedExternalNodes( 1) = node_numb_2;
159
      connectedExternalNodes( 2) = node_numb_3;
160
      connectedExternalNodes( 3) = node_numb_4;
161
      connectedExternalNodes( 4) = node_numb_5;
162
      connectedExternalNodes( 5) = node_numb_6;
163
      connectedExternalNodes( 6) = node_numb_7;
164
      connectedExternalNodes( 7) = node_numb_8;
586 jeremic 165
 
568 jeremic 166
      connectedExternalNodes( 8) = node_numb_9;
167
      connectedExternalNodes( 9) = node_numb_10;
168
      connectedExternalNodes(10) = node_numb_11;
169
      connectedExternalNodes(11) = node_numb_12;
170
 
171
      connectedExternalNodes(12) = node_numb_13;
172
      connectedExternalNodes(13) = node_numb_14;
173
      connectedExternalNodes(14) = node_numb_15;
174
      connectedExternalNodes(15) = node_numb_16;
175
 
176
      connectedExternalNodes(16) = node_numb_17;
177
      connectedExternalNodes(17) = node_numb_18;
178
      connectedExternalNodes(18) = node_numb_19;
179
      connectedExternalNodes(19) = node_numb_20;
180
 
181
      nodes_in_brick = 20;
182
 
183
}
184
 
185
//====================================================================
186
TwentyNodeBrick::TwentyNodeBrick ():Element(0, ELE_TAG_TwentyNodeBrick ),
586 jeremic 187
connectedExternalNodes(20), Q(60), bf(3), rho(0.0), pressure(0.0), mmodel(0)
568 jeremic 188
{
189
     matpoint = 0;
190
}
191
 
192
 
193
//#############################################################################
194
 
195
 
196
/////////////////////////////////////////////////////////////////////////////
197
/////////////////////////////////////////////////////////////////////////////
198
TwentyNodeBrick::~TwentyNodeBrick ()
199
{
200
 
201
    int total_number_of_Gauss_points = r_integration_order*s_integration_order*t_integration_order;
202
 
203
    for (int i = 0; i < total_number_of_Gauss_points; i++)
204
    {
205
        // Delete the NDMaterials at each integration point
206
        if (matpoint[i])
207
           delete matpoint[i];
208
    }
209
 
210
    // Delete the array of pointers to NDMaterial pointer arrays
211
    if (matpoint)
212
        delete [] matpoint;
213
 
214
}
215
 
216
/////////////////////////////////////////////////////////////////////////////
217
/////////////////////////////////////////////////////////////////////////////
218
/////////////////////////////////////////////////////////////////////////////
219
void TwentyNodeBrick::incremental_Update()
220
  {
221
    double r  = 0.0;
222
    // double rw = 0.0;
223
    double s  = 0.0;
224
    // double sw = 0.0;
225
    double t  = 0.0;
226
    // double tw = 0.0;
227
 
228
    short where = 0;
229
    //,,,,,    double weight = 0.0;
230
 
231
    //double this_one_PP = (matpoint)->operator[](where).IS_Perfect_Plastic();
232
 
233
    int dh_dim[] = {20,3};
234
    tensor dh(2, dh_dim, 0.0);
235
 
236
 
237
    static int disp_dim[] = {20,3};
238
    tensor incremental_displacements(2,disp_dim,0.0);
239
 
240
    straintensor incremental_strain;
241
 
242
    tensor Jacobian;
243
    tensor JacobianINV;
244
    tensor dhGlobal;
245
 
246
    incremental_displacements = incr_disp();
247
 
248
    for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
249
      {
250
        r = get_Gauss_p_c( r_integration_order, GP_c_r );
251
        //--        rw = get_Gauss_p_w( r_integration_order, GP_c_r );
252
        for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
253
          {
254
            s = get_Gauss_p_c( s_integration_order, GP_c_s );
255
            //--            sw = get_Gauss_p_w( s_integration_order, GP_c_s );
256
            for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
257
            {
258
                t = get_Gauss_p_c( t_integration_order, GP_c_t );
259
                //--                tw = get_Gauss_p_w( t_integration_order, GP_c_t );
260
                // this short routine is supposed to calculate position of
261
                // Gauss point from 3D array of short's
262
                where =
263
                   ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
264
                // derivatives of local coordiantes with respect to local coordiantes
265
                dh = dh_drst_at(r,s,t);
266
                // Jacobian tensor ( matrix )
267
                Jacobian = Jacobian_3D(dh);
268
                //....                Jacobian.print("J");
269
                // Inverse of Jacobian tensor ( matrix )
270
                JacobianINV = Jacobian_3Dinv(dh);
271
                //....                JacobianINV.print("JINV");
272
                // determinant of Jacobian tensor ( matrix )
273
                //--                det_of_Jacobian  = Jacobian.determinant();
274
                //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
275
                // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
586 jeremic 276
                //dhGlobal = dh("ij") * JacobianINV("jk"); // Zhaohui 09-02-2001
584 jeremic 277
                dhGlobal = dh("ij") * JacobianINV("kj");
568 jeremic 278
                //....                dhGlobal.print("dh","dhGlobal");
279
                //weight
280
                //                weight = rw * sw * tw * det_of_Jacobian;
281
                //::::::   ::printf("\n\nIN THE STIFFNESS TENSOR INTEGRATOR ----**************** where = %d \n", where);
282
                //::::::   ::printf(" void TwentyNodeBrick::incremental_Update()\n");
283
                //::::::   ::printf(" GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d    --->>>  where = %d \n",
284
                //::::::                      GP_c_r,GP_c_s,GP_c_t,where);
285
                //::::::   ::printf("WEIGHT = %f", weight);
286
                //::::::   ::printf("determinant of Jacobian = %f", determinant_of_Jacobian);
287
                //::::::   matpoint[where].report("Gauss Point\n");
288
                // incremental straines at this Gauss point
289
                // now in Update we know the incremental displacements so let's find
290
                // the incremental strain
291
                incremental_strain =
292
                    (dhGlobal("ib")*incremental_displacements("ia")).symmetrize11();
293
                incremental_strain.null_indices();
294
                //incremental_strain.reportshort("\n incremental_strain tensor at GAUSS point\n");
295
 
296
                // here comes the final_stress calculation actually on only needs to copy stresses
297
                // from the iterative data . . .
298
                //(GPstress+where)->reportshortpqtheta("\n stress START GAUSS \n");
299
 
300
                if ( ! ( (matpoint[where]->matmodel)->setTrialStrainIncr( incremental_strain)) )
301
                   g3ErrorHandler->warning("TwentyNodeBrick::incremental_Update (tag: %d), not converged",
302
                                 this->getTag());
303
                //matpoint[where].setEPS( mmodel->getEPS() );
304
            }
305
          }
306
      }
307
  }
308
 
309
 
310
//#############################################################################
311
//#############################################################################
312
//***************************************************************
313
tensor TwentyNodeBrick::H_3D(double r1, double r2, double r3)
314
  {
315
 
316
    int dimension[] = {60,3};
317
 
318
    tensor H(2, dimension, 0.0);
319
 
320
    // influence of the node number 20
586 jeremic 321
        H.val(58,1)=(1.0+r1)*(1.0-r2)*(1.0-r3*r3)*0.25;
322
        H.val(59,2)=H.val(58,1); //(1.0+r1)*(1.0-r2)*(1.0-r3*r3)*0.25;
323
        H.val(60,3)=H.val(58,1); //(1.0+r1)*(1.0-r2)*(1.0-r3*r3)*0.25;
568 jeremic 324
    // influence of the node number 19
586 jeremic 325
        H.val(55,1)=(1.0-r1)*(1.0-r2)*(1.0-r3*r3)*0.25;
326
        H.val(56,2)=H.val(55,1); //(1.0-r1)*(1.0-r2)*(1.0-r3*r3)*0.25;
327
        H.val(57,3)=H.val(55,1); //(1.0-r1)*(1.0-r2)*(1.0-r3*r3)*0.25;
568 jeremic 328
    // influence of the node number 18
586 jeremic 329
        H.val(52,1)=(1.0-r1)*(1.0+r2)*(1.0-r3*r3)*0.25;
330
        H.val(53,2)=H.val(52,1); //(1.0-r1)*(1.0+r2)*(1.0-r3*r3)*0.25;
331
        H.val(54,3)=H.val(52,1); //(1.0-r1)*(1.0+r2)*(1.0-r3*r3)*0.25;
568 jeremic 332
    // influence of the node number 17
586 jeremic 333
        H.val(49,1)=(1.0+r1)*(1.0+r2)*(1.0-r3*r3)*0.25;
334
        H.val(50,2)=H.val(49,1); //(1.0+r1)*(1.0+r2)*(1.0-r3*r3)*0.25;
335
        H.val(51,3)=H.val(49,1); //(1.0+r1)*(1.0+r2)*(1.0-r3*r3)*0.25;
568 jeremic 336
 
337
    // influence of the node number 16
586 jeremic 338
        H.val(46,1)=(1.0+r1)*(1.0-r2*r2)*(1.0-r3)*0.25;
339
        H.val(47,2)=H.val(46,1); //(1.0+r1)*(1.0-r2*r2)*(1.0-r3)*0.25;
340
        H.val(48,3)=H.val(46,1); //(1.0+r1)*(1.0-r2*r2)*(1.0-r3)*0.25;
568 jeremic 341
    // influence of the node number 15
586 jeremic 342
        H.val(43,1)=(1.0-r1*r1)*(1.0-r2)*(1.0-r3)*0.25;
343
        H.val(44,2)=H.val(43,1); //(1.0-r1*r1)*(1.0-r2)*(1.0-r3)*0.25;
344
        H.val(45,3)=H.val(43,1); //(1.0-r1*r1)*(1.0-r2)*(1.0-r3)*0.25;
568 jeremic 345
    // influence of the node number 14
586 jeremic 346
        H.val(40,1)=(1.0-r1)*(1.0-r2*r2)*(1.0-r3)*0.25;
347
        H.val(41,2)=H.val(40,1); //(1.0-r1)*(1.0-r2*r2)*(1.0-r3)*0.25;
348
        H.val(42,3)=H.val(40,1); //(1.0-r1)*(1.0-r2*r2)*(1.0-r3)*0.25;
568 jeremic 349
    // influence of the node number 13
586 jeremic 350
        H.val(37,1)=(1.0-r1*r1)*(1.0+r2)*(1.0-r3)*0.25;
351
        H.val(38,2)=H.val(37,1); //(1.0-r1*r1)*(1.0+r2)*(1.0-r3)*0.25;
352
        H.val(39,3)=H.val(37,1); //(1.0-r1*r1)*(1.0+r2)*(1.0-r3)*0.25;
568 jeremic 353
 
354
    // influence of the node number 12
586 jeremic 355
        H.val(34,1)=(1.0+r1)*(1.0-r2*r2)*(1.0+r3)*0.25;
356
        H.val(35,2)=H.val(34,1); //(1.0+r1)*(1.0-r2*r2)*(1.0+r3)*0.25;
357
        H.val(36,3)=H.val(34,1); //(1.0+r1)*(1.0-r2*r2)*(1.0+r3)*0.25;
568 jeremic 358
    // influence of the node number 11
586 jeremic 359
        H.val(31,1)=(1.0-r1*r1)*(1.0-r2)*(1.0+r3)*0.25;
360
        H.val(32,2)=H.val(31,1); //(1.0-r1*r1)*(1.0-r2)*(1.0+r3)*0.25;
361
        H.val(33,3)=H.val(31,1); //(1.0-r1*r1)*(1.0-r2)*(1.0+r3)*0.25;
568 jeremic 362
    // influence of the node number 10
586 jeremic 363
        H.val(28,1)=(1.0-r1)*(1.0-r2*r2)*(1.0+r3)*0.25;
364
        H.val(29,2)=H.val(28,1); //(1.0-r1)*(1.0-r2*r2)*(1.0+r3)*0.25;
365
        H.val(30,3)=H.val(28,1); //(1.0-r1)*(1.0-r2*r2)*(1.0+r3)*0.25;
568 jeremic 366
    // influence of the node number 9
586 jeremic 367
        H.val(25,1)=(1.0-r1*r1)*(1.0+r2)*(1.0+r3)*0.25;
368
        H.val(26,2)=H.val(25,1); //(1.0-r1*r1)*(1.0+r2)*(1.0+r3)*0.25;
369
        H.val(27,3)=H.val(25,1); //(1.0-r1*r1)*(1.0+r2)*(1.0+r3)*0.25;
568 jeremic 370
 
371
 
372
    // 9-20 nodes
373
 
374
    // influence of the node number 8
586 jeremic 375
    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;
376
    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;
377
    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;
568 jeremic 378
    // influence of the node number 7
586 jeremic 379
    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;
380
    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;
381
    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;
568 jeremic 382
    // influence of the node number 6
586 jeremic 383
    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;
384
    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;
385
    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;
568 jeremic 386
    // influence of the node number 5
586 jeremic 387
    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;
388
    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;
389
    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;
568 jeremic 390
 
391
    // influence of the node number 4
586 jeremic 392
    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;
393
    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;
394
    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;
568 jeremic 395
    // influence of the node number 3
586 jeremic 396
    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;
397
    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;
398
    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;
568 jeremic 399
    // influence of the node number 2
586 jeremic 400
    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;
401
    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;
402
    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;
568 jeremic 403
    // influence of the node number 1
586 jeremic 404
    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;
405
    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;
406
    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;
568 jeremic 407
 
408
    //         double sum = 0;
409
    //
410
    //  for (int i=1; i<=60 ; i++)
411
    //           {
412
    // //           sum+=H.cval(i,1);
413
    //      for (int j=1; j<= 1; j++)
414
    //         {
415
    //                    sum+=H.cval(i,1);
416
    //            ::printf( "  %+9.2e", H.cval(i,j) );
417
    //          }
418
    //            // ::printf( "  %d \n", i);
419
    //     }
420
    //      ::printf( " \n sum= %+6.2e\n", sum );
421
 
422
 
423
    //    printf("r1 = %lf, r2 = %lf, r3 = %lf\n", r1, r2, r3);
424
    //    H.print("h");
425
 
426
    return H;
427
  }
428
 
429
//#############################################################################
430
//***************************************************************
431
tensor TwentyNodeBrick::interp_poli_at(double r1, double r2, double r3)
432
  {
433
 
586 jeremic 434
    int dimension[] = {20};
568 jeremic 435
    tensor h(1, dimension, 0.0);
436
 
437
 
438
    // influence of the node number 20
586 jeremic 439
    //    h.val(20)=(1.0+r1)*(1.0-r2)*(1.0-r3*r3)/4.0;
440
        h.val(20)=(1.0+r1)*(1.0-r2)*(1.0-r3*r3)*0.25;
568 jeremic 441
    // influence of the node number 19
586 jeremic 442
        h.val(19)=(1.0-r1)*(1.0-r2)*(1.0-r3*r3)*0.25;
568 jeremic 443
    // influence of the node number 18
586 jeremic 444
        h.val(18)=(1.0-r1)*(1.0+r2)*(1.0-r3*r3)*0.25;
568 jeremic 445
    // influence of the node number 17
586 jeremic 446
        h.val(17)=(1.0+r1)*(1.0+r2)*(1.0-r3*r3)*0.25;
568 jeremic 447
 
448
    // influence of the node number 16
586 jeremic 449
        h.val(16)=(1.0+r1)*(1.0-r2*r2)*(1.0-r3)*0.25;
568 jeremic 450
    // influence of the node number 15
586 jeremic 451
        h.val(15)=(1.0-r1*r1)*(1.0-r2)*(1.0-r3)*0.25;
568 jeremic 452
    // influence of the node number 14
586 jeremic 453
        h.val(14)=(1.0-r1)*(1.0-r2*r2)*(1.0-r3)*0.25;
568 jeremic 454
    // influence of the node number 13
586 jeremic 455
        h.val(13)=(1.0-r1*r1)*(1.0+r2)*(1.0-r3)*0.25;
568 jeremic 456
 
457
    // influence of the node number 12
586 jeremic 458
        h.val(12)=(1.0+r1)*(1.0-r2*r2)*(1.0+r3)*0.25;
568 jeremic 459
    // influence of the node number 11
586 jeremic 460
        h.val(11)=(1.0-r1*r1)*(1.0-r2)*(1.0+r3)*0.25;
568 jeremic 461
    // influence of the node number 10
586 jeremic 462
        h.val(10)=(1.0-r1)*(1.0-r2*r2)*(1.0+r3)*0.25;
568 jeremic 463
    // influence of the node number 9
586 jeremic 464
        h.val( 9)=(1.0-r1*r1)*(1.0+r2)*(1.0+r3)*0.25;
568 jeremic 465
 
466
      // influence of the node number 8
586 jeremic 467
    //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;
468
    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;
568 jeremic 469
      // influence of the node number 7
586 jeremic 470
    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;
568 jeremic 471
      // influence of the node number 6
586 jeremic 472
    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;
568 jeremic 473
      // influence of the node number 5
586 jeremic 474
    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;
568 jeremic 475
 
476
      // influence of the node number 4
586 jeremic 477
    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;
568 jeremic 478
      // influence of the node number 3
586 jeremic 479
    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;
568 jeremic 480
      // influence of the node number 2
586 jeremic 481
    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;
568 jeremic 482
      // influence of the node number 1
586 jeremic 483
    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;
568 jeremic 484
    //    printf("r1 = %lf, r2 = %lf, r3 = %lf\n", r1, r2, r3);
485
    //    h.print("h");
486
 
487
    return h;
488
  }
489
 
490
 
491
 
492
tensor TwentyNodeBrick::dh_drst_at(double r1, double r2, double r3)
493
  {
494
 
495
    int dimensions[] = {20,3};  // Changed from{20,3} to {8,3} Xiaoyan 07/12
496
    tensor dh(2, dimensions, 0.0);
497
 
498
 
499
    // influence of the node number 20
586 jeremic 500
        dh.val(20,1) =   (1.0-r2)*(1.0-r3*r3)*0.25; ///4.0;
501
        dh.val(20,2) = - (1.0+r1)*(1.0-r3*r3)*0.25; ///4.0;
502
        dh.val(20,3) = - (1.0+r1)*(1.0-r2)*r3*0.50; ///2.0;
568 jeremic 503
    // influence of the node number 19
586 jeremic 504
        dh.val(19,1) = - (1.0-r2)*(1.0-r3*r3)*0.25; ///4.0;
505
        dh.val(19,2) = - (1.0-r1)*(1.0-r3*r3)*0.25; ///4.0;
506
        dh.val(19,3) = - (1.0-r1)*(1.0-r2)*r3*0.50; ///2.0;
568 jeremic 507
    // influence of the node number 18
586 jeremic 508
        dh.val(18,1) = - (1.0+r2)*(1.0-r3*r3)*0.25; ///4.0;
509
        dh.val(18,2) =   (1.0-r1)*(1.0-r3*r3)*0.25; ///4.0;
510
        dh.val(18,3) = - (1.0-r1)*(1.0+r2)*r3*0.50; ///2.0;
568 jeremic 511
    // influence of the node number 17
586 jeremic 512
        dh.val(17,1) =   (1.0+r2)*(1.0-r3*r3)*0.25; ///4.0;
513
        dh.val(17,2) =   (1.0+r1)*(1.0-r3*r3)*0.25; ///4.0;
514
        dh.val(17,3) = - (1.0+r1)*(1.0+r2)*r3*0.50; ///2.0;
568 jeremic 515
 
516
    // influence of the node number 16
586 jeremic 517
        dh.val(16,1) =   (1.0-r2*r2)*(1.0-r3)*0.25; ///4.0;
518
        dh.val(16,2) = - (1.0+r1)*r2*(1.0-r3)*0.50; ///2.0;
519
        dh.val(16,3) = - (1.0+r1)*(1.0-r2*r2)*0.25; ///4.0;
568 jeremic 520
    // influnce of the node number 15
586 jeremic 521
        dh.val(15,1) = - r1*(1.0-r2)*(1.0-r3)*0.50; ///2.0;
522
        dh.val(15,2) = - (1.0-r1*r1)*(1.0-r3)*0.25; ///4.0;
523
        dh.val(15,3) = - (1.0-r1*r1)*(1.0-r2)*0.25; ///4.0;
568 jeremic 524
    // influence of the node number 14
586 jeremic 525
        dh.val(14,1) = - (1.0-r2*r2)*(1.0-r3)*0.25; ///4.0;
526
        dh.val(14,2) = - (1.0-r1)*r2*(1.0-r3)*0.50; ///2.0;
527
        dh.val(14,3) = - (1.0-r1)*(1.0-r2*r2)*0.25; ///4.0;
568 jeremic 528
    // influence of the node number 13
586 jeremic 529
        dh.val(13,1) = - r1*(1.0+r2)*(1.0-r3)*0.50; ///2.0;
530
        dh.val(13,2) =   (1.0-r1*r1)*(1.0-r3)*0.25; ///4.0;
531
        dh.val(13,3) = - (1.0-r1*r1)*(1.0+r2)*0.25; ///4.0;
568 jeremic 532
 
533
    // influence of the node number 12
586 jeremic 534
        dh.val(12,1) =   (1.0-r2*r2)*(1.0+r3)*0.25; ///4.0;
535
        dh.val(12,2) = - (1.0+r1)*r2*(1.0+r3)*0.50; ///2.0;
536
        dh.val(12,3) =   (1.0+r1)*(1.0-r2*r2)*0.25; ///4.0;
568 jeremic 537
    // influence of the node number 11
586 jeremic 538
        dh.val(11,1) = - r1*(1.0-r2)*(1.0+r3)*0.50; ///2.0;
539
        dh.val(11,2) = - (1.0-r1*r1)*(1.0+r3)*0.25; ///4.0; // bug discovered 01 aug '95 2.0 -> 4.0
540
        dh.val(11,3) =   (1.0-r1*r1)*(1.0-r2)*0.25; ///4.0;
568 jeremic 541
    // influence of the node number 10
586 jeremic 542
        dh.val(10,1) = - (1.0-r2*r2)*(1.0+r3)*0.25; ///4.0;
543
        dh.val(10,2) = - (1.0-r1)*r2*(1.0+r3)*0.50; ///2.0;
544
        dh.val(10,3) =   (1.0-r1)*(1.0-r2*r2)*0.25; ///4.0;
568 jeremic 545
    // influence of the node number 9
586 jeremic 546
        dh.val(9,1)  = - r1*(1.0+r2)*(1.0+r3)*0.50; ///2.0;
547
        dh.val(9,2)  =   (1.0-r1*r1)*(1.0+r3)*0.25; ///4.0;
548
        dh.val(9,3)  =   (1.0-r1*r1)*(1.0+r2)*0.25; ///4.0;
568 jeremic 549
 
550
      // influence of the node number 8
586 jeremic 551
    //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;
552
    dh.val(8,1)= (1.0-r2)*(1.0-r3)*0.125 - (dh.val(15,1)+dh.val(16,1)+dh.val(20,1))*0.50; ///2.0;
553
    dh.val(8,2)=-(1.0+r1)*(1.0-r3)*0.125 - (dh.val(15,2)+dh.val(16,2)+dh.val(20,2))*0.50; ///2.0;
554
    dh.val(8,3)=-(1.0+r1)*(1.0-r2)*0.125 - (dh.val(15,3)+dh.val(16,3)+dh.val(20,3))*0.50; ///2.0;
568 jeremic 555
      // influence of the node number 7
586 jeremic 556
    dh.val(7,1)=-(1.0-r2)*(1.0-r3)*0.125 - (dh.val(14,1)+dh.val(15,1)+dh.val(19,1))*0.50; ///2.0;
557
    dh.val(7,2)=-(1.0-r1)*(1.0-r3)*0.125 - (dh.val(14,2)+dh.val(15,2)+dh.val(19,2))*0.50; ///2.0;
558
    dh.val(7,3)=-(1.0-r1)*(1.0-r2)*0.125 - (dh.val(14,3)+dh.val(15,3)+dh.val(19,3))*0.50; ///2.0;
568 jeremic 559
      // influence of the node number 6
586 jeremic 560
    dh.val(6,1)=-(1.0+r2)*(1.0-r3)*0.125 - (dh.val(13,1)+dh.val(14,1)+dh.val(18,1))*0.50; ///2.0;
561
    dh.val(6,2)= (1.0-r1)*(1.0-r3)*0.125 - (dh.val(13,2)+dh.val(14,2)+dh.val(18,2))*0.50; ///2.0;
562
    dh.val(6,3)=-(1.0-r1)*(1.0+r2)*0.125 - (dh.val(13,3)+dh.val(14,3)+dh.val(18,3))*0.50; ///2.0;
568 jeremic 563
      // influence of the node number 5
586 jeremic 564
    dh.val(5,1)= (1.0+r2)*(1.0-r3)*0.125 - (dh.val(13,1)+dh.val(16,1)+dh.val(17,1))*0.50; ///2.0;
565
    dh.val(5,2)= (1.0+r1)*(1.0-r3)*0.125 - (dh.val(13,2)+dh.val(16,2)+dh.val(17,2))*0.50; ///2.0;
566
    dh.val(5,3)=-(1.0+r1)*(1.0+r2)*0.125 - (dh.val(13,3)+dh.val(16,3)+dh.val(17,3))*0.50; ///2.0;
568 jeremic 567
 
568
      // influence of the node number 4
586 jeremic 569
    dh.val(4,1)= (1.0-r2)*(1.0+r3)*0.125 - (dh.val(11,1)+dh.val(12,1)+dh.val(20,1))*0.50; ///2.0;
570
    dh.val(4,2)=-(1.0+r1)*(1.0+r3)*0.125 - (dh.val(11,2)+dh.val(12,2)+dh.val(20,2))*0.50; ///2.0;
571
    dh.val(4,3)= (1.0+r1)*(1.0-r2)*0.125 - (dh.val(11,3)+dh.val(12,3)+dh.val(20,3))*0.50; ///2.0;
568 jeremic 572
      // influence of the node number 3
586 jeremic 573
    dh.val(3,1)=-(1.0-r2)*(1.0+r3)*0.125 - (dh.val(10,1)+dh.val(11,1)+dh.val(19,1))*0.50; ///2.0;
574
    dh.val(3,2)=-(1.0-r1)*(1.0+r3)*0.125 - (dh.val(10,2)+dh.val(11,2)+dh.val(19,2))*0.50; ///2.0;
575
    dh.val(3,3)= (1.0-r1)*(1.0-r2)*0.125 - (dh.val(10,3)+dh.val(11,3)+dh.val(19,3))*0.50; ///2.0;
568 jeremic 576
      // influence of the node number 2
586 jeremic 577
    dh.val(2,1)=-(1.0+r2)*(1.0+r3)*0.125 - (dh.val(10,1)+dh.val(18,1)+dh.val( 9,1))*0.50; ///2.0;
578
    dh.val(2,2)= (1.0-r1)*(1.0+r3)*0.125 - (dh.val(10,2)+dh.val(18,2)+dh.val( 9,2))*0.50; ///2.0;
579
    dh.val(2,3)= (1.0-r1)*(1.0+r2)*0.125 - (dh.val(10,3)+dh.val(18,3)+dh.val( 9,3))*0.50; ///2.0;
568 jeremic 580
      // influence of the node number 1
586 jeremic 581
    dh.val(1,1)= (1.0+r2)*(1.0+r3)*0.125 - (dh.val(12,1)+dh.val(17,1)+dh.val( 9,1))*0.50; ///2.0;
582
    dh.val(1,2)= (1.0+r1)*(1.0+r3)*0.125 - (dh.val(12,2)+dh.val(17,2)+dh.val( 9,2))*0.50; ///2.0;
583
    dh.val(1,3)= (1.0+r1)*(1.0+r2)*0.125 - (dh.val(12,3)+dh.val(17,3)+dh.val( 9,3))*0.50; ///2.0;
568 jeremic 584
 
585
    return dh;
586
  }
587
 
588
 
589
 
590
////#############################################################################
591
TwentyNodeBrick & TwentyNodeBrick::operator[](int subscript)
592
  {
593
    return ( *(this+subscript) );
594
  }
595
 
596
//Finite_Element & TwentyNodeBrick::operator[](short subscript)
597
//  {
598
//    return ( *(this+subscript) );
599
//  }
600
 
601
//Finite_Element & TwentyNodeBrick::operator[](unsigned subscript)
602
//  {
603
//    return ( *(this+subscript) );
604
//  }
605
 
606
 
607
////#############################################################################
608
////#############################################################################
609
////#############################################################################
610
////#############################################################################
611
tensor TwentyNodeBrick::getStiffnessTensor(void)
612
  {
613
    int K_dim[] = {20,3,3,20};
614
    tensor Kk(4,K_dim,0.0);
615
    tensor Kkt(4,K_dim,0.0);
616
 
617
//debugging
618
//    matrix Kmat;
619
 
620
    double r  = 0.0;
621
    double rw = 0.0;
622
    double s  = 0.0;
623
    double sw = 0.0;
624
    double t  = 0.0;
625
    double tw = 0.0;
626
 
627
    short where = 0;
628
    double weight = 0.0;
629
 
630
    int dh_dim[] = {20,3};
631
    tensor dh(2, dh_dim, 0.0);
632
 
633
    //    tensor Constitutive( 4, def_dim_4, 0.0);
634
    tensor Constitutive;
635
 
636
    double det_of_Jacobian = 0.0;
637
 
638
    static int disp_dim[] = {20,3};
639
    tensor incremental_displacements(2,disp_dim,0.0); // \Delta u
640
 
641
    straintensor incremental_strain;
642
//    straintensor total_strain_at_GP;
643
 
644
    tensor Jacobian;
645
    tensor JacobianINV;
646
    tensor JacobianINVtemp;
647
    tensor dhGlobal;
648
 
649
    for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
650
      {
651
        r = get_Gauss_p_c( r_integration_order, GP_c_r );
652
        rw = get_Gauss_p_w( r_integration_order, GP_c_r );
653
        for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
654
          {
655
            s = get_Gauss_p_c( s_integration_order, GP_c_s );
656
            sw = get_Gauss_p_w( s_integration_order, GP_c_s );
657
            for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
658
              {
659
                t = get_Gauss_p_c( t_integration_order, GP_c_t );
660
                tw = get_Gauss_p_w( t_integration_order, GP_c_t );
661
                // this short routine is supposed to calculate position of
662
                // Gauss point from 3D array of short's
663
                where =
664
                   ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
665
                // derivatives of local coordinates with respect to local coordinates
666
                dh = dh_drst_at(r,s,t);
667
                //dh.print("dh");
668
                // Jacobian tensor ( matrix )
669
                Jacobian = Jacobian_3D(dh);
670
                // Inverse of Jacobian tensor ( matrix )
671
                JacobianINV = Jacobian_3Dinv(dh);
586 jeremic 672
                //JacobianINVtemp = Jacobian.inverse();
568 jeremic 673
                // determinant of Jacobian tensor ( matrix )
674
                det_of_Jacobian  = Jacobian.determinant();
675
                // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
586 jeremic 676
                ////////!!!!!!! dhGlobal = dh("ij") * JacobianINV("jk");  //big bug found here Zhaohui 09-02-2001
584 jeremic 677
                dhGlobal = dh("ij") * JacobianINV("kj");
568 jeremic 678
                //        ::fprintf(stdout," # %d \n\n\n\n\n\n\n\n", El_count);
679
                        //dhGlobal.print("dhGlobal");
680
                //weight
681
                weight = rw * sw * tw * det_of_Jacobian;
682
                //::::::
683
                //printf("\n\nIN THE STIFFNESS TENSOR INTEGRATOR ----**************** where = %d \n", where);
684
                //printf("  Stifness_Tensor \n");
685
                //printf("                    GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
686
                //                            GP_c_r,GP_c_s,GP_c_t);
687
                //printf("WEIGHT = %f", weight);
688
                //Jacobian.print("J");
689
                //JacobianINV.print("JINV");
690
                //JacobianINVtemp.print("JINVtemp");
691
                //tensor I = JacobianINV("ij")*Jacobian("jk");
692
                //I.print("I");
693
 
694
                //printf("determinant of Jacobian = %.6e", det_of_Jacobian);
695
                //matpoint[where].report("Gauss Point\n");
696
 
697
                // incremental straines at this Gauss point
698
                //GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor1\n");
699
 
586 jeremic 700
                //09-02-2001 Zhaohui
701
                //              incremental_strain =
702
                //     (dhGlobal("ib")*incremental_displacements("ia")).symmetrize11();
703
 
704
                //incremental_strain.null_indices();
568 jeremic 705
                //incremental_strain.report("\n incremental_strain tensor at GAUSS point\n");
706
 
707
                        // incremental_strain.reportshort("\n incremental_strain tensor at GAUSS point\n");
708
                //----   GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor2\n");
709
                // intialize total strain with the strain at this Gauss point before
710
                // adding this increments strains!
711
                //                total_strain_at_GP.Initialize(*(GPstrain+where));
712
                //total_strain_at_GP.reportshort("\n total_strain tensor at GAUSS point BEFORE\n");
713
                // this is the addition of incremental strains to the previous strain state at
714
                // this Gauss point
715
                //                total_strain_at_GP = total_strain_at_GP + incremental_strain;
716
                //total_strain_at_GP.reportshort("\n total_strain tensor at GAUSS point AFTER\n");
717
                //..   dakle ovde posalji strain_increment jer se stari stress cuva u okviru svake
718
                //..   Gauss tacke a samo saljes strain_increment koji ce da se prenese
719
                //..   u integracionu rutinu pa ce ta da vrati krajnji napon i onda moze da
720
                //..   se pravi ConstitutiveStiffnessTensor.
721
                // here comes the final_stress calculation
722
                // this final stress after integration is used ONLY to obtain Constitutive tensor
723
                // at this Gauss point.
724
 
725
                //final_stress_after_integration =
726
                //    (matpoint)->operator[](where).FinalStress(*(GPstress+where),
727
                //                                 incremental_strain,
728
                //                                 (matpoint)->operator[](where),
729
                //                                 number_of_subincrements,
730
                //                                 this_one_PP);
731
                //final_stress_after_integration.reportshortpqtheta("\n final_stress_after_integration in stiffness_tensor5\n");
732
 
733
                //----   GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor3\n");
734
                //final_stress_after_integration.reportshortpqtheta("\n final_stress_after_integration GAUSS \n");
735
                //----   GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor4\n");
736
 
737
                // this final stress after integration is used ONLY to obtain Constitutive tensor
738
                // at this Gauss point AND to set up the iterative_stress that is used in calculting
739
                // internal forces during iterations!!
740
 
741
                //GPiterative_stress[where].Initialize(final_stress_after_integration);
742
                //GPiterative_stress[where].reportshortpqtheta("\n iterative_stress at GAUSS point in stiffness_tensor5\n");
743
 
744
 
745
                // Stress state at Gauss point will be updated ( in the
746
                // sense of updating stresses ( integrating them ) ) in function Update (...) ! ! ! ! !
747
                // calculate the constitutive tensor
748
                //......         Constitutive =  GPtangent_E[where];
749
 
750
                //Constitutive =  (matpoint)->operator[](where).ConstitutiveTensor(final_stress_after_integration,
751
                //                                         *(GPstress+where),
752
                //                                          incremental_strain,
753
                //                                          (matpoint)->operator[](where),
754
                //                                          this_one_PP);
755
                //Constitutive.print("C","\n\n C tensor \n");
756
 
757
                //EPState *tmp_eps = (matpoint[where]).getEPS();
758
                //NDMaterial *tmp_ndm = (matpoint[where]).getNDMat();
759
 
760
                        Constitutive = (matpoint[where]->matmodel)->getTangentTensor();
761
                //Constitutive.print("C","\n\n C tensor \n");
762
 
763
                //    matpoint[where].setEPS( mmodel->getEPS() );
764
                //}
765
                //else if ( tmp_ndm ) { //Elastic case
766
                //    (matpoint[where].p_matmodel)->setTrialStrainIncr( incremental_strain );
767
                //    Constitutive = (matpoint[where].p_matmodel)->getTangentTensor();
768
                //}
769
                //else {
770
                //   g3ErrorHandler->fatal("TwentyNodeBrick::incremental_Update (tag: %d), could not getTangentTensor", this->getTag());
771
                //   exit(1);
772
                //}
773
 
774
                //printf("Constitutive.trace = %12.6e\n", Constitutive.trace());
775
                //Kmat = this->stiffness_matrix(Constitutive);
776
                //printf("Constitutive tensor max:= %10.3e\n", Kmat.mmax());
777
 
778
                //----   GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor5\n");
779
                // this is update of constitutive tensor at this Gauss point
780
                //GPtangent_E[where].Initialize(Constitutive);
781
                //....GPtangent_E[where].print(" tangent E at GAUSS point");
782
 
783
                //GPstress[where].reportshortpqtheta("\n stress at GAUSS point in stiffness_tensor6\n");
784
 
785
                //K = K + temp2;
786
 
787
                        Kkt = dhGlobal("ib")*Constitutive("abcd");
788
                        Kk = Kk + Kkt("aicd")*dhGlobal("jd")*weight;
789
 
790
                //Kk = Kk + dhGlobal("ib")*Constitutive("abcd")*dhGlobal("jd")*weight;
791
                //....K.print("K","\n\n K tensor \n");
792
 
793
                //Kmat = this->stiffness_matrix(Kk);
794
                //printf("K tensor max= %10.3e\n", Kmat.mmax());
795
 
796
                //convert constitutive and K to matrix and find min and max and print!
797
 
798
 
799
 
800
              }
801
          }
802
      }
803
    //Kk.print("K","\n\n K tensor \n");
804
    //K = Kk;
805
    return Kk;
806
  }
807
 
808
 
809
//#############################################################################
810
 
811
void TwentyNodeBrick::set_strain_stress_tensor(FILE *fp, double * u)
812
  {
813
    int dh_dim[] = {20,3};
814
    tensor dh(2, dh_dim, 0.0);
815
 
816
//    tensor Constitutive( 4, def_dim_4, 0.0);
817
    tensor Constitutive;
818
    double r  = 0.0;
819
    double s  = 0.0;
820
    double t  = 0.0;
821
    int where = 0;
822
 
823
    double det_of_Jacobian;
824
 
825
    straintensor strain;
826
    stresstensor stress;
827
 
828
    tensor Jacobian;
829
    tensor JacobianINV;
830
    tensor dhGlobal;
831
 
832
 
833
    static int disp_dim[] = {20,3};
834
    tensor total_displacements(2,disp_dim,0.0); //
835
 
836
    total_displacements = total_disp(fp, u);
837
 
838
    ::printf("\n  displacement(x-y-z) at GAUSS pt %d \n\n", where+1);
839
    for (int ii=1; ii<=20;ii++)
840
     {
841
      ::printf("Global# %d Local#%d  %+0.5e %+0.5e %+0.5e\n",
842
                     //G_N_numbs[ii-1],
843
                     connectedExternalNodes(ii-1),
844
                     ii,total_displacements.val(ii,1),
845
                     total_displacements.val(ii,2),
846
                     total_displacements.val(ii,3));
847
     }
848
 
849
    for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
850
      {
851
        r = get_Gauss_p_c( r_integration_order, GP_c_r );
852
        for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
853
          {
854
            s = get_Gauss_p_c( s_integration_order, GP_c_s );
855
            for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
856
              {
857
                t = get_Gauss_p_c( t_integration_order, GP_c_t );
858
                // this short routine is supposed to calculate position of
859
                // Gauss point from 3D array of short's
860
                where =
861
                ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
862
                // derivatives of local coordinates with respect to local coordinates
863
                dh = dh_drst_at(r,s,t);
864
                // Jacobian tensor ( matrix )
865
                Jacobian = Jacobian_3D(dh);
866
                // Inverse of Jacobian tensor ( matrix )
867
                JacobianINV = Jacobian_3Dinv(dh);
868
                // determinant of Jacobian tensor ( matrix )
869
                det_of_Jacobian  = Jacobian.determinant();
870
                // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
586 jeremic 871
                //dhGlobal = dh("ij") * JacobianINV("jk");// Zhaohui 09-02-2001
584 jeremic 872
                dhGlobal = dh("ij") * JacobianINV("kj");
568 jeremic 873
                //weight
874
                // straines at this Gauss point from displacement
875
                strain = (dhGlobal("ib")*total_displacements("ia")).symmetrize11();
876
                strain.null_indices();
877
                // here comes the final_stress calculation
878
                // at this Gauss point.
879
 
880
                //Constitutive =  GPtangent_E[where];
881
                //Constitutive =  (matpoint->getEPS() )->getEep();
882
                // if set total displ, then it should be elstic material
883
                        Constitutive =  ( matpoint[where]->matmodel)->getTangentTensor();
884
 
586 jeremic 885
                        stress = Constitutive("ijkl") * strain("kl");
568 jeremic 886
                stress.null_indices();
887
 
888
                ::printf("\n  strain tensor at GAUSS point %d \n", where+1);
889
                strain.reportshort("");
890
                ::printf("\n  stress tensor at GAUSS point %d \n", where+1);
891
                stress.reportshort("");
892
 
893
 
894
              }
895
          }
896
      }
897
  }
898
 
899
 
900
////#############################################################################
901
//  tensor TwentyNodeBrick::mass_tensor(Elastic  mmodel)
902
tensor TwentyNodeBrick::getMassTensor(void)
903
  {
904
    //int M_dim[] = {8,3,3,8};
905
    int M_dim[] = {60,60};
906
    tensor Mm(2,M_dim,0.0);
907
 
908
    double r  = 0.0;
909
    double rw = 0.0;
910
    double s  = 0.0;
911
    double sw = 0.0;
912
    double t  = 0.0;
913
    double tw = 0.0;
914
 
915
    short where = 0;
916
    double weight = 0.0;
917
 
918
    int dh_dim[] = {20,3};
919
 
920
    tensor dh(2, dh_dim, 0.0);
921
 
922
    int h_dim[] = {60,3};       // Xiaoyan changed from {60,3} to {24,3}
923
    tensor H(2, h_dim, 0.0);
924
 
925
    double det_of_Jacobian = 0.0;
926
 
927
    tensor Jacobian;
928
 
929
    double RHO;
930
    RHO= rho;    //global
931
 
932
    for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
933
      {
934
        r = get_Gauss_p_c( r_integration_order, GP_c_r );
935
        rw = get_Gauss_p_w( r_integration_order, GP_c_r );
936
        for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
937
          {
938
            s = get_Gauss_p_c( s_integration_order, GP_c_s );
939
            sw = get_Gauss_p_w( s_integration_order, GP_c_s );
940
            for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
941
              {
942
                t = get_Gauss_p_c( t_integration_order, GP_c_t );
943
                tw = get_Gauss_p_w( t_integration_order, GP_c_t );
944
                // this short routine is supposed to calculate position of
945
                // Gauss point from 3D array of short's
946
                where =
947
                ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
948
                // derivatives of local coordinates with respect to local coordinates
949
                dh = dh_drst_at(r,s,t);
950
                // Jacobian tensor ( matrix )
951
                Jacobian = Jacobian_3D(dh);
952
                //              Jacobian.print("J","Jacobian");
953
                // Inverse of Jacobian tensor ( matrix )
954
                //                JacobianINV = Jacobian_3Dinv(dh);
955
                // determinant of Jacobian tensor ( matrix )
956
                det_of_Jacobian  = Jacobian.determinant();
957
                //              printf("det_of_Jacobian = %6.2e \n",det_of_Jacobian);
958
                // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
586 jeremic 959
                //                dhGlobal = dh("ij") * JacobianINV("jk");
568 jeremic 960
                // derivatives of local coordinates with respect to local coordinates
961
 
962
 
963
                // printf("\n\nIN THE MASS TENSOR INTEGRATOR ----**************** where = %d \n", where);
964
                // printf("  Mass_Tensor \n");
965
                // printf("                    GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
966
                //                             GP_c_r,GP_c_s,GP_c_t);
967
                //
968
                H = H_3D(r,s,t);
969
 
970
                //      double sum = 0.0;
971
                //      for (int i=1; i<=60 ; i++)
972
                //           {
973
                // //       sum+=H.cval(i,1);
974
                //          for (int j=1; j<= 3; j++)
975
                //             {
976
                //                        sum+=H.cval(i,j);
977
                //                ::printf( "  %+9.2e", H.cval(i,j) );
978
                //              }
979
                //             ::printf( "  %d \n", i);
980
                //         }
981
                //          ::printf( " \n sum= %+6.2e\n", sum );
982
 
983
 
984
 
985
 
986
                // matpoint GaPo = MatPoint3D::GP()+where;
987
 
988
                weight = rw * sw * tw * RHO * det_of_Jacobian;
989
 
990
                        Mm = Mm + H("ib")*H("kb")*weight;
991
               //       printf("\n +++++++++++++++++++++++++ \n\n");
992
                //Mm.printshort("M");
993
              }
994
          }
995
      }
996
    //M = Mm;
997
    //Mm.printshort("M");
998
    return Mm;
999
  }
1000
 
1001
 
1002
////#############################################################################
1003
 
1004
tensor TwentyNodeBrick::stiffness_matrix(const tensor & K)
1005
  {
1006
//    int K_dim[] = {20,3,3,20};
1007
//    tensor K(4,K_dim,0.0);
1008
    matrix Kmatrix(60,60,0.0);
1009
 
1010
    int Ki=0;
1011
    int Kj=0;
1012
 
1013
    for ( int i=1 ; i<=20 ; i++ )
1014
      {
1015
        for ( int j=1 ; j<=20 ; j++ )
1016
          {
1017
            for ( int k=1 ; k<=3 ; k++ )
1018
              {
1019
                for ( int l=1 ; l<=3 ; l++ )
1020
                  {
1021
                    Ki = k+3*(i-1);
1022
                    Kj = l+3*(j-1);
1023
                    //::printf("i=%d k=%d  Ki=%d       j=%d l=%d  Kj=%d\n",i,k,Ki,j,l,Kj);
1024
 
1025
                    Kmatrix.val( Ki , Kj ) = K.cval(i,k,l,j);
1026
                  }
1027
              }
1028
          }
1029
      }
1030
    return Kmatrix;
1031
  }
1032
 
1033
//#############################################################################
1034
 
1035
////#############################################################################
1036
tensor TwentyNodeBrick::mass_matrix(const tensor & M)
1037
  {
1038
    //    int K_dim[] = {20,3,3,20};
1039
    //    tensor K(4,K_dim,0.0);
1040
    matrix Mmatrix(60,60,0.0);
1041
 
1042
    for ( int i=1 ; i<=60 ; i++ )
1043
      {
1044
        for ( int j=1 ; j<=60 ; j++ )
1045
          {
1046
             Mmatrix.val( i , j ) = M.cval(i,j);
1047
             //  ::printf("Mi Mj %d %d %+6.2e ",Mi,Mj,Mmatrix.val( Mi , Mj ) );
1048
          }
1049
      }
1050
    return Mmatrix;
1051
  }
1052
////#############################################################################
1053
 
1054
////#############################################################################
1055
tensor TwentyNodeBrick::Jacobian_3D(tensor dh)
1056
  {
1057
     tensor N_C = Nodal_Coordinates();
1058
     tensor Jacobian_3D = dh("ij") * N_C("ik");
1059
     return Jacobian_3D;
1060
  }
1061
 
1062
//#############################################################################
1063
tensor TwentyNodeBrick::Jacobian_3Dinv(tensor dh)
1064
  {
1065
     tensor N_C = Nodal_Coordinates();
1066
     tensor Jacobian_3Dinv = (dh("ij") * N_C("ik")).inverse();
1067
     return Jacobian_3Dinv;
1068
  }
1069
 
1070
 
1071
////#############################################################################
1072
tensor TwentyNodeBrick::Nodal_Coordinates(void)
1073
  {
586 jeremic 1074
    const int dimensions[] = {20,3};
568 jeremic 1075
    tensor N_coord(2, dimensions, 0.0);
1076
 
1077
    //Zhaohui using node pointers, which come from the Domain
1078
    const Vector &nd1Crds = nd1Ptr->getCrds();
1079
    const Vector &nd2Crds = nd2Ptr->getCrds();
1080
    const Vector &nd3Crds = nd3Ptr->getCrds();
1081
    const Vector &nd4Crds = nd4Ptr->getCrds();
1082
    const Vector &nd5Crds = nd5Ptr->getCrds();
1083
    const Vector &nd6Crds = nd6Ptr->getCrds();
1084
    const Vector &nd7Crds = nd7Ptr->getCrds();
1085
    const Vector &nd8Crds = nd8Ptr->getCrds();
1086
 
1087
    const Vector &nd9Crds  =  nd9Ptr->getCrds();
1088
    const Vector &nd10Crds = nd10Ptr->getCrds();
1089
    const Vector &nd11Crds = nd11Ptr->getCrds();
1090
    const Vector &nd12Crds = nd12Ptr->getCrds();
1091
 
1092
    const Vector &nd13Crds = nd13Ptr->getCrds();
1093
    const Vector &nd14Crds = nd14Ptr->getCrds();
1094
    const Vector &nd15Crds = nd15Ptr->getCrds();
1095
    const Vector &nd16Crds = nd16Ptr->getCrds();
1096
 
1097
 
1098
    const Vector &nd17Crds = nd17Ptr->getCrds();
1099
    const Vector &nd18Crds = nd18Ptr->getCrds();
1100
    const Vector &nd19Crds = nd19Ptr->getCrds();
1101
    const Vector &nd20Crds = nd20Ptr->getCrds();
586 jeremic 1102
 
568 jeremic 1103
    N_coord.val(1,1)=nd1Crds(0); N_coord.val(1,2)=nd1Crds(1); N_coord.val(1,3)=nd1Crds(2);
1104
    N_coord.val(2,1)=nd2Crds(0); N_coord.val(2,2)=nd2Crds(1); N_coord.val(2,3)=nd2Crds(2);
1105
    N_coord.val(3,1)=nd3Crds(0); N_coord.val(3,2)=nd3Crds(1); N_coord.val(3,3)=nd3Crds(2);
1106
    N_coord.val(4,1)=nd4Crds(0); N_coord.val(4,2)=nd4Crds(1); N_coord.val(4,3)=nd4Crds(2);
1107
    N_coord.val(5,1)=nd5Crds(0); N_coord.val(5,2)=nd5Crds(1); N_coord.val(5,3)=nd5Crds(2);
1108
    N_coord.val(6,1)=nd6Crds(0); N_coord.val(6,2)=nd6Crds(1); N_coord.val(6,3)=nd6Crds(2);
1109
    N_coord.val(7,1)=nd7Crds(0); N_coord.val(7,2)=nd7Crds(1); N_coord.val(7,3)=nd7Crds(2);
1110
    N_coord.val(8,1)=nd8Crds(0); N_coord.val(8,2)=nd8Crds(1); N_coord.val(8,3)=nd8Crds(2);
1111
 
1112
    N_coord.val(9 ,1)=nd9Crds(0);  N_coord.val(9 ,2)=nd9Crds(1);  N_coord.val(9 ,3)=nd9Crds(2);
1113
    N_coord.val(10,1)=nd10Crds(0); N_coord.val(10,2)=nd10Crds(1); N_coord.val(10,3)=nd10Crds(2);
1114
    N_coord.val(11,1)=nd11Crds(0); N_coord.val(11,2)=nd11Crds(1); N_coord.val(11,3)=nd11Crds(2);
1115
    N_coord.val(12,1)=nd12Crds(0); N_coord.val(12,2)=nd12Crds(1); N_coord.val(12,3)=nd12Crds(2);
1116
 
1117
    N_coord.val(13,1)=nd13Crds(0); N_coord.val(13,2)=nd13Crds(1); N_coord.val(13,3)=nd13Crds(2);
1118
    N_coord.val(14,1)=nd14Crds(0); N_coord.val(14,2)=nd14Crds(1); N_coord.val(14,3)=nd14Crds(2);
1119
    N_coord.val(15,1)=nd15Crds(0); N_coord.val(15,2)=nd15Crds(1); N_coord.val(15,3)=nd15Crds(2);
1120
    N_coord.val(16,1)=nd16Crds(0); N_coord.val(16,2)=nd16Crds(1); N_coord.val(16,3)=nd16Crds(2);
586 jeremic 1121
 
568 jeremic 1122
    N_coord.val(17,1)=nd17Crds(0); N_coord.val(17,2)=nd17Crds(1); N_coord.val(17,3)=nd17Crds(2);
1123
    N_coord.val(18,1)=nd18Crds(0); N_coord.val(18,2)=nd18Crds(1); N_coord.val(18,3)=nd18Crds(2);
1124
    N_coord.val(19,1)=nd19Crds(0); N_coord.val(19,2)=nd19Crds(1); N_coord.val(19,3)=nd19Crds(2);
1125
    N_coord.val(20,1)=nd20Crds(0); N_coord.val(20,2)=nd20Crds(1); N_coord.val(20,3)=nd20Crds(2);
586 jeremic 1126
 
568 jeremic 1127
    return N_coord;
1128
 
1129
  }
1130
 
1131
////#############################################################################
1132
tensor TwentyNodeBrick::incr_disp(void)
1133
  {
1134
    const int dimensions[] = {20,3};
1135
    tensor increment_disp(2, dimensions, 0.0);
1136
 
1137
    //for ( int i=0 ; i<20 ; i++ )
1138
    //
1139
    //  {
1140
    //    // increment_disp.val(i+1,1) = nodes[ G_N_numbs[i] ].incremental_translation_x();
1141
    //    // increment_disp.val(i+1,2) = nodes[ G_N_numbs[i] ].incremental_translation_y();
1142
    //    // increment_disp.val(i+1,3) = nodes[ G_N_numbs[i] ].incremental_translation_z();
1143
    //
1144
    //    increment_disp.val(i+1,1) = IncremenDis(0);
1145
    //    increment_disp.val(i+1,2) = IncremenDis(1);
1146
    //    increment_disp.val(i+1,3) = IncremenDis(2);
1147
    //
1148
    //  }
1149
 
1150
    //Zhaohui using node pointers, which come from the Domain
1151
    //const Vector &TotDis1 = nd1Ptr->getTrialDisp();
1152
    //const Vector &incrdelDis1 = nd1Ptr->getIncrDisp();
1153
    //Have to get IncrDeltaDisp, not IncrDisp for cumulation of incr_disp
1154
    const Vector &IncrDis1 = nd1Ptr->getIncrDeltaDisp();
1155
    const Vector &IncrDis2 = nd2Ptr->getIncrDeltaDisp();
1156
    const Vector &IncrDis3 = nd3Ptr->getIncrDeltaDisp();
1157
    const Vector &IncrDis4 = nd4Ptr->getIncrDeltaDisp();
1158
    const Vector &IncrDis5 = nd5Ptr->getIncrDeltaDisp();
1159
    const Vector &IncrDis6 = nd6Ptr->getIncrDeltaDisp();
1160
    const Vector &IncrDis7 = nd7Ptr->getIncrDeltaDisp();
1161
    const Vector &IncrDis8 = nd8Ptr->getIncrDeltaDisp();
1162
 
1163
    const Vector &IncrDis9  = nd9Ptr->getIncrDeltaDisp();
1164
    const Vector &IncrDis10 = nd10Ptr->getIncrDeltaDisp();
1165
    const Vector &IncrDis11 = nd11Ptr->getIncrDeltaDisp();
1166
    const Vector &IncrDis12 = nd12Ptr->getIncrDeltaDisp();
1167
 
1168
    const Vector &IncrDis13 = nd13Ptr->getIncrDeltaDisp();
1169
    const Vector &IncrDis14 = nd14Ptr->getIncrDeltaDisp();
1170
    const Vector &IncrDis15 = nd15Ptr->getIncrDeltaDisp();
1171
    const Vector &IncrDis16 = nd16Ptr->getIncrDeltaDisp();
586 jeremic 1172
 
568 jeremic 1173
    const Vector &IncrDis17 = nd17Ptr->getIncrDeltaDisp();
1174
    const Vector &IncrDis18 = nd18Ptr->getIncrDeltaDisp();
1175
    const Vector &IncrDis19 = nd19Ptr->getIncrDeltaDisp();
1176
    const Vector &IncrDis20 = nd20Ptr->getIncrDeltaDisp();
1177
 
1178
    increment_disp.val(1,1)=IncrDis1(0); increment_disp.val(1,2)=IncrDis1(1);increment_disp.val(1,3)=IncrDis1(2);
1179
    increment_disp.val(2,1)=IncrDis2(0); increment_disp.val(2,2)=IncrDis2(1);increment_disp.val(2,3)=IncrDis2(2);
1180
    increment_disp.val(3,1)=IncrDis3(0); increment_disp.val(3,2)=IncrDis3(1);increment_disp.val(3,3)=IncrDis3(2);
1181
    increment_disp.val(4,1)=IncrDis4(0); increment_disp.val(4,2)=IncrDis4(1);increment_disp.val(4,3)=IncrDis4(2);
1182
    increment_disp.val(5,1)=IncrDis5(0); increment_disp.val(5,2)=IncrDis5(1);increment_disp.val(5,3)=IncrDis5(2);
1183
    increment_disp.val(6,1)=IncrDis6(0); increment_disp.val(6,2)=IncrDis6(1);increment_disp.val(6,3)=IncrDis6(2);
1184
    increment_disp.val(7,1)=IncrDis7(0); increment_disp.val(7,2)=IncrDis7(1);increment_disp.val(7,3)=IncrDis7(2);
1185
    increment_disp.val(8,1)=IncrDis8(0); increment_disp.val(8,2)=IncrDis8(1);increment_disp.val(8,3)=IncrDis8(2);
1186
 
1187
    increment_disp.val(9 ,1)=IncrDis9(0);  increment_disp.val(9 ,2)=IncrDis9(1); increment_disp.val(9 ,3)=IncrDis9(2);
1188
    increment_disp.val(10,1)=IncrDis10(0); increment_disp.val(10,2)=IncrDis10(1);increment_disp.val(10,3)=IncrDis10(2);
1189
    increment_disp.val(11,1)=IncrDis11(0); increment_disp.val(11,2)=IncrDis11(1);increment_disp.val(11,3)=IncrDis11(2);
1190
    increment_disp.val(12,1)=IncrDis12(0); increment_disp.val(12,2)=IncrDis12(1);increment_disp.val(12,3)=IncrDis12(2);
586 jeremic 1191
 
568 jeremic 1192
    increment_disp.val(13,1)=IncrDis13(0); increment_disp.val(13,2)=IncrDis13(1);increment_disp.val(13,3)=IncrDis13(2);
1193
    increment_disp.val(14,1)=IncrDis14(0); increment_disp.val(14,2)=IncrDis14(1);increment_disp.val(14,3)=IncrDis14(2);
1194
    increment_disp.val(15,1)=IncrDis15(0); increment_disp.val(15,2)=IncrDis15(1);increment_disp.val(15,3)=IncrDis15(2);
1195
    increment_disp.val(16,1)=IncrDis16(0); increment_disp.val(16,2)=IncrDis16(1);increment_disp.val(16,3)=IncrDis16(2);
586 jeremic 1196
 
568 jeremic 1197
    increment_disp.val(17,1)=IncrDis17(0); increment_disp.val(17,2)=IncrDis17(1);increment_disp.val(17,3)=IncrDis17(2);
1198
    increment_disp.val(18,1)=IncrDis18(0); increment_disp.val(18,2)=IncrDis18(1);increment_disp.val(18,3)=IncrDis18(2);
1199
    increment_disp.val(19,1)=IncrDis19(0); increment_disp.val(19,2)=IncrDis19(1);increment_disp.val(19,3)=IncrDis19(2);
1200
    increment_disp.val(20,1)=IncrDis20(0); increment_disp.val(20,2)=IncrDis20(1);increment_disp.val(20,3)=IncrDis20(2);
1201
 
1202
 
1203
    return increment_disp;
1204
  }
1205
 
1206
////#############################################################################
1207
tensor TwentyNodeBrick::total_disp(void)
1208
  {
1209
    const int dimensions[] = {20,3};
1210
    tensor total_disp(2, dimensions, 0.0);
1211
 
1212
    //Zhaohui using node pointers, which come from the Domain
1213
    const Vector &TotDis1 = nd1Ptr->getTrialDisp();
1214
    cout<<"\ntot node " << nd1Ptr->getTag() <<" x "<< TotDis1(0) <<" y "<< TotDis1(1) << " z "<< TotDis1(2) << endln;
1215
    const Vector &TotDis2 = nd2Ptr->getTrialDisp();
1216
    cout << "tot node " << nd2Ptr->getTag() << " x " << TotDis2(0) <<" y "<< TotDis2(1) << " z "<< TotDis2(2) << endln;
1217
    const Vector &TotDis3 = nd3Ptr->getTrialDisp();
1218
    cout << "tot node " << nd3Ptr->getTag() << " x " << TotDis3(0) <<" y "<< TotDis3(1) << " z "<< TotDis3(2) << endln;
1219
    const Vector &TotDis4 = nd4Ptr->getTrialDisp();
1220
    cout << "tot node " << nd4Ptr->getTag() << " x " << TotDis4(0) <<" y "<< TotDis4(1) << " z "<< TotDis4(2) << endln;
1221
    const Vector &TotDis5 = nd5Ptr->getTrialDisp();
1222
    cout << "tot node " << nd5Ptr->getTag() << " x " << TotDis5(0) <<" y "<< TotDis5(1) << " z "<< TotDis5(2) << endln;
1223
    const Vector &TotDis6 = nd6Ptr->getTrialDisp();
1224
    cout << "tot node " << nd6Ptr->getTag() << " x " << TotDis6(0) <<" y "<< TotDis6(1) << " z "<< TotDis6(2) << endln;
1225
    const Vector &TotDis7 = nd7Ptr->getTrialDisp();
1226
    cout << "tot node " << nd7Ptr->getTag() << " x " << TotDis7(0) <<" y "<< TotDis7(1) << " z "<< TotDis7(2) << endln;
1227
    const Vector &TotDis8 = nd8Ptr->getTrialDisp();
1228
    cout << "tot node " << nd8Ptr->getTag() << " x " << TotDis8(0) <<" y "<< TotDis8(1) << " z "<< TotDis8(2) << endln;
1229
 
1230
    const Vector &TotDis9 = nd9Ptr->getTrialDisp();
1231
    cout << "tot node " << nd9Ptr->getTag() << " x " << TotDis9(0) <<" y "<< TotDis9(1) << " z "<< TotDis9(2) << endln;
1232
    const Vector &TotDis10 = nd10Ptr->getTrialDisp();
1233
    cout << "tot node " << nd10Ptr->getTag() << " x " << TotDis10(0) <<" y "<< TotDis10(1) << " z "<< TotDis10(2) << endln;
1234
    const Vector &TotDis11 = nd11Ptr->getTrialDisp();
1235
    cout << "tot node " << nd11Ptr->getTag() << " x " << TotDis11(0) <<" y "<< TotDis11(1) << " z "<< TotDis11(2) << endln;
1236
    const Vector &TotDis12 = nd12Ptr->getTrialDisp();
1237
    cout << "tot node " << nd12Ptr->getTag() << " x " << TotDis12(0) <<" y "<< TotDis12(1) << " z "<< TotDis12(2) << endln;
1238
 
1239
    const Vector &TotDis13 = nd13Ptr->getTrialDisp();
1240
    cout << "tot node " << nd13Ptr->getTag() << " x " << TotDis13(0) <<" y "<< TotDis13(1) << " z "<< TotDis13(2) << endln;
1241
    const Vector &TotDis14 = nd14Ptr->getTrialDisp();
1242
    cout << "tot node " << nd14Ptr->getTag() << " x " << TotDis14(0) <<" y "<< TotDis14(1) << " z "<< TotDis14(2) << endln;
1243
    const Vector &TotDis15 = nd15Ptr->getTrialDisp();
1244
    cout << "tot node " << nd15Ptr->getTag() << " x " << TotDis15(0) <<" y "<< TotDis15(1) << " z "<< TotDis15(2) << endln;
1245
    const Vector &TotDis16 = nd16Ptr->getTrialDisp();
1246
    cout << "tot node " << nd16Ptr->getTag() << " x " << TotDis16(0) <<" y "<< TotDis16(1) << " z "<< TotDis16(2) << endln;
1247
 
1248
    const Vector &TotDis17 = nd17Ptr->getTrialDisp();
1249
    cout << "tot node " << nd17Ptr->getTag() << " x " << TotDis17(0) <<" y "<< TotDis17(1) << " z "<< TotDis17(2) << endln;
1250
    const Vector &TotDis18 = nd18Ptr->getTrialDisp();
1251
    cout << "tot node " << nd18Ptr->getTag() << " x " << TotDis18(0) <<" y "<< TotDis18(1) << " z "<< TotDis18(2) << endln;
1252
    const Vector &TotDis19 = nd19Ptr->getTrialDisp();
1253
    cout << "tot node " << nd19Ptr->getTag() << " x " << TotDis19(0) <<" y "<< TotDis19(1) << " z "<< TotDis19(2) << endln;
1254
    const Vector &TotDis20 = nd20Ptr->getTrialDisp();
1255
    cout << "tot node " << nd20Ptr->getTag() << " x " << TotDis20(0) <<" y "<< TotDis20(1) << " z "<< TotDis20(2) << endln;
1256
 
1257
 
1258
 
1259
 
1260
    total_disp.val(1,1)=TotDis1(0); total_disp.val(1,2)=TotDis1(1);total_disp.val(1,3)=TotDis1(2);
1261
    total_disp.val(2,1)=TotDis2(0); total_disp.val(2,2)=TotDis2(1);total_disp.val(2,3)=TotDis2(2);
1262
    total_disp.val(3,1)=TotDis3(0); total_disp.val(3,2)=TotDis3(1);total_disp.val(3,3)=TotDis3(2);
1263
    total_disp.val(4,1)=TotDis4(0); total_disp.val(4,2)=TotDis4(1);total_disp.val(4,3)=TotDis4(2);
1264
    total_disp.val(5,1)=TotDis5(0); total_disp.val(5,2)=TotDis5(1);total_disp.val(5,3)=TotDis5(2);
1265
    total_disp.val(6,1)=TotDis6(0); total_disp.val(6,2)=TotDis6(1);total_disp.val(6,3)=TotDis6(2);
1266
    total_disp.val(7,1)=TotDis7(0); total_disp.val(7,2)=TotDis7(1);total_disp.val(7,3)=TotDis7(2);
1267
    total_disp.val(8,1)=TotDis8(0); total_disp.val(8,2)=TotDis8(1);total_disp.val(8,3)=TotDis8(2);
1268
 
1269
    total_disp.val(9,1)=TotDis9(0); total_disp.val(9,2)=TotDis9(1);total_disp.val(9,3)=TotDis9(2);
1270
    total_disp.val(10,1)=TotDis10(0); total_disp.val(10,2)=TotDis10(1);total_disp.val(10,3)=TotDis10(2);
1271
    total_disp.val(11,1)=TotDis11(0); total_disp.val(11,2)=TotDis11(1);total_disp.val(11,3)=TotDis11(2);
1272
    total_disp.val(12,1)=TotDis12(0); total_disp.val(12,2)=TotDis12(1);total_disp.val(12,3)=TotDis12(2);
1273
 
1274
    total_disp.val(13,1)=TotDis13(0); total_disp.val(13,2)=TotDis13(1);total_disp.val(13,3)=TotDis13(2);
1275
    total_disp.val(14,1)=TotDis14(0); total_disp.val(14,2)=TotDis14(1);total_disp.val(14,3)=TotDis14(2);
1276
    total_disp.val(15,1)=TotDis15(0); total_disp.val(15,2)=TotDis15(1);total_disp.val(15,3)=TotDis15(2);
1277
    total_disp.val(16,1)=TotDis16(0); total_disp.val(16,2)=TotDis16(1);total_disp.val(16,3)=TotDis16(2);
1278
 
1279
    total_disp.val(17,1)=TotDis17(0); total_disp.val(17,2)=TotDis17(1);total_disp.val(17,3)=TotDis17(2);
1280
    total_disp.val(18,1)=TotDis18(0); total_disp.val(18,2)=TotDis18(1);total_disp.val(18,3)=TotDis18(2);
1281
    total_disp.val(19,1)=TotDis19(0); total_disp.val(19,2)=TotDis19(1);total_disp.val(19,3)=TotDis19(2);
1282
    total_disp.val(20,1)=TotDis20(0); total_disp.val(20,2)=TotDis20(1);total_disp.val(20,3)=TotDis20(2);
1283
 
1284
    return total_disp;
1285
  }
1286
 
1287
 
1288
////#############################################################################
1289
tensor TwentyNodeBrick::total_disp(FILE *fp, double * u)
1290
  {
1291
    const int dimensions[] = {20,3};
1292
    tensor total_disp(2, dimensions, 0.0);
1293
    //    double totalx, totaly, totalz;
1294
    //    totalx=0;
1295
    //    totaly=0;
1296
    //    totalz=0;
1297
 
1298
    //for ( int i=0 ; i<20 ; i++ )
1299
    //
1300
    //  {
1301
    //    // total_disp.val(i+1,1) = nodes[ G_N_numbs[i] ].total_translation_x(u);
1302
    //    // total_disp.val(i+1,2) = nodes[ G_N_numbs[i] ].total_translation_y(u);
1303
    //    // total_disp.val(i+1,3) = nodes[ G_N_numbs[i] ].total_translation_z(u);
1304
    //    Vector TotalTranDis = nodes[ G_N_numbs[i] ].getDisp();
1305
    //
1306
    //    total_disp.val(i+1,1) = TotalTranDis(0);
1307
    //  total_disp.val(i+1,2) = TotalTranDis(1);
1308
    //    total_disp.val(i+1,3) = TotalTranDis(2);
1309
    //
1310
    //  }
586 jeremic 1311
 
568 jeremic 1312
    // Need more work
586 jeremic 1313
 
568 jeremic 1314
    //Zhaohui using node pointers, which come from the Domain
1315
    const Vector &TotDis1 = nd1Ptr->getTrialDisp();
1316
    const Vector &TotDis2 = nd2Ptr->getTrialDisp();
1317
    const Vector &TotDis3 = nd3Ptr->getTrialDisp();
1318
    const Vector &TotDis4 = nd4Ptr->getTrialDisp();
1319
    const Vector &TotDis5 = nd5Ptr->getTrialDisp();
1320
    const Vector &TotDis6 = nd6Ptr->getTrialDisp();
1321
    const Vector &TotDis7 = nd7Ptr->getTrialDisp();
1322
    const Vector &TotDis8 = nd8Ptr->getTrialDisp();
1323
 
1324
    total_disp.val(1,1)=TotDis1(0); total_disp.val(1,2)=TotDis1(1);total_disp.val(1,3)=TotDis1(2);
1325
    total_disp.val(2,1)=TotDis2(0); total_disp.val(2,2)=TotDis2(1);total_disp.val(2,3)=TotDis2(2);
1326
    total_disp.val(3,1)=TotDis3(0); total_disp.val(3,2)=TotDis3(1);total_disp.val(3,3)=TotDis3(2);
1327
    total_disp.val(4,1)=TotDis4(0); total_disp.val(4,2)=TotDis4(1);total_disp.val(4,3)=TotDis4(2);
1328
    total_disp.val(5,1)=TotDis5(0); total_disp.val(5,2)=TotDis5(1);total_disp.val(5,3)=TotDis5(2);
1329
    total_disp.val(6,1)=TotDis6(0); total_disp.val(6,2)=TotDis6(1);total_disp.val(6,3)=TotDis6(2);
1330
    total_disp.val(7,1)=TotDis7(0); total_disp.val(7,2)=TotDis7(1);total_disp.val(7,3)=TotDis7(2);
1331
    total_disp.val(8,1)=TotDis8(0); total_disp.val(8,2)=TotDis8(1);total_disp.val(8,3)=TotDis8(2);
1332
 
1333
    return total_disp;
1334
  }
1335
 
1336
 
1337
////#############################################################################
1338
int TwentyNodeBrick::get_global_number_of_node(int local_node_number)
1339
{
1340
  //return G_N_numbs[local_node_number];
1341
  return connectedExternalNodes(local_node_number);
1342
}
1343
 
1344
////#############################################################################
1345
int  TwentyNodeBrick::get_Brick_Number(void)
1346
{
1347
  //return elem_numb;
1348
  return this->getTag();
1349
}
1350
 
1351
////#############################################################################
1352
// returns nodal forces for given stress field in an element
1353
tensor TwentyNodeBrick::nodal_forces(void)
1354
  {
1355
    int force_dim[] = {20,3};  // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
1356
 
1357
    tensor nodal_forces(2,force_dim,0.0);
1358
 
1359
    double r  = 0.0;
1360
    double rw = 0.0;
1361
    double s  = 0.0;
1362
    double sw = 0.0;
1363
    double t  = 0.0;
1364
    double tw = 0.0;
1365
 
1366
    short where = 0;
1367
    double weight = 0.0;
1368
 
1369
    int dh_dim[] = {20,3};  // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
1370
 
1371
    tensor dh(2, dh_dim, 0.0);
1372
 
1373
    stresstensor stress_at_GP(0.0);
1374
 
1375
    double det_of_Jacobian = 0.0;
1376
 
1377
    straintensor incremental_strain;
1378
 
1379
    static int disp_dim[] = {20,3};   // Xiaoyan changed from {20,3} to {8,3}
1380
    tensor incremental_displacements(2,disp_dim,0.0); // \Delta u
1381
 
1382
    incremental_displacements = incr_disp();
1383
 
1384
    tensor Jacobian;
1385
    tensor JacobianINV;
1386
    tensor dhGlobal;
1387
 
1388
    for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
1389
      {
1390
        r = get_Gauss_p_c( r_integration_order, GP_c_r );
1391
        rw = get_Gauss_p_w( r_integration_order, GP_c_r );
1392
 
1393
        for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
1394
          {
1395
            s = get_Gauss_p_c( s_integration_order, GP_c_s );
1396
            sw = get_Gauss_p_w( s_integration_order, GP_c_s );
1397
 
1398
            for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
1399
              {
1400
                t = get_Gauss_p_c( t_integration_order, GP_c_t );
1401
                tw = get_Gauss_p_w( t_integration_order, GP_c_t );
1402
 
1403
                // this short routine is supposed to calculate position of
1404
                // Gauss point from 3D array of short's
1405
                where =
1406
                ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
1407
 
1408
                // derivatives of local coordiantes with respect to local coordiantes
1409
                dh = dh_drst_at(r,s,t);
1410
 
1411
                // Jacobian tensor ( matrix )
1412
                Jacobian = Jacobian_3D(dh);
1413
                //....                Jacobian.print("J");
1414
 
1415
                // Inverse of Jacobian tensor ( matrix )
1416
                JacobianINV = Jacobian_3Dinv(dh);
1417
                //....                JacobianINV.print("JINV");
1418
 
1419
                // determinant of Jacobian tensor ( matrix )
1420
                det_of_Jacobian  = Jacobian.determinant();
1421
                //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
1422
 
1423
                // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
586 jeremic 1424
                //dhGlobal = dh("ij") * JacobianINV("jk");// Zhaohui 09-02-2001
584 jeremic 1425
                dhGlobal = dh("ij") * JacobianINV("kj");
568 jeremic 1426
 
1427
                //weight
1428
                weight = rw * sw * tw * det_of_Jacobian;
1429
                //..::printf("\n\nIN THE nodal forces ----**************** where = %d \n", where);
1430
                //..::printf("                    GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
1431
                //..                           GP_c_r,GP_c_s,GP_c_t);
1432
                //..::printf("WEIGHT = %f", weight);
1433
                //..::printf("determinant of Jacobian = %f", det_of_Jacobian);
1434
                //..matpoint[where].report("Gauss Point\n");
1435
 
1436
                //..   // samo jos odredi ovaj tensor E i to za svaku gauss tacku drugaciji !!!!!!!!!!!!
1437
                //..   ovde negde bi trebalo da se na osnovu inkrementalnih pomeranja
1438
                //..   nadje inkrementalna deformacija ( strain_increment ) pa sa njom dalje:
1439
                //..
1440
                //// tensor of incremental displacements taken from node objects
1441
                //                incremental_displacements = incr_disp();
1442
                //
1443
                //// incremental straines at this Gauss point
1444
                //                incremental_strain =
1445
                //                  (dhGlobal("ib")*incremental_displacements("ia")).symmetrize11();
1446
                //
1447
                //                incremental_strain.null_indices();
1448
                ////incremental_strain.reportshort("\n incremental_strain tensor at GAUSS point\n");
1449
                //
1450
                ////                integr_type = (matpoint)->operator[](where).integration_type();
1451
                ////                if ( !strcmp(integr_type,"BakcwardEuler")
1452
 
1453
                //stress_at_GP = GPstress[where];
1454
 
1455
                //EPState *tmp_eps = (matpoint[where]->matmodel)->getEPS();
1456
                //stress_at_GP = tmp_eps->getStress();
1457
                //cout << "tmp_eps" << (*tmp_eps);
1458
 
1459
                //NDMaterial *tmp_ndm = (matpoint[where]).getNDMat();
1460
 
1461
                //if ( tmp_eps ) {     //Elasto-plastic case
1462
 
1463
                //stress_at_GP = (matpoint[where].matmodel->getEPS())->getStress();
1464
 
1465
                //   EPState *tmp_eps = (matpoint[where]->matmodel)->getEPS();
1466
                //   stress_at_GP = tmp_eps->getStress();
1467
 
1468
 
1469
 
1470
                incremental_strain =
1471
                     (dhGlobal("ib")*incremental_displacements("ia")).symmetrize11();
1472
//              if (where == 0)
1473
//              //cout << " In nodal_force delta_incremental_strain tag "<< getTag() <<"  " <<incremental_strain << endln;
1474
////            cout << " el tag = "<< getTag();
1475
//
1476
                int err = ( matpoint[where]->matmodel )->setTrialStrainIncr( incremental_strain);
1477
                if ( err)
586 jeremic 1478
                   g3ErrorHandler->warning("TwentyNodeBrick::nodal_forces (tag: %d), not converged",
568 jeremic 1479
                                 this->getTag());
1480
 
1481
 
1482
 
1483
                //char *test = matpoint[where]->matmodel->getType();
1484
                // fmk - changing if so if into else block must be Template3Dep
1485
//              if (strcmp(matpoint[where]->matmodel->getType(),"Template3Dep") != 0)
1486
                   stress_at_GP = matpoint[where]->getStressTensor();
1487
 
1488
 
1489
                // nodal forces See Zienkievicz part 1 pp 108
1490
                nodal_forces =
1491
                     nodal_forces + dhGlobal("ib")*stress_at_GP("ab")*weight;
1492
                //nodal_forces.print("nf","\n\n Nodal Forces \n");
1493
 
1494
              }
1495
          }
1496
      }
1497
 
1498
    //cout << "\n element no. " << getTag() << endln;
1499
    //nodal_forces.print("nf","\n Nodal Forces \n");
1500
    return nodal_forces;
1501
 
1502
  }
1503
 
1504
////#############################################################################
1505
// returns nodal forces for given ITERATIVE stress field in an element
1506
tensor TwentyNodeBrick::iterative_nodal_forces(void)
1507
  {
1508
    int force_dim[] = {20,3}; // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
1509
 
1510
    tensor nodal_forces(2,force_dim,0.0);
1511
 
1512
    double r  = 0.0;
1513
    double rw = 0.0;
1514
    double s  = 0.0;
1515
    double sw = 0.0;
1516
    double t  = 0.0;
1517
    double tw = 0.0;
1518
 
1519
    short where = 0;
1520
    double weight = 0.0;
1521
 
1522
    int dh_dim[] = {20,3};   // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
1523
 
1524
    tensor dh(2, dh_dim, 0.0);
1525
 
1526
    stresstensor stress_at_GP(0.0);
1527
 
1528
    double det_of_Jacobian = 0.0;
1529
 
1530
    tensor Jacobian;
1531
    tensor JacobianINV;
1532
    tensor dhGlobal;
1533
 
1534
    for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
1535
      {
1536
        r = get_Gauss_p_c( r_integration_order, GP_c_r );
1537
        rw = get_Gauss_p_w( r_integration_order, GP_c_r );
1538
 
1539
        for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
1540
          {
1541
            s = get_Gauss_p_c( s_integration_order, GP_c_s );
1542
            sw = get_Gauss_p_w( s_integration_order, GP_c_s );
1543
 
1544
            for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
1545
              {
1546
                t = get_Gauss_p_c( t_integration_order, GP_c_t );
1547
                tw = get_Gauss_p_w( t_integration_order, GP_c_t );
1548
 
1549
                // this short routine is supposed to calculate position of
1550
                // Gauss point from 3D array of short's
1551
                where =
1552
                ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
1553
                //.....
1554
                //.....::printf("TwentyNodeBrick::iterative_nodal_forces(void)  ----**************** where = %d \n", where);
1555
                //.....::printf("UPDATE ");
1556
                //.....::printf("   GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
1557
                //.....                           GP_c_r,GP_c_s,GP_c_t);
1558
                // derivatives of local coordiantes with respect to local coordiantes
1559
                dh = dh_drst_at(r,s,t);
1560
 
1561
                // Jacobian tensor ( matrix )
1562
                Jacobian = Jacobian_3D(dh);
1563
                //....                Jacobian.print("J");
1564
 
1565
                // Inverse of Jacobian tensor ( matrix )
1566
                JacobianINV = Jacobian_3Dinv(dh);
1567
                //....                JacobianINV.print("JINV");
1568
 
1569
                // determinant of Jacobian tensor ( matrix )
1570
                det_of_Jacobian  = Jacobian.determinant();
1571
                //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
1572
 
1573
                // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
586 jeremic 1574
                //dhGlobal = dh("ij") * JacobianINV("jk");// Zhaohui 09-02-2001
584 jeremic 1575
                dhGlobal = dh("ij") * JacobianINV("kj");
568 jeremic 1576
 
1577
                //weight
1578
                weight = rw * sw * tw * det_of_Jacobian;
1579
 
1580
                //                   stress_at_GP = (GPstress)->operator[](where);
1581
                //stress_at_GP = GPiterative_stress[where];
1582
 
1583
                //stress_at_GP = ( matpoint[where].getTrialEPS() )->getStress();
1584
                stress_at_GP = matpoint[where]->getStressTensor();
1585
                stress_at_GP.reportshortpqtheta("\n iterative_stress at GAUSS point in iterative_nodal_force\n");
1586
 
1587
                // nodal forces See Zienkievicz part 1 pp 108
1588
                nodal_forces =
1589
                  nodal_forces + dhGlobal("ib")*stress_at_GP("ab")*weight;
1590
                //nodal_forces.print("nf","\n TwentyNodeBrick::iterative_nodal_forces Nodal Forces ~~~~\n");
1591
 
1592
              }
1593
          }
1594
      }
1595
 
1596
 
1597
    return nodal_forces;
1598
 
1599
  }
1600
 
1601
////#############################################################################
1602
// returns nodal forces for given constant stress field in the element
1603
tensor TwentyNodeBrick::nodal_forces_from_stress(stresstensor & stress)
1604
  {
1605
    int force_dim[] = {20,3};  // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
1606
 
1607
    tensor nodal_forces(2,force_dim,0.0);
1608
 
1609
    double r  = 0.0;
1610
    double rw = 0.0;
1611
    double s  = 0.0;
1612
    double sw = 0.0;
1613
    double t  = 0.0;
1614
    double tw = 0.0;
1615
 
1616
    double weight = 0.0;
1617
 
1618
    int dh_dim[] = {20,3}; // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
1619
 
1620
    tensor dh(2, dh_dim, 0.0);
1621
 
1622
    double det_of_Jacobian = 0.0;
1623
 
1624
    tensor Jacobian;
1625
    tensor JacobianINV;
1626
    tensor dhGlobal;
1627
 
1628
    for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
1629
      {
1630
        r = get_Gauss_p_c( r_integration_order, GP_c_r );
1631
        rw = get_Gauss_p_w( r_integration_order, GP_c_r );
1632
 
1633
        for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
1634
          {
1635
            s = get_Gauss_p_c( s_integration_order, GP_c_s );
1636
            sw = get_Gauss_p_w( s_integration_order, GP_c_s );
1637
 
1638
            for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
1639
              {
1640
                t = get_Gauss_p_c( t_integration_order, GP_c_t );
1641
                tw = get_Gauss_p_w( t_integration_order, GP_c_t );
1642
 
1643
                // this short routine is supposed to calculate position of
1644
                // Gauss point from 3D array of short's
1645
                //--                where =
1646
                //--                ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
1647
                //.....
1648
                //.....::printf("TwentyNodeBrick::iterative_nodal_forces(void)  ----**************** where = %d \n", where);
1649
                //.....::printf("UPDATE ");
1650
                //.....::printf("   GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
1651
                //.....                           GP_c_r,GP_c_s,GP_c_t);
1652
                // derivatives of local coordiantes with respect to local coordiantes
1653
                dh = dh_drst_at(r,s,t);
1654
 
1655
                // Jacobian tensor ( matrix )
1656
                Jacobian = Jacobian_3D(dh);
1657
                //....                Jacobian.print("J");
1658
 
1659
                // Inverse of Jacobian tensor ( matrix )
1660
                JacobianINV = Jacobian_3Dinv(dh);
1661
                //....                JacobianINV.print("JINV");
1662
 
1663
                // determinant of Jacobian tensor ( matrix )
1664
                det_of_Jacobian  = Jacobian.determinant();
1665
                //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
1666
 
1667
                // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
586 jeremic 1668
                //dhGlobal = dh("ij") * JacobianINV("jk");// Zhaohui 09-02-2001
584 jeremic 1669
                dhGlobal = dh("ij") * JacobianINV("kj");
568 jeremic 1670
 
1671
                //weight
1672
                weight = rw * sw * tw * det_of_Jacobian;
1673
 
1674
                //                   stress_at_GP = (GPstress)->operator[](where);
1675
                //                stress_at_GP = GPiterative_stress[where];
1676
                //GPiterative_stress[where].reportshortpqtheta("\n iterative_stress at GAUSS point in iterative_nodal_force\n");
1677
 
1678
                // nodal forces See Zienkievicz part 1 pp 108
1679
                nodal_forces =
1680
                  nodal_forces + dhGlobal("ib")*stress("ab")*weight;
1681
                //nodal_forces.print("nf","\n TwentyNodeBrick::iterative_nodal_forces Nodal Forces ~~~~\n");
1682
 
1683
              }
1684
          }
1685
      }
1686
 
1687
    return nodal_forces;
1688
 
1689
  }
1690
 
1691
 
1692
////#############################################################################
1693
// returns nodal forces for given incremental strain field in an element
1694
// by using the linearized constitutive tensor from the begining of the step !
1695
tensor TwentyNodeBrick::linearized_nodal_forces(void)
1696
  {
1697
    int force_dim[] = {20,3};  // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
1698
 
1699
    tensor linearized_nodal_forces(2,force_dim,0.0);
1700
 
1701
    double r  = 0.0;
1702
    double rw = 0.0;
1703
    double s  = 0.0;
1704
    double sw = 0.0;
1705
    double t  = 0.0;
1706
    double tw = 0.0;
1707
 
1708
    short where = 0;
1709
    double weight = 0.0;
1710
 
1711
    int dh_dim[] = {20,3};  // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
1712
 
1713
    tensor dh(2, dh_dim, 0.0);
1714
 
1715
    tensor Constitutive( 4, def_dim_4, 0.0);
1716
 
1717
    double det_of_Jacobian = 0.0;
1718
 
1719
    static int disp_dim[] = {20,3};  // Xiaoyan changed from {20,3 to {8,3} for 8 nodes
1720
 
1721
    tensor incremental_displacements(2,disp_dim,0.0);
1722
 
1723
    straintensor incremental_strain;
1724
 
1725
    tensor Jacobian;
1726
    tensor JacobianINV;
1727
    tensor dhGlobal;
1728
 
1729
    stresstensor final_linearized_stress;
1730
    //    stresstensor incremental_stress;
1731
    // tensor of incremental displacements taken from node objects for this element !
1732
    incremental_displacements = incr_disp();
1733
    //incremental_displacements.print("disp","\n incremental_displacements tensor at GAUSS point in iterative_Update\n");
1734
 
1735
    for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
1736
      {
1737
        r = get_Gauss_p_c( r_integration_order, GP_c_r );
1738
        rw = get_Gauss_p_w( r_integration_order, GP_c_r );
1739
 
1740
        for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
1741
          {
1742
            s = get_Gauss_p_c( s_integration_order, GP_c_s );
1743
            sw = get_Gauss_p_w( s_integration_order, GP_c_s );
1744
 
1745
            for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
1746
              {
1747
                t = get_Gauss_p_c( t_integration_order, GP_c_t );
1748
                tw = get_Gauss_p_w( t_integration_order, GP_c_t );
1749
 
1750
                // this short routine is supposed to calculate position of
1751
                // Gauss point from 3D array of short's
1752
                where =
1753
                ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
1754
 
1755
                // derivatives of local coordiantes with respect to local coordiantes
1756
                dh = dh_drst_at(r,s,t);
1757
 
1758
                // Jacobian tensor ( matrix )
1759
                Jacobian = Jacobian_3D(dh);
1760
                //....                Jacobian.print("J");
1761
 
1762
                // Inverse of Jacobian tensor ( matrix )
1763
                JacobianINV = Jacobian_3Dinv(dh);
1764
                //....                JacobianINV.print("JINV");
1765
 
1766
                // determinant of Jacobian tensor ( matrix )
1767
                det_of_Jacobian  = Jacobian.determinant();
1768
                //....  ::printf("determinant of Jacobian is %f\n",Jacobian_determinant );
1769
 
1770
                // Derivatives of local coordinates multiplied with inverse of Jacobian (see Bathe p-202)
586 jeremic 1771
                //dhGlobal = dh("ij") * JacobianINV("jk");// Zhaohui 09-02-2001
1772
                dhGlobal = dh("ij") * JacobianINV("kj");
568 jeremic 1773
 
1774
                //weight
1775
                weight = rw * sw * tw * det_of_Jacobian;
1776
                //..::printf("\n\nIN THE nodal forces ----**************** where = %d \n", where);
1777
                //..::printf("                    GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
1778
                //..                           GP_c_r,GP_c_s,GP_c_t);
1779
                //..::printf("WEIGHT = %f", weight);
1780
                //..::printf("determinant of Jacobian = %f", det_of_Jacobian);
1781
                // incremental straines at this Gauss point
1782
                // now in Update we know the incremental displacements so let's find
1783
                // the incremental strain
1784
                incremental_strain =
1785
                 (dhGlobal("ib")*incremental_displacements("ia")).symmetrize11();
1786
                incremental_strain.null_indices();
1787
                //incremental_strain.reportshort("\n incremental_strain tensor at GAUSS point in iterative_Update\n");
1788
 
1789
                //Constitutive = GPtangent_E[where];
1790
 
1791
                //EPState *tmp_eps = (matpoint[where]).getEPS();
1792
                //NDMaterial *tmp_ndm = (matpoint[where]).getNDMat();
1793
 
1794
                //if ( tmp_eps ) {     //Elasto-plastic case
1795
                //    mmodel->setEPS( *tmp_eps );
1796
                if ( ! (matpoint[where]->matmodel)->setTrialStrainIncr( incremental_strain)  )
1797
                   g3ErrorHandler->warning("TwentyNodeBrick::linearized_nodal_forces (tag: %d), not converged",
1798
                                 this->getTag());
1799
                Constitutive = (matpoint[where]->matmodel)->getTangentTensor();
1800
                //    matpoint[where].setEPS( mmodel->getEPS() ); //Set the new EPState back
1801
                //}
1802
                //else if ( tmp_ndm ) { //Elastic case
1803
                //    (matpoint[where].p_matmodel)->setTrialStrainIncr( incremental_strain );
1804
                //    Constitutive = (matpoint[where].p_matmodel)->getTangentTensor();
1805
                //}
1806
                //else {
1807
                //   g3ErrorHandler->fatal("TwentyNodeBrick::incremental_Update (tag: %d), could not getTangentTensor", this->getTag());
1808
                //   exit(1);
1809
                //}
1810
 
1811
                //Constitutive = ( matpoint[where].getEPS() )->getEep();
1812
                //..//GPtangent_E[where].print("\n tangent E at GAUSS point \n");
1813
 
1814
                final_linearized_stress =
1815
                  Constitutive("ijkl") * incremental_strain("kl");
1816
 
1817
                // nodal forces See Zienkievicz part 1 pp 108
1818
                linearized_nodal_forces = linearized_nodal_forces +
1819
                          dhGlobal("ib")*final_linearized_stress("ab")*weight;
1820
                //::::::                   nodal_forces.print("nf","\n\n Nodal Forces \n");
1821
 
1822
              }
1823
          }
1824
      }
1825
 
1826
 
1827
    return linearized_nodal_forces;
1828
 
1829
  }
1830
 
1831
 
1832
//#############################################################################
1833
void TwentyNodeBrick::report(char * msg)
1834
  {
1835
    if ( msg ) ::printf("** %s",msg);
1836
    ::printf("\n Element Number = %d\n", this->getTag() );
1837
    ::printf("\n Number of nodes in a TwentyNodebrick = %d\n",
1838
                                              nodes_in_brick);
1839
    ::printf("\n Determinant of Jacobian (! ==0 before comp.) = %f\n",
1840
                                                  determinant_of_Jacobian);
1841
 
1842
    ::printf("Node numbers \n");
1843
    ::printf(".....1.....2.....3.....4.....5.....6.....7.....8.....9.....0.....1.....2\n");
1844
           for ( int i=0 ; i<20 ; i++ )
1845
            //::printf("%6d",G_N_numbs[i]);
1846
            ::printf("%6d",connectedExternalNodes(i));
1847
    ::printf("\n");
1848
    //           for ( int j=8 ; j<20 ; j++ )
1849
    //             ::printf("%6d",G_N_numbs[j]);           // Commented by Xiaoyan
1850
    ::printf("\n\n");
1851
 
1852
    //    ::printf("Node existance array \n");
1853
    //           for ( int k=0 ; k<15 ; k++ )
1854
    //             ::printf("%6d",node_existance[k]);
1855
    //           ::printf("\n\n");                          // Commented by Xiaoyan
1856
 
1857
 
1858
    int total_number_of_Gauss_points = r_integration_order*
1859
                                       s_integration_order*
1860
                                       t_integration_order;
1861
    if ( total_number_of_Gauss_points != 0 )
1862
      {
1863
           // report from Node class
1864
           //for ( int in=0 ; in<8 ; in++ )
1865
           //             (nodes[G_N_numbs[in]]).report("nodes from within element (first 8)\n");
1866
           //Xiaoyan changed .report to . Print in above line 09/27/00
1867
           //  (nodes[G_N_numbs[in]]).Print(cout);
1868
 
1869
           nd1Ptr->Print(cout);
1870
           nd2Ptr->Print(cout);
1871
           nd3Ptr->Print(cout);
1872
           nd4Ptr->Print(cout);
1873
           nd5Ptr->Print(cout);
1874
           nd6Ptr->Print(cout);
1875
           nd7Ptr->Print(cout);
1876
           nd8Ptr->Print(cout);
1877
           nd9Ptr->Print(cout);
1878
           nd10Ptr->Print(cout);
1879
           nd11Ptr->Print(cout);
1880
           nd12Ptr->Print(cout);
1881
           nd13Ptr->Print(cout);
1882
           nd14Ptr->Print(cout);
1883
           nd15Ptr->Print(cout);
1884
           nd16Ptr->Print(cout);
1885
           nd17Ptr->Print(cout);
1886
           nd18Ptr->Print(cout);
1887
           nd19Ptr->Print(cout);
1888
           nd20Ptr->Print(cout);
1889
 
1890
           //           for ( int jn=8 ; jn<20 ; jn++ )
1891
           //             (nodes[G_N_numbs[jn]]).report("nodes from within element (last 15)\n");
1892
           // Commented by Xiaoyan
1893
      }
1894
 
1895
    ::printf("\n\nGauss-Legendre integration order\n");
1896
    ::printf("Integration order in r direction = %d\n",r_integration_order);
1897
    ::printf("Integration order in s direction = %d\n",s_integration_order);
1898
    ::printf("Integration order in t direction = %d\n\n",t_integration_order);
1899
 
1900
 
1901
 
1902
    for( int GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
1903
      {
1904
        for( int GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
1905
          {
1906
            for( int GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
1907
              {
1908
                // this short routine is supposed to calculate position of
1909
                // Gauss point from 3D array of short's
1910
                short where =
1911
                ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
1912
 
1913
                ::printf("\n\n----------------**************** where = %d \n", where);
1914
                ::printf("                    GP_c_r = %d,  GP_c_s = %d,  GP_c_t = %d\n",
1915
                            GP_c_r,GP_c_s,GP_c_t);
1916
                matpoint[where]->report("Material Point\n");
1917
                //GPstress[where].reportshort("stress at Gauss Point");
1918
                //GPstrain[where].reportshort("strain at Gauss Point");
1919
                //matpoint[where].report("Material model  at Gauss Point");
1920
              }
1921
          }
1922
      }
1923
 
1924
  }
1925
 
1926
 
1927
//#############################################################################
1928
void TwentyNodeBrick::reportshort(char * msg)
1929
  {
1930
    if ( msg ) ::printf("** %s",msg);
1931
    ::printf("\n Element Number = %d\n", this->getTag() );
1932
    ::printf("\n Number of nodes in a TwentyNodeBrick = %d\n",
1933
                                              nodes_in_brick);
1934
    ::printf("\n Determinant of Jacobian (! ==0 before comp.) = %f\n",
1935
                                                  determinant_of_Jacobian);
1936
 
1937
    ::printf("Node numbers \n");
1938
    ::printf(".....1.....2.....3.....4.....5.....6.....7.....8.....9.....0.....1.....2\n");
1939
           for ( int i=0 ; i<nodes_in_brick ; i++ )
1940
             //::printf("%6d",G_N_numbs[i]);
1941
             ::printf( "%6d",connectedExternalNodes(i) );
1942
 
1943
           ::printf("\n");
1944
           //           for ( int j=8 ; j<20 ; j++ )
1945
           //             ::printf("%6d",G_N_numbs[j]);   //// Commented by Xiaoyan
1946
           ::printf("\n\n");
1947
 
1948
           //    ::printf("Node existance array \n");
1949
           //           for ( int k=0 ; k<15 ; k++ )
1950
           //             ::printf("%6d",node_existance[k]);       // Commented by Xiaoyan
1951
           ::printf("\n\n");
1952
 
1953
  }
1954
 
1955
 
1956
 
1957
 
1958
//#############################################################################
1959
void TwentyNodeBrick::reportPAK(char * msg)
1960
  {
1961
    if ( msg ) ::printf("%s",msg);
1962
    ::printf("%10d   ",  this->getTag());
1963
    for ( int i=0 ; i<nodes_in_brick ; i++ )
1964
       ::printf( "%6d",connectedExternalNodes(i) );
1965
       //::printf("%6d",G_N_numbs[i]);
1966
 
1967
    printf("\n");
1968
  }
1969
 
1970
 
1971
//#############################################################################
1972
void TwentyNodeBrick::reportpqtheta(int GP_numb)
1973
  {
1974
    short where = GP_numb-1;
1975
    matpoint[where]->reportpqtheta("");
1976
  }
1977
 
1978
//#############################################################################
1979
void TwentyNodeBrick::reportTensor(char * msg)
1980
  {
1981
    //    if ( msg ) ::printf("** %s\n",msg);
1982
 
1983
    // special case for 8 nodes only
1984
    // special case for 8 nodes only
1985
    double r  = 0.0;
1986
    double s  = 0.0;
1987
    double t  = 0.0;
1988
 
1989
    short where = 0;
1990
 
1991
    // special case for 8 nodes only
1992
    static const int dim[] = {3, 20}; // static-> see ARM pp289-290
1993
    tensor NodalCoord(2, dim, 0.0);
1994
    tensor matpointCoord(2, dim, 0.0);
1995
    int h_dim[] = {60,3};   // Xiaoyan changed from {60,3} to {24,3} for 8 nodes
1996
    tensor H(2, h_dim, 0.0);
1997
 
1998
    //for (int ncount = 1 ; ncount <= 8 ; ncount++ )
1999
    ////  for (int ncount = 0 ; ncount <= 7 ; ncount++ )
2000
    //  {
2001
    //  //int global_node_number = get_global_number_of_node(ncount-1);
2002
    //  // printf("global node num %d",global_node_number);
2003
    //
2004
    //    //   NodalCoord.val(1,ncount) = nodes[global_node_number].x_coordinate();
2005
    //    //   NodalCoord.val(2,ncount) = nodes[global_node_number].y_coordinate();
2006
    //    //   NodalCoord.val(3,ncount) = nodes[global_node_number].z_coordinate();
2007
    //    // Xiaoyan changed to the following:  09/27/00
2008
    //  Vector Coordinates = nodes[global_node_number].getCrds();
2009
    //
2010
    //    NodalCoord.val(1,ncount) = Coordinates(0);
2011
    //    NodalCoord.val(2,ncount) = Coordinates(1);
2012
    //    NodalCoord.val(3,ncount) = Coordinates(2);
2013
    //printf("global point %d     x=%+.6e   y=%+.6e   z=%+.6e \n ", global_node_number,
2014
    //                                                      NodalCoord.val(1,ncount),
2015
    //                                                NodalCoord.val(2,ncount),
2016
    //                                                NodalCoord.val(3,ncount));
2017
    //}
2018
 
2019
    //Zhaohui using node pointers, which come from the Domain
2020
    const Vector &nd1Crds = nd1Ptr->getCrds();
2021
    const Vector &nd2Crds = nd2Ptr->getCrds();
2022
    const Vector &nd3Crds = nd3Ptr->getCrds();
2023
    const Vector &nd4Crds = nd4Ptr->getCrds();
2024
    const Vector &nd5Crds = nd5Ptr->getCrds();
2025
    const Vector &nd6Crds = nd6Ptr->getCrds();
2026
    const Vector &nd7Crds = nd7Ptr->getCrds();
2027
    const Vector &nd8Crds = nd8Ptr->getCrds();
2028
    const Vector &nd9Crds = nd9Ptr->getCrds();
2029
    const Vector &nd10Crds = nd10Ptr->getCrds();
2030
    const Vector &nd11Crds = nd11Ptr->getCrds();
2031
    const Vector &nd12Crds = nd12Ptr->getCrds();
2032
    const Vector &nd13Crds = nd13Ptr->getCrds();
2033
    const Vector &nd14Crds = nd14Ptr->getCrds();
2034
    const Vector &nd15Crds = nd15Ptr->getCrds();
2035
    const Vector &nd16Crds = nd16Ptr->getCrds();
2036
    const Vector &nd17Crds = nd17Ptr->getCrds();
2037
    const Vector &nd18Crds = nd18Ptr->getCrds();
2038
    const Vector &nd19Crds = nd19Ptr->getCrds();
2039
    const Vector &nd20Crds = nd20Ptr->getCrds();
2040
 
2041
    NodalCoord.val(1,1)=nd1Crds(0); NodalCoord.val(2,1)=nd1Crds(1); NodalCoord.val(3,1)=nd1Crds(2);
2042
    NodalCoord.val(1,2)=nd2Crds(0); NodalCoord.val(2,2)=nd2Crds(1); NodalCoord.val(3,2)=nd2Crds(2);
2043
    NodalCoord.val(1,3)=nd3Crds(0); NodalCoord.val(2,3)=nd3Crds(1); NodalCoord.val(3,3)=nd3Crds(2);
2044
    NodalCoord.val(1,4)=nd4Crds(0); NodalCoord.val(2,4)=nd4Crds(1); NodalCoord.val(3,4)=nd4Crds(2);
2045
    NodalCoord.val(1,5)=nd5Crds(0); NodalCoord.val(2,5)=nd5Crds(1); NodalCoord.val(3,5)=nd5Crds(2);
2046
    NodalCoord.val(1,6)=nd6Crds(0); NodalCoord.val(2,6)=nd6Crds(1); NodalCoord.val(3,6)=nd6Crds(2);
2047
    NodalCoord.val(1,7)=nd7Crds(0); NodalCoord.val(2,7)=nd7Crds(1); NodalCoord.val(3,7)=nd7Crds(2);
2048
    NodalCoord.val(1,8)=nd8Crds(0); NodalCoord.val(2,8)=nd8Crds(1); NodalCoord.val(3,8)=nd8Crds(2);
2049
    NodalCoord.val(1,9)=nd9Crds(0); NodalCoord.val(2,9)=nd8Crds(1); NodalCoord.val(3,9)=nd9Crds(2);
2050
    NodalCoord.val(1,10)=nd10Crds(0); NodalCoord.val(2,10)=nd10Crds(1); NodalCoord.val(3,10)=nd10Crds(2);
2051
    NodalCoord.val(1,11)=nd11Crds(0); NodalCoord.val(2,11)=nd11Crds(1); NodalCoord.val(3,11)=nd11Crds(2);
2052
    NodalCoord.val(1,12)=nd12Crds(0); NodalCoord.val(2,12)=nd12Crds(1); NodalCoord.val(3,12)=nd12Crds(2);
2053
    NodalCoord.val(1,13)=nd13Crds(0); NodalCoord.val(2,13)=nd13Crds(1); NodalCoord.val(3,13)=nd13Crds(2);
2054
    NodalCoord.val(1,14)=nd14Crds(0); NodalCoord.val(2,14)=nd14Crds(1); NodalCoord.val(3,14)=nd14Crds(2);
2055
    NodalCoord.val(1,15)=nd15Crds(0); NodalCoord.val(2,15)=nd15Crds(1); NodalCoord.val(3,15)=nd15Crds(2);
2056
    NodalCoord.val(1,16)=nd16Crds(0); NodalCoord.val(2,16)=nd16Crds(1); NodalCoord.val(3,16)=nd16Crds(2);
2057
    NodalCoord.val(1,17)=nd17Crds(0); NodalCoord.val(2,17)=nd17Crds(1); NodalCoord.val(3,17)=nd17Crds(2);
2058
    NodalCoord.val(1,18)=nd18Crds(0); NodalCoord.val(2,18)=nd18Crds(1); NodalCoord.val(3,18)=nd18Crds(2);
2059
    NodalCoord.val(1,19)=nd19Crds(0); NodalCoord.val(2,19)=nd19Crds(1); NodalCoord.val(3,19)=nd19Crds(2);
2060
    NodalCoord.val(1,20)=nd20Crds(0); NodalCoord.val(2,20)=nd20Crds(1); NodalCoord.val(3,20)=nd20Crds(2);
2061
 
586 jeremic 2062
 
568 jeremic 2063
    for( short GP_c_r = 1 ; GP_c_r <= r_integration_order ; GP_c_r++ )
2064
      {
2065
        r = get_Gauss_p_c( r_integration_order, GP_c_r );
2066
        for( short GP_c_s = 1 ; GP_c_s <= s_integration_order ; GP_c_s++ )
2067
          {
2068
            s = get_Gauss_p_c( s_integration_order, GP_c_s );
2069
            for( short GP_c_t = 1 ; GP_c_t <= t_integration_order ; GP_c_t++ )
2070
              {
2071
                t = get_Gauss_p_c( t_integration_order, GP_c_t );
2072
                // this short routine is supposed to calculate position of
2073
                // Gauss point from 3D array of short's
2074
                where =
2075
                ((GP_c_r-1)*s_integration_order+GP_c_s-1)*t_integration_order+GP_c_t-1;
2076
                // derivatives of local coordinates with respect to local coordinates
2077
 
2078
               H = H_3D(r,s,t);
2079
 
2080
               for (int encount=1 ; encount <= nodes_in_brick; encount++ )
2081
                //             for (int encount=0 ; encount <= 7 ; encount++ )
2082
                 {
2083
                  //  matpointCoord.val(1,where+1) =+NodalCoord.val(1,where+1) * H.val(encount*3-2,1);
2084
                  //  matpointCoord.val(2,where+1) =+NodalCoord.val(2,where+1) * H.val(encount*3-1,2);
2085
                  //  matpointCoord.val(3,where+1) =+NodalCoord.val(3,where+1) * H.val(encount*3-0,3);
2086
                  matpointCoord.val(1,where+1) +=NodalCoord.val(1,encount) * H.val(encount*3-2,1);
2087
                  //::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) );
2088
                  matpointCoord.val(2,where+1) +=NodalCoord.val(2,encount) * H.val(encount*3-1,2);
2089
                  matpointCoord.val(3,where+1) +=NodalCoord.val(3,encount) * H.val(encount*3-0,3);
2090
 
2091
                  }
2092
 
2093
    ::printf("gauss point# %d   %+.6e %+.6e %+.6e \n", where+1,
2094
                                                       matpointCoord.val(1,where+1),
2095
                                                       matpointCoord.val(2,where+1),
2096
                                                       matpointCoord.val(3,where+1));
2097
 
2098
    //matpoint[where].reportTensor("");
2099
 
2100
 
2101
              }
2102
          }
2103
      }
2104
 
2105
 }
2106
 
2107
 
2108
////#############################################################################
2109
 
2110
//#############################################################################
2111
//void TwentyNodeBrick::reportTensor(char * msg)
2112
// ZHaohui added to print gauss point coord. to file fp
2113
 
2114
void TwentyNodeBrick::reportTensorF(FILE * fp)
2115
  {
2116
    //if ( msg ) ::printf("** %s\n",msg);
2117
 
2118
    // special case for 8 nodes only
2119
    // special case for 8 nodes only
2120
    double r  = 0.0;
2121
    double s  = 0.0;
2122
    double t  = 0.0;
2123
 
2124
    short where = 0;
2125
 
2126
    // special case for 8 nodes only
2127
    static const int dim[] = {3, 20}; // static-> see ARM pp289-290
2128
    tensor NodalCoord(2, dim, 0.0);
2129
    tensor matpointCoord(2, dim, 0.0);
2130
    int h_dim[] = {60,3};  // Xiaoyan changed from {60,3} to {24,3} for 8 nodes
2131
 
2132
    tensor H(2, h_dim, 0.0);
2133
 
2134
    //for (int ncount = 1 ; ncount <= 8 ; ncount++ )
2135
    //  // for (int ncount = 0 ; ncount <= 7 ; ncount++ )
2136
    //  {
2137
    //  int global_node_number = get_global_number_of_node(ncount-1);
2138
    //  // printf("global node num %d",global_node_number);
2139
    //
2140
    //    //        NodalCoord.val(1,ncount) = nodes[global_node_number].x_coordinate();
2141
    //    //        NodalCoord.val(2,ncount) = nodes[global_node_number].y_coordinate();
2142
    //    //        NodalCoord.val(3,ncount) = nodes[global_node_number].z_coordinate();
2143
    //    // Xiaoyan changed to the following:  09/27/00
2144
    //  Vector Coordinates = nodes[global_node_number].getCrds();
2145
    //    NodalCoord.val(1,ncount) = Coordinates(0);
2146
    //    NodalCoord.val(2,ncount) = Coordinates(1);
2147
    //    NodalCoord.val(3,ncount) = Coordinates(2);
2148
    //printf("global point %d     x=%+.6e   y=%+.6e   z=%+.6e \n ", global_node_number,
2149
    //                                                      NodalCoord.val(1,ncount),
2150
    //                                                NodalCoord.val(2,ncount),
2151
    //                                                NodalCoord.val(3,ncount));
2152
    //  }
2153
 
2154
    //Zhaohui using node pointers, which come from the Domain
2155
    const Vector &nd1Crds = nd1Ptr->getCrds();
2156
    const Vector &nd2Crds = nd2Ptr->getCrds();
2157
    const Vector &nd3Crds = nd3Ptr->getCrds();
2158
    const Vector &nd4Crds = nd4Ptr->getCrds();
2159
    const Vector &nd5Crds = nd5Ptr->getCrds();
2160
    const Vector &nd6Crds = nd6Ptr->getCrds();
2161
    const Vector &nd7Crds = nd7Ptr->getCrds();
2162
    const Vector &nd8Crds = nd8Ptr->getCrds();
2163
    const Vector &nd9Crds  =  nd9Ptr->getCrds();
2164
    const Vector &nd10Crds = nd10Ptr->getCrds();
2165
    const Vector &nd11Crds = nd11Ptr->getCrds();
2166
    const Vector &nd12Crds = nd12Ptr->getCrds();
2167
    const Vector &nd13Crds = nd13Ptr->getCrds();
2168
    const Vector &nd14Crds = nd14Ptr->getCrds();
2169
    const Vector &nd15Crds = nd15Ptr->getCrds();
2170
    const Vector &nd16Crds = nd16Ptr->getCrds();
2171
    const Vector &nd17Crds = nd17Ptr->getCrds();
2172
    const Vector &nd18Crds = nd18Ptr->getCrds();
2173
    const Vector &nd19Crds = nd19Ptr->getCrds();
2174
    const Vector &nd20Crds = nd20Ptr->getCrds();
2175
 
2176
    NodalCoord.val(1,1)=nd1Crds(0); NodalCoord.val(2,1)=nd1Crds(1); NodalCoord.val(3,1)=nd1Crds(2);
2177
    NodalCoord.val(1,2)=nd2Crds(0); NodalCoord.val(2,2)=nd2Crds(1); NodalCoord.val(3,2)=nd2Crds(2);
2178
    NodalCoord.val(1,3)=nd3Crds(0); NodalCoord.val(2,3)=nd3Crds(1); NodalCoord.val(3,3)=nd3Crds(2);
2179
    NodalCoord.val(1,4)=nd4Crds(0); NodalCoord.val(2,4)=nd4Crds(1); NodalCoord.val(3,4)=nd4Crds(2);
2180
    NodalCoord.val(1,5)=nd5Crds(0); NodalCoord.val(2,5)=nd5Crds(1); NodalCoord.val(3,5)=nd5Crds(2);
2181
    NodalCoord.val(1,6)=nd6Crds(0); NodalCoord.val(2,6)=nd6Crds(1); NodalCoord.val(3,6)=nd6Crds(2);
2182
    NodalCoord.val(1,7)=nd7Crds(0); NodalCoord.val(2,7)=nd7Crds(1); NodalCoord.val(3,7)=nd7Crds(2);
2183
    NodalCoord.val(1,8)=nd8Crds(0); NodalCoord.val(2,8)=nd8Crds(1); NodalCoord.val(3,8)=nd8Crds(2);
2184
    NodalCoord.val(1,9)=nd9Crds(0); NodalCoord.val(2,9)=nd9Crds(1); NodalCoord.val(3,9)=nd9Crds(2);
2185
    NodalCoord.val(1,10)=nd10Crds(0); NodalCoord.val(2,10)=nd10Crds(1); NodalCoord.val(3,10)=nd10Crds(2);
2186
    NodalCoord.val(1,11)=nd11Crds(0); NodalCoord.val(2,11)=nd11Crds(1); NodalCoord.val(3,11)=nd11Crds(2);
2187
    NodalCoord.val(1,12)=nd12Crds(0); NodalCoord.val(2,12)=nd12Crds(1); NodalCoord.val(3,12)=nd12Crds(2);
2188
    NodalCoord.val(1,13)=nd13Crds(0); NodalCoord.val(2,13)=nd13Crds(1); NodalCoord.val(3,13)=nd13Crds(2);
2189
    NodalCoord.val(1,14)=nd14Crds(0); NodalCoord.val(2,14)=nd14Crds(1); NodalCoord.val(3,14)=nd14Crds(2);
2190
    NodalCoord.val(1,15)=nd15Crds(0); NodalCoord.val(2,15)=nd15Crds(1); NodalCoord.val(3,15)=nd15Crds(2);
2191
    NodalCoord.val(1,16)=nd16Crds(0); NodalCoord.val(2,16)=nd16Crds(1); NodalCoord.val(3,16)=nd16Crds(2);
2192
    NodalCoord.val(1,17)=nd17Crds(0); NodalCoord.val(2,17)=nd17Crds(1); NodalCoord.val(3,17)=nd17Crds(2);
2193
    NodalCoord.val(1,18)=nd18Crds(0); NodalCoord.val(2,18)=nd18Crds(1); NodalCoord.val(3,18)=nd18Crds(2);
2194
    NodalCoord.val(1,19)=