muMECH  1.0
inclusion.h
Go to the documentation of this file.
1 //********************************************************************************************************
2 // code: ### ### ##### #### ## ##
3 // ## ## ######## ## ## ## ## ##
4 // ## ## ## ## ## ### ## ######
5 // ## ## ## ## ## ## ## ## ##
6 // ##### ## ## ##### #### ## ##
7 // ##
8 //
9 // name: inclusion.h
10 // author(s): Ladislav Svoboda
11 // language: C, C++
12 // license: This program is free software; you can redistribute it and/or modify
13 // it under the terms of the GNU Lesser General Public License as published by
14 // the Free Software Foundation; either version 2 of the License, or
15 // (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU Lesser General Public License for more details.
21 //
22 // You should have received a copy of the GNU Lesser General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 //********************************************************************************************************
31 
42 #ifndef MUMECH_INCLUSION_H
43 #define MUMECH_INCLUSION_H
44 
45 #include "types.h"
46 #include "matrix_vector.h"
47 #include "gelib.h"
48 #include "macros.h"
49 #include "tixy2.h"
50 
51 
52 using namespace gelibspace;
53 
54 namespace mumech {
55 
56 class Problem;
57 class Point;
58 
60 class Inclusion
61 {
62  friend class Homogenization;
63 
64  public:
65  //
66  // INPUT DATA
67  //
68  long id;
69  const Problem *P;
70 
72  double E;
73  double nu;
74 
75  double *origin;
76  double *a;
77  double *eAngles;
78 
79 
80  //
81  // *** CHARACTERISTIC VALUES ***
82  //
83  bool rotated;
84  double volume;
85 
86  double *C;
87  double *S;
88  double *SInv;
89 
90  // termitovo: TInv = T^T - pak je urcite zbytecny TInv ukladat do rec file, ztrata mista
91  // TInv se pouziva na jednom miste jako TInv*vector, muze se udelat fce T *^T vector, tim padem se pouzije T a TInv je uplne zbytecne
92  double *T;
93  double *TInv;
94 
95  // Strain and stress reduced vectors are in theoretical notation => trasformation matrices are same.
96  double *Te;
97  double *TeInv;
98 
99  public:
100 
101  //
102  // PRE-COMPUTED DATA, when AF->char = true
103  //
104  // inclusion data structure - inclusion record previously calculated
105 
106  double actionRadius;
108  double ndiff_1;
109  double ndiff_2;
110 
112  int * actingIncls;
113 
114  // termitovo Epsilon_Tau by se casem melo ztotoznit s asi locEigStrain_LC, ale opatrne
115  double **Epsilon_Tau;
116  // approximation
117  // toto je tu pro pocitani nekonstantnich poli v inkluzi, jsou to integracni/approximacni body
118  // nejsou deallokovany
120  double **approx_points;
122  double ***approx_coef;
123 
124  double **globPert_displc;
125  double **globPert_strain;
126  double **globPert_stress;
127 
128  public:
130  Inclusion (long i, const Problem *p);
132  virtual ~Inclusion();
133 
135  bool scan_eAngles_RAD (Stream *stream);
137  bool scan_eAngles_DEG (Stream *stream);
139  virtual bool scan_locEigStrain_LC (Stream *stream, int lc) = 0;
140 
142  virtual void allocate_nlc_fields (void);
143 
145  virtual InclusionGeometry giveInclusionGeometry (InclusionGeometry shp_o) const = 0;
147  virtual void input_data_initialize_and_check_consistency (void);
149  virtual void initialize (const Inclusion *prevInclRec) = 0;
151  virtual void SBA_computeInitialStrains (int lc) = 0;
153  virtual bool point_is_affected (const double *point) const = 0;
154 
160  bool point_is_inside (const double *coords, double epsilon = 0.0) const;
161 
163  void transformCoords_G2L (const double *glob, double *loc) const;
165  void transformCoords_L2G (const double *loc, double *glob) const;
166 
168  void rotateStrain_G2L (const double *glob, double *loc) const;
170  void rotateStrain_L2G (const double *loc, double *glob) const;
172  void rotateDisplc_L2G (const double *loc, double *glob) const;
173 
175  void ActingIncls_allocate (void);
176 
178  int find_overlap (const Inclusion *incl) const;
180  bool is_inside_of_BB (const double *bb1, const double *bb2) const;
181 
182  // DIRECT API
183  void set_centroids (double x, double y);
184  void set_centroids (double x, double y, double z);
185  void set_Inclusion_shape (InclusionGeometry val) { shape = val; }
186  void set_Youngs_modulus (double val) { E = val; }
187  void set_Poissons_ratio (double val) { nu = val; }
188  void set_Semiaxes_dimensions (double x, double y);
189  void set_Semiaxes_dimensions (double x, double y, double z);
190  void set_Euller_angles_deg (double x);
191  void set_Euller_angles_deg (double x, double y, double z);
192  //void set_Remote_strains_for_lc (int lc, const double *r1);
193 
194  // agregates
195  void set_all_2d (double x, double y, double e, double n,
196  double a1, double a2, double e1);
197  void set_all_3d (double x, double y, double z, double e, double n,
198  double a1, double a2, double a3,
199  double e1, double e2, double e3 );
200 
201 
202 
203  double give_volume( void );
204 
205  //double** pointer_globPertStrain(void) { return this->globPert_strain; };
206  //double** pointer_globPertStress(void) { return this->globPert_stress; };
207  //double** pointer_globPertDisplc(void) { return this->globPert_displc; };
208 
209  void update_approximations(int lc);
210 
211  void Eps02EpsTau(double *e_tau, const double *e_0);
212 
213  protected:
214  void EAdeg2rad (void);
215 
223  void giveTransformationStrainOperator (double oper[12], const double C[12], const double C1[12], const double S[12]);
225  void give_EshelbyMatrixFull (double** answer) const;
227  void give_EshelbyMatrixReduced (double* answer) const;
228  public:
230  void give_StiffnessMatrixFull (double* answer) const;
232  void give_StiffnessMatrixReduced (double* answer) const;
233  protected:
235  void give_TeMatrix_G2L (double* answer) const;
237  void give_TeMatrix_L2G (double* answer) const;
238 
239  public:
240  const double** give_EshelbyPertDisplc_internal ( int lc, int nlc, const double *coords);
241  //void give_EshelbyPertDisplc_internal (double **displc, int lc, int nlc, const double *coords);
242  const double** give_EshelbyPertStrain_internal ( int lc, int nlc);
243  //void give_EshelbyPertStrain_internal (double **strain, int lc, int nlc);
244  const double** give_EshelbyPertStress_internal ( int lc, int nlc);
245  //void give_EshelbyPertStress_internal (double **stress, int lc, int nlc);
246 
247  //void add_EshelbyPertDisplc_internal_SIFCM(double **displc, int lc, int nlc, const double *coords, double **e_t_SIFCM);
248  void add_EshelbyPertStrain_internal_SIFCM(double **strain, int lc, int nlc, double **e_t_SIFCM);
249  void add_EshelbyPertStress_internal_SIFCM(double **stress, int lc, int nlc, double **e_t_SIFCM, double **e_s_ext_add);
250 
261  void give_EshelbyPertFields_external (Point *point, int lc, int nlc, bool disp, bool strn);
262 
263  double compute_supplement_energy (int lc);
264 
265 private:
266  virtual void computeVolume() = 0;
267 
268 
269 };//end of class declaration
270 
271 // ***********************************************************************************************************
272 // *** 3D INCLUSION RECORD ***
273 // ***********************************************************************************************************
276 
279 {
280  public:
281  //
282  // *** CLASSES ***
283  //
286 
287  //
288  // *** CHARACTERISTIC MATRICES ***
289  //
290  double eInt[13];
291 
292  //
293  // PRE-COMPUTED DATA - previously calculated inclusion record, when P->data_equivalent == true
294  //
295  double locEigStrain[6];
296  double locEigStrainTot[6];
297  double globEigStrainTotal[6];
298 
299  double **locEigStrain_LC;
300  double **globEigStrain_LC;
301 
302  public:
304  InclusionRecord3D (long i, const Problem *p);
306  virtual ~InclusionRecord3D();
307 
309  bool scan_locEigStrain_LC (Stream *stream, int lc);
311  bool scan_globEigStrain_LC (Stream *stream, int lc);
312 
314  void allocate_nlc_fields (void);
315 
317  InclusionGeometry giveInclusionGeometry (InclusionGeometry shp_o) const;
319  void input_data_initialize_and_check_consistency (void);
321  void initialize (const Inclusion *prevInclRec);
323  void SBA_computeInitialStrains (int lc);
325  bool point_is_affected (const double *point) const;
326 
328  void SBA_updateGlobAndLocStrains (Point *point);
329 
331  void addtot ();
332 
333  // *** PRINT ***
335  //void init_locEigStrain_Singl (NotationType notationFlag);
337  //void init_locEigStrain_Multi (NotationType notationFlag);
338 
340  void init_EigStrain_LC (int lc);
341 
342 
343  private:
344  virtual void computeVolume();
345 
346 };
347 
348 
349 
350 // ***********************************************************************************************************
351 // **************** 2D ONLY - START **********************************************************************
352 // ***********************************************************************************************************
354 public:
355  double x[2];
356  double a[2];
357  double lambda;
358  double I1;
359  double I2;
360  double I11;
361  double I12;
362  double I22;
363 
364  double I(int index){
365  if(index==1)return I1;
366  if(index==2)return I2;
367  if(index==11)return I11;
368  if(index==22)return I22;
369  if(index==12 || index==21)return I12;
370  return 0;
371  }
372  void spocitat(){
373  if (a[0] == a[1]){
374  lambda = x[0] * x[0] + x[1] * x[1] - a[0] * a[0];
375  I1 = I2 = 2.*PI*a[0] * a[0] / (a[0] * a[0] + lambda);
376  I11 = I22 = I12 = PI*a[0] * a[0] / (a[0] * a[0] * a[0] * a[0] + 2.*a[0] * a[0] * lambda + lambda*lambda);
377  }
378  else{
379  double b = a[0] * a[0] + a[1] * a[1] - x[0] * x[0] - x[1] * x[1];
380  double c = a[0] * a[0] * a[1] * a[1] - x[0] * x[0] * a[1] * a[1] - a[0] * a[0] * x[1] * x[1];
381  double Di = b*b - 4 * c;
382  lambda = 0.5*(-b + sqrt(Di));
383  I1 = 4.*PI*a[0] * a[1] / (a[1] * a[1] - a[0] * a[0])*(pow(a[1] * a[1] + lambda, 0.5) / pow(a[0] * a[0] + lambda, 0.5) - 1.);
384  I2 = 4.*PI*a[0] * a[1] / (a[0] * a[0] - a[1] * a[1])*(pow(a[0] * a[0] + lambda, 0.5) / pow(a[1] * a[1] + lambda, 0.5) - 1.);
385  I12 = 1.*(I2 - I1) / (a[0] * a[0] - a[1] * a[1]);
386  I11 = 1. / 3. * ((I1 + I2) / (a[0] * a[0] + lambda) - I12);
387  I22 = 1. / 3. * ((I1 + I2) / (a[1] * a[1] + lambda) - I12);
388  }
389  }
390 };
391 
392 
393 
394 
397 {
398  public:
399  // spocitano - vybalancovano
402 
403  // body
404  double x[2];
405  double x_last_derivation[2];
406  double x_last_IS[2];
407  double lambda;
408  double I1;
409  double I2;
410  double I11;
411  double I12;
412  double I22;
413 
417 
418  vektor e_t; // epsilon tau
419 
420 
421  bod_pomocny P_a[2]; // auxiliary points for the first derivatives
422  bod_pomocny P_b[8]; // auxiliary points for the second derivatives
423 
425  double h,H; // dx pri derivaci
429 
430  public:
432  InclusionRecord2D (long i, const Problem *p);
434  virtual ~InclusionRecord2D();
435 
437  bool scan_locEigStrain_LC (Stream *stream, int lc);
438 
440  void allocate_nlc_fields (void);
441 
443  InclusionGeometry giveInclusionGeometry (InclusionGeometry shp_o) const;
445  void input_data_initialize_and_check_consistency (void);
447  void initialize (const Inclusion *prevInclRec);
449  void SBA_computeInitialStrains (int lc);
451  bool point_is_affected (const double *point) const;
452 
453 
455  double S_give(int index);
457  double I(int index);
459  double derivative_step(double delitel);
461  void derivative_preparation();
463  double dI(int index,int smer1,int smer2);
465  void compute_I_S();
467  void compute_S_int();
469  double r(int i,int j);
471  double compute_D(int i,int j,int k,int l);
473  void compute_matrix_D();
475  void compute_eps_tau_back(vektor &e_s_, vektor &e_t_);
477  void compute_strain_pert_from_eps_zero_int(const double *point, double *es, double *ez);
479  void compute_strain_pert_from_eps_zero_ext(const double *point, double *es, double *ez);
481  void compute_from_eps_tau(const double *point, vektor &es, vektor &et);
483  void giveExtStrainPert (const double *point, double **strain, int lc, int nlc);
485  void compute_initial_eps_tau(int strainID);
486 
488  void compute_eps_tau(int strainID, double *e_tau, double *e_z_add,bool add);
490  void update_eps_tau(int strainID, const double *e_z_add);
491 
493  void getDisplacement(const double *point, double **displacement, int lc, int nlc, int _pointInside);
494 
495  private:
496  virtual void computeVolume();
497 
498 };
499 
500 
501 // ***********************************************************************************************************
502 // **************** 2D ONLY - END **********************************************************************
503 // ***********************************************************************************************************
504 
505 } // end of namespace mumech
506 
507 #endif // end of MUMECH_INCLUSION_H
508 
509 /*end of file*/
double * origin
coordinates of the inclusions' centorids
Definition: inclusion.h:75
file of various types and symbolic constant definitions
double * T
GLOBAL->LOCAL displacement vector transfrmation matrix; 3x3 or 2x2 for 3d or 2d.
Definition: inclusion.h:92
Class InclusionRecord contains and handles all inclusion data.
Definition: inclusion.h:60
Problem description.
Definition: problem.h:154
Class vector and matrix.
General functions.
const Problem * P
problem description
Definition: inclusion.h:69
eshelbySoluUniformField * esuf
Definition: inclusion.h:285
#define PI
Definition: macros.h:71
Class of function for homogenization of stress fields.
double actionRadius
Action radius of the inclusion.
Definition: inclusion.h:106
void set_Inclusion_shape(InclusionGeometry val)
Definition: inclusion.h:185
double * SInv
Inverse of Eshelby tensor.
Definition: inclusion.h:88
double * C
Isotropic elastic stiffness tensor of an inclusion stored in reduced form (from the total 9/36 matrix...
Definition: inclusion.h:86
The header file of usefull macros.
3D inclusion record.
Definition: inclusion.h:278
double * eAngles
Euller angles.
Definition: inclusion.h:77
double * Te
GLOBAL->LOCAL strain/stress tensor transfrmation matrix; full matrix 6x6 or 3x3 for 3d or 2d...
Definition: inclusion.h:96
double ** globPert_displc
u star - Global perturbation displacement. Toto muze byt alokovany v problemu a odtud jen ukazovatko...
Definition: inclusion.h:124
double ** locEigStrain_LC
predchazejici arrays slouzi vsude v balancingu pro vypocet v danem lc, tyto pole schovavaji vysledky ...
Definition: inclusion.h:299
Single Point data structure - contribution from Single inclusion.
Definition: matrix.h:133
double ** approx_points_eps_tau
Definition: inclusion.h:121
double * TInv
LOCAL->GLOBAL displacement vector transfrmation matrix; TInv = T^-1 (inversion) = T^T (transposed) ...
Definition: inclusion.h:93
eshelbySoluEllipticIntegrals * ellInt
Definition: inclusion.h:284
double ndiff_1
derivative step for the first derivations
Definition: inclusion.h:108
TinyXML functions.
double ** approx_points
Definition: inclusion.h:120
double ** globPert_stress
sigma star - Global perturbation stress.
Definition: inclusion.h:126
bool any_derivative_preparation_computed
Definition: inclusion.h:426
Class of the functions returning the Eshelby solution of an inclusion of an ellipsoidal shape loaded ...
Definition: esuf.h:46
double nu
Poisson's ratio.
Definition: inclusion.h:73
double * a
Inclusion semiaxes' dimensions in global arrangement.
Definition: inclusion.h:76
double ** Epsilon_Tau
field of epsilon tau, set by SBalgorithm for every load
Definition: inclusion.h:115
Class of the functions calculating the values of elliptic integrals and its derivatives.
Definition: esei.h:42
InclusionGeometry
Inclusion shapes' type.
Definition: types.h:161
static double epsilon
Definition: meso2d.cpp:172
long id
identification number
Definition: inclusion.h:68
double ** globPert_strain
epsilon star - Global perturbation strain.
Definition: inclusion.h:125
InclusionGeometry shape
inclusion shape
Definition: inclusion.h:71
int noActingIncls
Number of acting inclusions.
Definition: inclusion.h:111
double E
Young's modulus.
Definition: inclusion.h:72
double *** approx_coef
Definition: inclusion.h:122
double * S
Eshelby tensor.
Definition: inclusion.h:87
void set_Youngs_modulus(double val)
Definition: inclusion.h:186
double * TeInv
LOCAL->GLOBAL strain/stress tensor transfrmation matrix; full matrix 6x6 or 3x3 for 3d or 2d...
Definition: inclusion.h:97
int * actingIncls
Set of inclusions which act to the "this" one.
Definition: inclusion.h:112
void set_Poissons_ratio(double val)
Definition: inclusion.h:187
double ndiff_2
derivative step for the second derivations
Definition: inclusion.h:109
double SQRactionRadius
Action radius of the inclusion ^2.
Definition: inclusion.h:107
double I(int index)
Definition: inclusion.h:364
void e(int i)