muMECH  1.0
esuf_Penny.cpp
Go to the documentation of this file.
1 //********************************************************************************************************
2 // code: ### ### ##### #### ## ##
3 // ## ## ######## ## ## ## ## ##
4 // ## ## ## ## ## ### ## ######
5 // ## ## ## ## ## ## ## ## ##
6 // ##### ## ## ##### #### ## ##
7 // ##
8 //
9 // name: eshelbySoluUniformFieldPenny.cpp
10 // description: source file of the function returning the Eshelby solution of an ellipsoidal inclusion
11 // loaded by the uniform strain/stress field
12 // author(s): Jan Novak
13 
14 // last edit: 11. 08. 2010
15 // language: C, C++
16 // license: This program is free software; you can redistribute it and/or modify
17 // it under the terms of the GNU Lesser General Public License as published by
18 // the Free Software Foundation; either version 2 of the License, or
19 // (at your option) any later version.
20 //
21 // This program is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // GNU Lesser General Public License for more details.
25 //
26 // You should have received a copy of the GNU Lesser General Public License
27 // along with this program; if not, write to the Free Software
28 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 //********************************************************************************************************
30 
31 #include <iostream>
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <math.h>
35 #include "macros.h"
36 #include "elementaryFunctions.h"
37 #include "esuf_Penny.h"
38 #include "esei_Penny.h"
39 #include "legendreIntegrals.h"
40 #include "types.h"
41 
42 namespace mumech {
43 
44 //miscelaneous macros
45 //-------------------
46 //coordinates
47 #define X1 x[0]
48 #define X2 x[1]
49 #define X3 x[2]
50 //elliptic integrals
51 #define __I( component ) eSInt[component]
52 
53 
54 //********************************************************************************************************
55 // PUBLIC FUNCTIONS
56 //********************************************************************************************************
57 
58 //********************************************************************************************************
59 // description: Function gives a component of the Eshelby tensor
60 // last edit: 16. 10. 2009
61 //-------------------------------------------------------------------------------------------------------
62 // note: Solution adopted from Toshio Mura's book (1982) and Eshelby article (1957)
63 // @sort_a[3] - sorted flat-ellipsoidal semiaxes (a1>a2>>a3)
64 // @eSInt[13] - values of elliptical integrals (potentials)
65 // always for lambda = 0. Even for external fields !!!
66 // @nu - Poisson's ratio
67 // @flag - Eshelby tensor component S_ijkl
68 //********************************************************************************************************
70  const double eSInt[13], double nu,
72 {
73  double a1 = sort_a[0], a2 = sort_a[1], a3 = sort_a[2];
74  double S_ijkl = 0.;
75 
76  switch( flag ){
77  /* 1st row */
78  case _S1111_ :
79  S_ijkl = MULT * ( 3. * SQR( a1 ) * __I(_Int11_) + ( 1. - 2. * nu ) * __I(_Int1_) );
80  break;
81  case _S1122_ :
82  S_ijkl = MULT * ( SQR( a2 ) * __I(_Int12_) - ( 1. - 2. * nu ) * __I(_Int1_) );
83  break;
84  case _S1133_ :
85  S_ijkl = MULT * ( SQR( a3 ) * __I(_Int13_) - ( 1. - 2. * nu ) * __I(_Int1_) );
86  break;
87  /* 2nd row */
88  case _S2211_ :
89  S_ijkl = MULT * ( SQR( a1 ) * __I(_Int21_) - ( 1. - 2. * nu ) * __I(_Int2_) );
90  break;
91  case _S2222_ :
92  S_ijkl = MULT * ( 3. * SQR( a2 ) * __I(_Int22_) + ( 1. - 2. * nu ) * __I(_Int2_) );
93  break;
94  case _S2233_ :
95  S_ijkl = MULT * ( SQR( a3 ) * __I(_Int23_) - ( 1. - 2. * nu ) * __I(_Int2_) );
96  break;
97  /* 3rd row */
98  case _S3311_ :
99  S_ijkl = MULT * ( SQR( a1 ) * __I(_Int31_) - ( 1. - 2. * nu ) * __I(_Int3_) );
100  break;
101  case _S3322_ :
102  S_ijkl = MULT * ( SQR( a2 ) * __I(_Int32_) - ( 1. - 2. * nu ) * __I(_Int3_) );
103  break;
104  case _S3333_ :
105  S_ijkl = MULT * ( 3. * __I(_Int33_) + ( 1. - 2. * nu ) * __I(_Int3_) ); // J[13] for flat shape contains I33 * a3^2
106  break;
107  /* !!! FEEP notation !!! e_ij = {e_11, e_22, e_33, e_12, e_32, e_31}^T */
108  /* 4th row */
109  case _S1212_ :
110  S_ijkl = .5 * MULT * ( ( 1. - 2. * nu ) * ( __I(_Int1_) + __I(_Int2_) ) +
111  ( SQR( a1 ) + SQR( a2 ) ) * __I(_Int12_) );
112  break;
113  /* 5th row */
114  case _S2323_ :
115  S_ijkl = .5 * MULT * ( ( 1. - 2. * nu ) * ( __I(_Int2_) + __I(_Int3_) ) +
116  ( SQR( a2 ) + SQR( a3 ) ) * __I(_Int23_) );
117  break;
118  /* 6th row */
119  case _S1313_ :
120  S_ijkl = .5 * MULT * ( ( 1. - 2. * nu ) * ( __I(_Int1_) + __I(_Int3_) ) +
121  ( SQR( a1 ) + SQR( a3 ) ) * __I(_Int13_) );
122  break;
123  default:
124  S_ijkl = 0.;
125  break;
126  }//end of switch: flag
127 
128  return S_ijkl;
129 }//end of function: eshelbyTensCompUniformFieldPenny( )
130 
131 
132 
133 //********************************************************************************************************
134 // description: Function gives D_ijkl(x) generalized Eshelby's tensor.
135 // Function requiers "constructor2"
136 // last edit: 12. 07. 2010
137 //-------------------------------------------------------------------------------------------------------
138 // note: @D[36] - Perturbation (generalized Eshelby's) tensor to be evaluated and saved
139 // @S[12] - Eshelby's tensor for internal fields (uniform fields)
140 // @J[13] - Ferers-Dysons' elliptic integrals
141 // @dJi[9] - first derivatives of Ferers-Dysons' elliptic integrals Ii
142 // @dJij[27] - first derivatives of Ferers-Dysons' elliptic integrals Iij
143 // @ddJi[27] - second derivatives of Ferers-Dysons' elliptic integrals Ii
144 // @ddJij[81] - second derivatives of Ferers-Dysons' elliptic integrals Ii
145 // @sort_a[3] - sorted semiaxes' dimensions
146 // @x[3] - coordinates of a point
147 // @nu - Poisson's ratio of the matrix material
148 // @pos - position of the pint (_INT_POINT_/_EXT_POINT_)
149 //********************************************************************************************************
150 void eshelbySoluUniformFieldPenny::giveDijkl(double D[36], const double S[12], const double J[13], const double dJi[9],
151  const double dJij[27], const double ddJi[27], const double ddJij[81],
152  const double sort_a[3], const double x[3])
153 {
154  _errorr("termit: misto teto fce byla puvodne volana rodicovska, proc?");
155 
156  // Temporary test of giveSijkl () implementation.
157  const int length = 36;
158  double S1[length];
159  double S2[length];
160  this->giveSijkl( S1, J, sort_a, nu, false );
161  this->giveSijkl( S2, J, sort_a, nu, true );
162  double err = 0.0;
163  for (int i=0; i < length; i++)
164  err += (S2[i] - S1[i]) * (S2[i] - S1[i]);
165 
166 
167  //if ( pos == PPF_INT_POINT ) {
168  // CleanVector( D, 36 );
169  // //1st row
170  // D[_1111_] = S[__1111_]; D[_1122_] = S[__1122_]; D[_1133_] = S[__1133_];
171  // //2nd row
172  // D[_2211_] = S[__2211_]; D[_2222_] = S[__2222_]; D[_2233_] = S[__2233_];
173  // //3rd row
174  // D[_3311_] = S[__3311_]; D[_3322_] = S[__3322_]; D[_3333_] = S[__3333_];
175  // //4th row
176  // D[_1212_] = S[__1212_];
177  // //5th row
178  // D[_2323_] = S[__2323_];
179  // //6th row
180  // D[_1313_] = S[__1313_];
181  //}
182  //else if ( pos == PPF_EXT_POINT ) {
183  double auxS[36];//auxiliary array to save Eshelby tensor
184  //Position dependent Eshelby tensor:
185  this->giveSijkl( auxS, J, sort_a, nu, false );
186 
187  for (int i = 0; i < 36; i++)
188  D[i] = auxS[i];
189 
190  // TomTag:
191  // No Mandel notation.
192  // eps_star_ij = D_ijkl * eps_tau_kl
193  // e.g. eps_11 = ... + D_1112 eps_tau_12 + ... + D_1121 eps_tau_21
194  // Therefore thre right half of matrix D is multiplied by two.
195  D[_1112_] *= 2.0;
196  D[_1123_] *= 2.0;
197  D[_1113_] *= 2.0;
199  D[_2212_] *= 2.0;
200  D[_2223_] *= 2.0;
201  D[_2213_] *= 2.0;
203  D[_3312_] *= 2.0;
204  D[_3323_] *= 2.0;
205  D[_3313_] *= 2.0;
207  D[_1212_] *= 2.0;
208  D[_1223_] *= 2.0;
209  D[_1213_] *= 2.0;
211  D[_2312_] *= 2.0;
212  D[_2323_] *= 2.0;
213  D[_2313_] *= 2.0;
215  D[_1312_] *= 2.0;
216  D[_1323_] *= 2.0;
217  D[_1313_] *= 2.0;
218  //}
219  //else _errorr( "giveDijkl: invalid position of a given point");
220 
221  return ;
222 }//end of function: giveDijkl( )
223 
224 
225 
226 //********************************************************************************************************
227 // PROTECTED FUNCTIONS
228 //********************************************************************************************************
229 
230 //********************************************************************************************************
231 // description: Function gives the displacement perturbation tensor of internal fields.
232 // Function requiers "constructor2"
233 // last edit: 15 07. 2010
234 //-------------------------------------------------------------------------------------------------------
235 // note: @Lint[18] - Perturbation (Eshelby's-like) displacement tensor to be evaluated and saved
236 // @J[13] - Ferers-Dysons' elliptic integrals
237 // @sort_a[3] - sorted semiaxes' dimensions
238 // @x[3] - coordinates of a point
239 //********************************************************************************************************
240 void eshelbySoluUniformFieldPenny::giveLijkINT( double Lint[18], const double J[13], const double sort_a[3],
241  const double x[3] )
242 {
243  _errorr("termit: misto teto fce byla puvodne volana rodicovska, proc?");
244 
245  CleanVector(Lint, 18); // No displacements of external points for flat shape.
246  return ;
247 }//end of function: giveLijkINT( )
248 
249 //********************************************************************************************************
250 // description: Function gives the displacement perturbation tensor of external fields.
251 // Function requiers "constructor2"
252 // last edit: 15. 07. 2010
253 //-------------------------------------------------------------------------------------------------------
254 // note: @Lext[18] - Perturbation (generalized Eshelby's) displacement tensor to be evaluated
255 // and saved
256 // @Lint[18] - Perturbation (Eshelby's-like) displacement tensor
257 // @dJi[9] - first derivatives of Ferers-Dysons' elliptic integrals Ii
258 // @dJij[27] - first derivatives of Ferers-Dysons' elliptic integrals Iij
259 // @sort_a[3] - sorted semiaxes' dimensions
260 // @x[3] - coordinates of a point
261 // @nu - Poisson's ratio of the matrix material
262 //********************************************************************************************************
263 void eshelbySoluUniformFieldPenny::giveLijkEXT( double Lext[18], const double Lint[18], const double dJi[9],
264  const double dJij[27], const double sort_a[3],
265  const double x[3])
266 {
267  //UNREFERENCED_PARAMETER(nu);
268  CleanVector(Lext, 18); // No displacements of external points for flat shape.
269  return;
270 }//end of function: giveLijkEXT( )
271 
272 //********************************************************************************************************
273 // description: Function gives S_ijkl(x) position dependent Eshelby's tensor. (This is not
274 // the strain perturbation tensor! Just its part ). The returned members of the
275 // S_ijkl matrix are in tensorial (theoretical) notation!
276 // Function requiers "constructor2"
277 // last edit: 12. 07. 2010
278 //-------------------------------------------------------------------------------------------------------
279 // note: @S[36] - Eshelby position dependent tensor
280 // @J[13] - Ferers-Dysons' elliptic integrals
281 // @sort_a[3] - sorted semiaxes' dimensions
282 // @nu - Poisson's ratio of the matrix material
283 //********************************************************************************************************
284 void eshelbySoluUniformFieldPenny::giveSijkl( double S[36], const double J[13], const double sort_a[3],
285  double nu, bool newFormulation )
286 {
287  _errorr("termit: misto teto fce byla puvodne volana rodicovska, proc?");
288 
289  double mult = this->multTRN;
290 
291  if (!newFormulation)
292  {
293  // Original formulation of S tensor.
294  // Differs from Mura book Eq.(11.16), but Eshelby tensor is OK when compared to HELP results.
295  //1st row
296  S[_1111_] = mult * ( this->_1Min2nu * J1 + 3. * SQR( sort_a[0] ) * J11 );
297  S[_1122_] = mult * ( this->_2nu * J1 - J2 + SQR( sort_a[0] ) * J21 );
298  S[_1133_] = mult * ( this->_2nu * J1 - J3 + SQR( sort_a[0] ) * J31 );
299  S[_1123_] = S[_1113_] = S[_1112_] = 0.;
300  //2nd row
301  S[_2211_] = mult * ( this->_2nu * J2 - J1 + SQR( sort_a[1] ) * J12 );
302  S[_2222_] = mult * ( this->_1Min2nu * J2 + 3. * SQR( sort_a[1] ) * J22 );
303  S[_2233_] = mult * ( this->_2nu * J2 - J3 + SQR( sort_a[1] ) * J32 );
304  S[_2223_] = S[_2213_] = S[_2212_] = 0.;
305  //3rd row
306  S[_3311_] = mult * ( this->_2nu * J3 - J1 + SQR( sort_a[2] ) * J13 );
307  S[_3322_] = mult * ( this->_2nu * J3 - J2 + SQR( sort_a[2] ) * J23 );
308  S[_3333_] = mult * ( this->_1Min2nu * J3 + 3. * J33 ); // J[13] for flat shape contains I33 * a3^2
309  S[_3323_] = S[_3313_] = S[_3312_] = 0.;
310  //4th row
311  S[_1211_] = S[_1222_] = S[_1233_] = 0.;
312  S[_1212_] = mult * ( this->_1MinNu * J1 - nu * J2 + SQR( sort_a[0] ) * J12 );
313  S[_1223_] = S[_1213_] = 0.;
314  //5th row
315  S[_2311_] = S[_2322_] = S[_2333_] = S[_2312_] = 0.;
316  S[_2323_] = mult * ( this->_1MinNu * J2 - nu * J3 + SQR( sort_a[1] ) * J23 );
317  S[_2313_] = 0.;
318  //6th row
319  S[_1311_] = S[_1322_] = S[_1333_] = S[_1312_] = S[_1323_] = 0.;
320  S[_1313_] = mult * ( this->_1MinNu * J1 - nu * J3 + SQR( sort_a[0] ) * J13 );
321  }
322  else
323  {
324  // New formulation (15.08.2013), corresponds to Eq.(11.16).
325  //1st row
326  S[_1111_] = mult * ( this->_1Min2nu * J1 + 3. * SQR( sort_a[0] ) * J11 );
327  S[_1122_] = mult * ( this->_2nu * J1 - J1 + SQR( sort_a[1] ) * J12 );
328  S[_1133_] = mult * ( this->_2nu * J1 - J1 + SQR( sort_a[2] ) * J13 );
329  S[_1123_] = S[_1113_] = S[_1112_] = 0.;
330  //2nd row
331  S[_2211_] = mult * ( this->_2nu * J2 - J2 + SQR( sort_a[0] ) * J12 );
332  S[_2222_] = mult * ( this->_1Min2nu * J2 + 3. * SQR( sort_a[1] ) * J22 );
333  S[_2233_] = mult * ( this->_2nu * J2 - J2 + SQR( sort_a[2] ) * J23 );
334  S[_2223_] = S[_2213_] = S[_2212_] = 0.;
335  //3rd row
336  S[_3311_] = mult * ( this->_2nu * J3 - J3 + SQR( sort_a[0] ) * J31 );
337  S[_3322_] = mult * ( this->_2nu * J3 - J3 + SQR( sort_a[1] ) * J23 );
338  S[_3333_] = mult * ( this->_1Min2nu * J3 + 3. * J33 ); // J[13] for flat shape contains I33 * a3^2
339  S[_3323_] = S[_3313_] = S[_3312_] = 0.;
340  //4th row
341  S[_1211_] = S[_1222_] = S[_1233_] = 0.;
342  S[_1212_] = mult * ( this->_1Min2nu / 2.0 * (J1 + J2) + ( SQR( sort_a[0] ) + SQR( sort_a[1] ) ) / 2.0 * J12 );
343  S[_1223_] = S[_1213_] = 0.;
344  //5th row
345  S[_2311_] = S[_2322_] = S[_2333_] = S[_2312_] = 0.;
346  S[_2323_] = mult * ( this->_1Min2nu / 2.0 * (J2 + J3) + ( SQR( sort_a[1] ) + SQR( sort_a[2] ) ) / 2.0 * J23 );
347  S[_2313_] = 0.;
348  //6th row
349  S[_1311_] = S[_1322_] = S[_1333_] = S[_1312_] = S[_1323_] = 0.;
350  S[_1313_] = mult * ( this->_1Min2nu / 2.0 * (J1 + J3) + ( SQR( sort_a[0] ) + SQR( sort_a[2] ) ) / 2.0 * J13 );
351  }
352 
353  return ;
354 }//end of function: giveSijkl( )
355 
356 } // end of namespace mumech
357 
358 /*end of file*/
Class eshelbySoluEllipticIntegralsPenny.
#define _2223_
Definition: types.h:326
#define _2311_
Definition: types.h:343
#define _1323_
Definition: types.h:354
#define _Int3_
Definition: types.h:404
file of various types and symbolic constant definitions
#define _1222_
Definition: types.h:337
#define _3322_
Definition: types.h:330
#define J33
Definition: types.h:444
void giveLijkEXT(double Lext[18], const double Lint[18], const double dJi[9], const double dJij[27], const double sort_a[3], const double x[3])
Definition: esuf_Penny.cpp:263
void giveDijkl(double D[36], const double S[12], const double J[13], const double dJi[9], const double dJij[27], const double ddJi[27], const double ddJij[81], const double sort_a[3], const double x[3])
Definition: esuf_Penny.cpp:150
#define J31
Definition: types.h:442
Class legendreIntegrals.
#define _Int23_
Definition: types.h:412
#define _1123_
Definition: types.h:319
#define _2212_
Definition: types.h:325
#define _Int32_
Definition: types.h:415
double nu
nu of matrix
Definition: esuf.h:51
#define _3313_
Definition: types.h:334
#define _Int22_
Definition: types.h:411
#define _2213_
Definition: types.h:327
#define _1322_
Definition: types.h:351
void giveLijkINT(double Lint[18], const double J[13], const double sort_a[3], const double x[3])
Definition: esuf_Penny.cpp:240
#define _1212_
Definition: types.h:339
#define _2322_
Definition: types.h:344
#define J3
Definition: types.h:432
#define _1223_
Definition: types.h:340
The header file of usefull macros.
Collection of the functions of basic manipulations, some of them can be used instead of their counter...
#define _Int1_
Definition: types.h:402
#define _Int2_
Definition: types.h:403
#define J2
Definition: types.h:431
#define _Int12_
Definition: types.h:407
#define _Int13_
Definition: types.h:408
#define _1113_
Definition: types.h:320
#define _2333_
Definition: types.h:345
#define _2233_
Definition: types.h:324
#define _1213_
Definition: types.h:341
#define _2222_
Definition: types.h:323
#define J32
Definition: types.h:443
#define J13
Definition: types.h:436
#define _1111_
Definition: types.h:315
#define J11
Definition: types.h:434
#define _1122_
Definition: types.h:316
EshelbyTensComponent
Definition: types.h:221
#define SQR(a)
Definition: macros.h:97
#define J22
Definition: types.h:439
#define _1211_
Definition: types.h:336
#define _3323_
Definition: types.h:333
#define _errorr(_1)
Definition: gelib.h:160
#define _2312_
Definition: types.h:346
#define _2211_
Definition: types.h:322
#define J1
Definition: types.h:430
#define _1333_
Definition: types.h:352
void giveSijkl(double S[36], const double J[13], const double sort_a[3], double nu, bool newFormulation)
Definition: esuf_Penny.cpp:284
#define _1312_
Definition: types.h:353
#define _3311_
Definition: types.h:329
#define J21
Definition: types.h:438
#define __I(component)
Definition: esuf_Penny.cpp:51
#define J12
Definition: types.h:435
#define _Int21_
Definition: types.h:410
double multTRN
1./mult
Definition: esuf.h:57
#define _Int31_
Definition: types.h:414
#define _Int33_
Definition: types.h:416
#define _2313_
Definition: types.h:348
#define _3333_
Definition: types.h:331
#define _1311_
Definition: types.h:350
#define _1133_
Definition: types.h:317
#define _Int11_
Definition: types.h:406
double eshelbyTensCompUniformField(const double sort_a[3], const double eInt[13], double nu, EshelbyTensComponent flag)
Definition: esuf_Penny.cpp:69
void CleanVector(double *a, long n)
Functin cleans a &#39;double&#39; vector, initialize each value being 0-zero.
#define _1313_
Definition: types.h:355
#define J23
Definition: types.h:440
#define _1233_
Definition: types.h:338
#define _2323_
Definition: types.h:347
#define _1112_
Definition: types.h:318
#define _3312_
Definition: types.h:332