Subversion Repositories OpenSees

Rev

Rev 568 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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