muMECH  1.0
esuf_FlatEllipsoid.cpp
Go to the documentation of this file.
1 //********************************************************************************************************
2 // code: ### ### ##### #### ## ##
3 // ## ## ######## ## ## ## ## ##
4 // ## ## ## ## ## ### ## ######
5 // ## ## ## ## ## ## ## ## ##
6 // ##### ## ## ##### #### ## ##
7 // ##
8 //
9 // name: eshelbySoluUniformFieldFlatEllipsoid.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_FlatEllipsoid.h"
38 #include "esei_FlatEllipsoid.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: eshelbyTensCompUniformFieldFlatEllipsoid( )
130 
131 
132 //********************************************************************************************************
133 // description: Function gives D_ijkl(x) generalized Eshelby's tensor.
134 // Function requiers "constructor2"
135 // last edit: 12. 07. 2010
136 //-------------------------------------------------------------------------------------------------------
137 // note: @D[36] - Perturbation (generalized Eshelby's) tensor to be evaluated and saved
138 // @S[12] - Eshelby's tensor for internal fields (uniform fields)
139 // @J[13] - Ferers-Dysons' elliptic integrals
140 // @dJi[9] - first derivatives of Ferers-Dysons' elliptic integrals Ii
141 // @dJij[27] - first derivatives of Ferers-Dysons' elliptic integrals Iij
142 // @ddJi[27] - second derivatives of Ferers-Dysons' elliptic integrals Ii
143 // @ddJij[81] - second derivatives of Ferers-Dysons' elliptic integrals Ii
144 // @sort_a[3] - sorted semiaxes' dimensions
145 // @x[3] - coordinates of a point
146 // @nu - Poisson's ratio of the matrix material
147 // @pos - position of the pint (_INT_POINT_/_EXT_POINT_)
148 //********************************************************************************************************
149 void eshelbySoluUniformFieldFlatEllipsoid::giveDijkl( double D[36], const double S[12], const double J[13], const double dJi[9],
150  const double dJij[27], const double ddJi[27], const double ddJij[81],
151  const double sort_a[3], const double x[3] )
152 {
153  _errorr("termit: misto teto fce byla puvodne volana rodicovska, proc?");
154 
155  // Temporary test of giveSijkl () implementation.
156  const int length = 36;
157  double S1[length];
158  double S2[length];
159  this->giveSijkl( S1, J, sort_a, nu, false );
160  this->giveSijkl( S2, J, sort_a, nu, true );
161  double err = 0.0;
162  for (int i=0; i < length; i++)
163  err += (S2[i] - S1[i]) * (S2[i] - S1[i]);
164 
165 
166  //if ( pos == PPF_INT_POINT ) {
167  // CleanVector( D, 36 );
168  // //1st row
169  // D[_1111_] = S[__1111_]; D[_1122_] = S[__1122_]; D[_1133_] = S[__1133_];
170  // //2nd row
171  // D[_2211_] = S[__2211_]; D[_2222_] = S[__2222_]; D[_2233_] = S[__2233_];
172  // //3rd row
173  // D[_3311_] = S[__3311_]; D[_3322_] = S[__3322_]; D[_3333_] = S[__3333_];
174  // //4th row
175  // D[_1212_] = S[__1212_];
176  // //5th row
177  // D[_2323_] = S[__2323_];
178  // //6th row
179  // D[_1313_] = S[__1313_];
180  //}
181  //else if ( pos == PPF_EXT_POINT ) {
182  double auxS[36];//auxiliary array to save Eshelby tensor
183  //Position dependent Eshelby tensor:
184  this->giveSijkl( auxS, J, sort_a, nu, false );
185 
186  for (int i = 0; i < 36; i++)
187  D[i] = auxS[i];
188 
189  // TomTag:
190  // No Mandel notation.
191  // eps_star_ij = D_ijkl * eps_tau_kl
192  // e.g. eps_11 = ... + D_1112 eps_tau_12 + ... + D_1121 eps_tau_21
193  // Therefore thre right half of matrix D is multiplied by two.
194  D[_1112_] *= 2.0;
195  D[_1123_] *= 2.0;
196  D[_1113_] *= 2.0;
198  D[_2212_] *= 2.0;
199  D[_2223_] *= 2.0;
200  D[_2213_] *= 2.0;
202  D[_3312_] *= 2.0;
203  D[_3323_] *= 2.0;
204  D[_3313_] *= 2.0;
206  D[_1212_] *= 2.0;
207  D[_1223_] *= 2.0;
208  D[_1213_] *= 2.0;
210  D[_2312_] *= 2.0;
211  D[_2323_] *= 2.0;
212  D[_2313_] *= 2.0;
214  D[_1312_] *= 2.0;
215  D[_1323_] *= 2.0;
216  D[_1313_] *= 2.0;
217  //}
218  //else _errorr( "giveDijkl: invalid position of a given point");
219 
220  return ;
221 }//end of function: giveDijkl( )
222 
223 
224 //********************************************************************************************************
225 // PROTECTED FUNCTIONS
226 //********************************************************************************************************
227 
228 //********************************************************************************************************
229 // description: Function gives the displacement perturbation tensor of internal fields.
230 // Function requiers "constructor2"
231 // last edit: 15 07. 2010
232 //-------------------------------------------------------------------------------------------------------
233 // note: @Lint[18] - Perturbation (Eshelby's-like) displacement tensor to be evaluated and saved
234 // @J[13] - Ferers-Dysons' elliptic integrals
235 // @sort_a[3] - sorted semiaxes' dimensions
236 // @x[3] - coordinates of a point
237 //********************************************************************************************************
238 void eshelbySoluUniformFieldFlatEllipsoid::giveLijkINT( double Lint[18], const double J[13], const double sort_a[3],
239  const double x[3] )
240 {
241  _errorr("termit: misto teto fce byla puvodne volana rodicovska, proc?");
242 
243  CleanVector(Lint, 18); // No displacements of external points for flat shape.
244  return ;
245 }//end of function: giveLijkINT( )
246 
247 //********************************************************************************************************
248 // description: Function gives the displacement perturbation tensor of external fields.
249 // Function requiers "constructor2"
250 // last edit: 15. 07. 2010
251 //-------------------------------------------------------------------------------------------------------
252 // note: @Lext[18] - Perturbation (generalized Eshelby's) displacement tensor to be evaluated
253 // and saved
254 // @Lint[18] - Perturbation (Eshelby's-like) displacement tensor
255 // @dJi[9] - first derivatives of Ferers-Dysons' elliptic integrals Ii
256 // @dJij[27] - first derivatives of Ferers-Dysons' elliptic integrals Iij
257 // @sort_a[3] - sorted semiaxes' dimensions
258 // @x[3] - coordinates of a point
259 // @nu - Poisson's ratio of the matrix material
260 //********************************************************************************************************
261 void eshelbySoluUniformFieldFlatEllipsoid::giveLijkEXT( double Lext[18], const double Lint[18], const double dJi[9],
262  const double dJij[27], const double sort_a[3],
263  const double x[3])
264 {
265  //UNREFERENCED_PARAMETER(nu);
266  CleanVector(Lext, 18); // No displacements of external points for flat shape.
267  return;
268 }//end of function: giveLijkEXT( )
269 
270 //********************************************************************************************************
271 // description: Function gives S_ijkl(x) position dependent Eshelby's tensor. (This is not
272 // the strain perturbation tensor! Just its part ). The returned members of the
273 // S_ijkl matrix are in tensorial (theoretical) notation!
274 // Function requiers "constructor2"
275 // last edit: 12. 07. 2010
276 //-------------------------------------------------------------------------------------------------------
277 // note: @S[36] - Eshelby position dependent tensor
278 // @J[13] - Ferers-Dysons' elliptic integrals
279 // @sort_a[3] - sorted semiaxes' dimensions
280 // @nu - Poisson's ratio of the matrix material
281 //********************************************************************************************************
282 void eshelbySoluUniformFieldFlatEllipsoid::giveSijkl( double S[36], const double J[13], const double sort_a[3],
283  double nu, bool newFormulation )
284 {
285  _errorr("termit: misto teto fce byla puvodne volana rodicovska, proc?");
286 
287  double mult = this->multTRN;
288 
289  if (!newFormulation)
290  {
291  // Original formulation of S tensor.
292  // Differs from Mura book Eq.(11.16), but Eshelby tensor is OK when compared to HELP results.
293  //1st row
294  S[_1111_] = mult * ( this->_1Min2nu * J1 + 3. * SQR( sort_a[0] ) * J11 );
295  S[_1122_] = mult * ( this->_2nu * J1 - J2 + SQR( sort_a[0] ) * J21 );
296  S[_1133_] = mult * ( this->_2nu * J1 - J3 + SQR( sort_a[0] ) * J31 );
297  S[_1123_] = S[_1113_] = S[_1112_] = 0.;
298  //2nd row
299  S[_2211_] = mult * ( this->_2nu * J2 - J1 + SQR( sort_a[1] ) * J12 );
300  S[_2222_] = mult * ( this->_1Min2nu * J2 + 3. * SQR( sort_a[1] ) * J22 );
301  S[_2233_] = mult * ( this->_2nu * J2 - J3 + SQR( sort_a[1] ) * J32 );
302  S[_2223_] = S[_2213_] = S[_2212_] = 0.;
303  //3rd row
304  S[_3311_] = mult * ( this->_2nu * J3 - J1 + SQR( sort_a[2] ) * J13 );
305  S[_3322_] = mult * ( this->_2nu * J3 - J2 + SQR( sort_a[2] ) * J23 );
306  S[_3333_] = mult * ( this->_1Min2nu * J3 + 3. * J33 ); // J[13] for flat shape contains I33 * a3^2
307  S[_3323_] = S[_3313_] = S[_3312_] = 0.;
308  //4th row
309  S[_1211_] = S[_1222_] = S[_1233_] = 0.;
310  S[_1212_] = mult * ( this->_1MinNu * J1 - nu * J2 + SQR( sort_a[0] ) * J12 );
311  S[_1223_] = S[_1213_] = 0.;
312  //5th row
313  S[_2311_] = S[_2322_] = S[_2333_] = S[_2312_] = 0.;
314  S[_2323_] = mult * ( this->_1MinNu * J2 - nu * J3 + SQR( sort_a[1] ) * J23 );
315  S[_2313_] = 0.;
316  //6th row
317  S[_1311_] = S[_1322_] = S[_1333_] = S[_1312_] = S[_1323_] = 0.;
318  S[_1313_] = mult * ( this->_1MinNu * J1 - nu * J3 + SQR( sort_a[0] ) * J13 );
319  }
320  else
321  {
322  // New formulation (15.08.2013), corresponds to Eq.(11.16).
323  //1st row
324  S[_1111_] = mult * ( this->_1Min2nu * J1 + 3. * SQR( sort_a[0] ) * J11 );
325  S[_1122_] = mult * ( this->_2nu * J1 - J1 + SQR( sort_a[1] ) * J12 );
326  S[_1133_] = mult * ( this->_2nu * J1 - J1 + SQR( sort_a[2] ) * J13 );
327  S[_1123_] = S[_1113_] = S[_1112_] = 0.;
328  //2nd row
329  S[_2211_] = mult * ( this->_2nu * J2 - J2 + SQR( sort_a[0] ) * J12 );
330  S[_2222_] = mult * ( this->_1Min2nu * J2 + 3. * SQR( sort_a[1] ) * J22 );
331  S[_2233_] = mult * ( this->_2nu * J2 - J2 + SQR( sort_a[2] ) * J23 );
332  S[_2223_] = S[_2213_] = S[_2212_] = 0.;
333  //3rd row
334  S[_3311_] = mult * ( this->_2nu * J3 - J3 + SQR( sort_a[0] ) * J31 );
335  S[_3322_] = mult * ( this->_2nu * J3 - J3 + SQR( sort_a[1] ) * J23 );
336  S[_3333_] = mult * ( this->_1Min2nu * J3 + 3. * J33 ); // J[13] for flat shape contains I33 * a3^2
337  S[_3323_] = S[_3313_] = S[_3312_] = 0.;
338  //4th row
339  S[_1211_] = S[_1222_] = S[_1233_] = 0.;
340  S[_1212_] = mult * ( this->_1Min2nu / 2.0 * (J1 + J2) + ( SQR( sort_a[0] ) + SQR( sort_a[1] ) ) / 2.0 * J12 );
341  S[_1223_] = S[_1213_] = 0.;
342  //5th row
343  S[_2311_] = S[_2322_] = S[_2333_] = S[_2312_] = 0.;
344  S[_2323_] = mult * ( this->_1Min2nu / 2.0 * (J2 + J3) + ( SQR( sort_a[1] ) + SQR( sort_a[2] ) ) / 2.0 * J23 );
345  S[_2313_] = 0.;
346  //6th row
347  S[_1311_] = S[_1322_] = S[_1333_] = S[_1312_] = S[_1323_] = 0.;
348  S[_1313_] = mult * ( this->_1Min2nu / 2.0 * (J1 + J3) + ( SQR( sort_a[0] ) + SQR( sort_a[2] ) ) / 2.0 * J13 );
349  }
350 
351  return ;
352 }//end of function: giveSijkl( )
353 
354 } // end of namespace mumech
355 
356 /*end of file*/
#define __I(component)
#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])
#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
void giveSijkl(double S[36], const double J[13], const double sort_a[3], double nu, bool newFormulation)
#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
#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
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])
#define J13
Definition: types.h:436
Class eshelbySoluEllipticIntegralsFlatEllipsoid.
#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
double eshelbyTensCompUniformField(const double sort_a[3], const double eInt[13], double nu, EshelbyTensComponent flag)
#define _2211_
Definition: types.h:322
#define J1
Definition: types.h:430
#define _1333_
Definition: types.h:352
#define _1312_
Definition: types.h:353
#define _3311_
Definition: types.h:329
#define J21
Definition: types.h:438
#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
void giveLijkINT(double Lint[18], const double J[13], const double sort_a[3], const double x[3])
#define _3333_
Definition: types.h:331
#define _1311_
Definition: types.h:350
#define _1133_
Definition: types.h:317
#define _Int11_
Definition: types.h:406
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