ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_triangle6.cpp
Revision: 757
Committed: Fri Nov 6 13:42:55 2015 UTC (9 years, 6 months ago) by francois
File size: 14920 byte(s)
Log Message:
Possibilite de calculer les comtraintes et les deformations aux points de gauss
Tester en elasticite volumique

File Contents

# User Rev Content
1 francois 283 //------------------------------------------------------------
2     //------------------------------------------------------------
3     // MAGiC
4     // Jean Christophe Cuilli�re et Vincent FRANCOIS
5     // D�partement de G�nie M�canique - UQTR
6     //------------------------------------------------------------
7     // Le projet MAGIC est un projet de recherche du d�partement
8     // de g�nie m�canique de l'Universit� du Qu�bec �
9     // Trois Rivi�res
10     // Les librairies ne peuvent �tre utilis�es sans l'accord
11     // des auteurs (contact : francois@uqtr.ca)
12     //------------------------------------------------------------
13     //------------------------------------------------------------
14     //
15     // fem_triangle6.cpp
16     //
17     //------------------------------------------------------------
18     //------------------------------------------------------------
19     // COPYRIGHT 2000
20     // Version du 02/03/2006 � 11H22
21     //------------------------------------------------------------
22     //------------------------------------------------------------
23    
24    
25     #include "gestionversion.h"
26     #include "fem_triangle6.h"
27     #include "fem_noeud.h"
28     #include "mg_element_maillage.h"
29     #include "fem_maillage.h"
30 francois 612 #include "math.h"
31     #include "ot_quadrature_gauss.h"
32 francois 283
33 francois 309 FEM_TRIANGLE6::FEM_TRIANGLE6(unsigned long num,class MG_ELEMENT_MAILLAGE* mai,class FEM_NOEUD** tabnoeud):FEM_ELEMENT2(num,mai),FEM_TEMPLATE_ELEMENT<6>(tabnoeud)
34 francois 283 {
35     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
36 francois 309 tab[0]->get_lien_element2()->ajouter(this);
37     tab[1]->get_lien_element2()->ajouter(this);
38     tab[2]->get_lien_element2()->ajouter(this);
39     tab[3]->get_lien_element2()->ajouter(this);
40     tab[4]->get_lien_element2()->ajouter(this);
41     tab[5]->get_lien_element2()->ajouter(this);
42     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
43 francois 283 }
44    
45 francois 309 FEM_TRIANGLE6::FEM_TRIANGLE6(class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT2(mai),FEM_TEMPLATE_ELEMENT<6>(tabnoeud)
46 francois 283 {
47     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
48 francois 309 tab[0]->get_lien_element2()->ajouter(this);
49     tab[1]->get_lien_element2()->ajouter(this);
50     tab[2]->get_lien_element2()->ajouter(this);
51     tab[3]->get_lien_element2()->ajouter(this);
52     tab[4]->get_lien_element2()->ajouter(this);
53     tab[5]->get_lien_element2()->ajouter(this);
54     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
55 francois 283 }
56    
57 francois 378 FEM_TRIANGLE6::FEM_TRIANGLE6(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,class FEM_NOEUD** tabnoeud):FEM_ELEMENT2(num,topo),FEM_TEMPLATE_ELEMENT<6>(tabnoeud)
58     {
59     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
60     tab[0]->get_lien_element2()->ajouter(this);
61     tab[1]->get_lien_element2()->ajouter(this);
62     tab[2]->get_lien_element2()->ajouter(this);
63     tab[3]->get_lien_element2()->ajouter(this);
64     tab[4]->get_lien_element2()->ajouter(this);
65     tab[5]->get_lien_element2()->ajouter(this);
66     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
67     }
68    
69     FEM_TRIANGLE6::FEM_TRIANGLE6(class MG_ELEMENT_TOPOLOGIQUE* topo,FEM_NOEUD** tabnoeud):FEM_ELEMENT2(topo),FEM_TEMPLATE_ELEMENT<6>(tabnoeud)
70     {
71     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
72     tab[0]->get_lien_element2()->ajouter(this);
73     tab[1]->get_lien_element2()->ajouter(this);
74     tab[2]->get_lien_element2()->ajouter(this);
75     tab[3]->get_lien_element2()->ajouter(this);
76     tab[4]->get_lien_element2()->ajouter(this);
77     tab[5]->get_lien_element2()->ajouter(this);
78     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
79     }
80     FEM_TRIANGLE6::FEM_TRIANGLE6(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,class FEM_NOEUD** tabnoeud):FEM_ELEMENT2(num,topo,mai),FEM_TEMPLATE_ELEMENT<6>(tabnoeud)
81     {
82     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
83     tab[0]->get_lien_element2()->ajouter(this);
84     tab[1]->get_lien_element2()->ajouter(this);
85     tab[2]->get_lien_element2()->ajouter(this);
86     tab[3]->get_lien_element2()->ajouter(this);
87     tab[4]->get_lien_element2()->ajouter(this);
88     tab[5]->get_lien_element2()->ajouter(this);
89     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
90     }
91    
92     FEM_TRIANGLE6::FEM_TRIANGLE6(class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT2(topo,mai),FEM_TEMPLATE_ELEMENT<6>(tabnoeud)
93     {
94     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
95     tab[0]->get_lien_element2()->ajouter(this);
96     tab[1]->get_lien_element2()->ajouter(this);
97     tab[2]->get_lien_element2()->ajouter(this);
98     tab[3]->get_lien_element2()->ajouter(this);
99     tab[4]->get_lien_element2()->ajouter(this);
100     tab[5]->get_lien_element2()->ajouter(this);
101     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
102     }
103    
104    
105    
106 francois 684 void FEM_TRIANGLE6::reinit_boite_3D(void)
107     {
108     FEM_TEMPLATE_ELEMENT<6>::reinit_boite_3D();
109     }
110 francois 378
111    
112    
113    
114 francois 309 FEM_TRIANGLE6::FEM_TRIANGLE6(FEM_TRIANGLE6& mdd):FEM_ELEMENT2(mdd),FEM_TEMPLATE_ELEMENT<6>(mdd)
115 francois 283 {
116     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
117 francois 309 tab[0]->get_lien_element2()->ajouter(this);
118     tab[1]->get_lien_element2()->ajouter(this);
119     tab[2]->get_lien_element2()->ajouter(this);
120     tab[3]->get_lien_element2()->ajouter(this);
121     tab[4]->get_lien_element2()->ajouter(this);
122     tab[5]->get_lien_element2()->ajouter(this);
123     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
124 francois 283 }
125     FEM_TRIANGLE6::~FEM_TRIANGLE6()
126     {
127 francois 663 if (liaison_topologique!=NULL)
128     if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->supprimer(this);
129 francois 309 tab[0]->get_lien_element2()->supprimer(this);
130     tab[1]->get_lien_element2()->supprimer(this);
131     tab[2]->get_lien_element2()->supprimer(this);
132     tab[3]->get_lien_element2()->supprimer(this);
133     tab[4]->get_lien_element2()->supprimer(this);
134     tab[5]->get_lien_element2()->supprimer(this);
135     get_fem_noeudpetitid()->get_lien_petit_element2()->supprimer(this);
136 francois 283 }
137    
138     FEM_ELEMENT_MAILLAGE* FEM_TRIANGLE6::dupliquer(FEM_MAILLAGE *femmai,long decalage)
139     {
140     FEM_NOEUD* tabnoeud[6];
141     tabnoeud[0]=femmai->get_fem_noeudid(tab[0]->get_id()+decalage);
142     tabnoeud[1]=femmai->get_fem_noeudid(tab[1]->get_id()+decalage);
143     tabnoeud[2]=femmai->get_fem_noeudid(tab[2]->get_id()+decalage);
144     tabnoeud[3]=femmai->get_fem_noeudid(tab[3]->get_id()+decalage);
145     tabnoeud[4]=femmai->get_fem_noeudid(tab[4]->get_id()+decalage);
146     tabnoeud[5]=femmai->get_fem_noeudid(tab[5]->get_id()+decalage);
147     FEM_TRIANGLE6* tri=new FEM_TRIANGLE6(get_id()+decalage,maillage,tabnoeud);
148 francois 309 femmai->ajouter_fem_element2(tri);
149 francois 283 return tri;
150     }
151    
152 francois 635 bool FEM_TRIANGLE6::valide_parametre_EF(double* uvw)
153     {
154     if (uvw[0]>=-1e-10)
155     if (uvw[1]>=-1e-10)
156     if (uvw[0]+uvw[1]<=1.+1e-10)
157     return true;
158     return false;
159     }
160 francois 283
161    
162     int FEM_TRIANGLE6::get_type_entite(void)
163     {
164     return IDFEM_TRIANGLE6;
165     }
166    
167     int FEM_TRIANGLE6::get_dimension(void)
168     {
169     return 2;
170     }
171    
172    
173     int FEM_TRIANGLE6::get_nb_fem_noeud(void)
174     {
175     return FEM_TEMPLATE_ELEMENT<6>::get_nb_fem_noeud();
176     }
177    
178     FEM_NOEUD* FEM_TRIANGLE6::get_fem_noeud(int num)
179     {
180     return FEM_TEMPLATE_ELEMENT<6>::get_fem_noeud(num);
181     }
182    
183     void FEM_TRIANGLE6::change_noeud(int num,FEM_NOEUD* noeud)
184     {
185     FEM_TEMPLATE_ELEMENT<6>::change_noeud(num,noeud);
186     }
187    
188     BOITE_3D& FEM_TRIANGLE6::get_boite_3D(void)
189     {
190     return FEM_TEMPLATE_ELEMENT<6>::get_boite_3D();
191     }
192    
193    
194     void FEM_TRIANGLE6::enregistrer(std::ostream& o)
195     {
196 francois 378 if (maillage!=NULL)
197     if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_TRIANGLE6($"<< get_lien_topologie()->get_id() << ",$" << maillage->get_id() << ",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id() << ",$" << tab[3]->get_id() << ",$" << tab[4]->get_id() << ",$" << tab[5]->get_id() << ");" << std::endl;
198     else o << "%" << get_id() << "=FEM_TRIANGLE6(NULL,$" << maillage->get_id() << ",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id() << ",$" << tab[3]->get_id() << ",$" << tab[4]->get_id() << ",$" << tab[5]->get_id() << ");" << std::endl;
199     else
200     if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_TRIANGLE6($"<< get_lien_topologie()->get_id() << ",NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id() << ",$" << tab[3]->get_id() << ",$" << tab[4]->get_id() << ",$" << tab[5]->get_id() << ");" << std::endl;
201     else o << "%" << get_id() << "=FEM_TRIANGLE6(NULL,NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id() << ",$" << tab[3]->get_id() << ",$" << tab[4]->get_id() << ",$" << tab[5]->get_id() << ");" << std::endl;
202    
203 francois 283 }
204 francois 310
205 francois 637 int FEM_TRIANGLE6::get_nb_pt_gauss(int degre)
206     {
207 francois 754 return OT_POINTS_GAUSS::get_nb_point_tri(degre);
208 francois 637 }
209 francois 310
210 francois 637 void FEM_TRIANGLE6::get_pt_gauss(int degre,int num,double &w,double *uv)
211     {
212 francois 754 return OT_POINTS_GAUSS::get_pt_gauss_tri(degre,num,w,uv);
213 francois 637 }
214    
215 francois 757 int FEM_TRIANGLE6::get_degre_gauss(int num)
216     {
217     return OT_POINTS_GAUSS::get_degre_gauss_tri(num);
218     }
219    
220 francois 638 int FEM_TRIANGLE6::get_nb_fonction_interpolation(void)
221 francois 310 {
222     return 6;
223     }
224 francois 638 int FEM_TRIANGLE6::get_degremax_fonction_interpolation(void)
225     {
226     return 2;
227     }
228 francois 310 double FEM_TRIANGLE6::get_fonction_interpolation(int num,double *uv)
229     {
230     double val;
231     switch (num)
232     {
233     case 1:
234     val=(-1+uv[0]+uv[1])*(-1+2*uv[0]+2*uv[1]);
235     break;
236     case 2:
237     val=4.*uv[0]*(1-uv[0]-uv[1]);
238     break;
239     case 3:
240     val=-uv[0]*(1.-2.*uv[0]);
241     break;
242     case 4:
243     val=4.*uv[0]*uv[1];
244     break;
245     case 5:
246     val=-uv[1]*(1-2*uv[1]);
247     break;
248     case 6:
249     val=4.*uv[1]*(1-uv[0]-uv[1]);
250     break;
251    
252     }
253     return val;
254     }
255    
256     double FEM_TRIANGLE6::get_fonction_derive_interpolation(int num,int num_variable,double *uv)
257     {
258     double val;
259    
260     switch (num)
261     {
262     case 1:
263     switch (num_variable)
264     {
265     case 1:
266 francois 612 val=-3.+4*uv[0]+4*uv[1];
267 francois 310 break;
268     case 2:
269     val=-3.+4*uv[0]+4*uv[1];
270     break;
271     } break;
272     case 2:
273     switch (num_variable)
274     {
275     case 1:
276     val=4.-8*uv[0]-4*uv[1];
277     break;
278     case 2:
279     val=-4.*uv[0];
280     break;
281     }break;
282     case 3:
283     switch (num_variable)
284     {
285     case 1:
286 francois 612 val=-1.+4*uv[0];
287 francois 310 break;
288     case 2:
289     val=0.;
290     break;
291     }break;
292     case 4:
293     switch (num_variable)
294     {
295     case 1:
296     val=4*uv[1];
297     break;
298     case 2:
299     val=4*uv[0];
300     break;
301     }break;
302     case 5:
303     switch (num_variable)
304     {
305     case 1:
306     val=0.;
307     break;
308     case 2:
309     val=-1+4.*uv[1];
310     break;
311     }break;
312     case 6:
313     switch (num_variable)
314     {
315     case 1:
316     val=-4*uv[1];
317     break;
318     case 2:
319     val=4-4*uv[0]-8*uv[1];
320     break;
321     }break;
322    
323     }
324     return val;
325     }
326    
327 francois 612
328 francois 310 double FEM_TRIANGLE6::get_jacobien(double* jac,double *uv,int& li,int& col,double unite)
329     {
330 francois 612 FEM_NOEUD* n1=get_fem_noeud(0);
331     FEM_NOEUD* n2=get_fem_noeud(1);
332     FEM_NOEUD* n3=get_fem_noeud(2);
333     FEM_NOEUD* n4=get_fem_noeud(3);
334     FEM_NOEUD* n5=get_fem_noeud(4);
335     FEM_NOEUD* n6=get_fem_noeud(5);
336    
337     double xyzn1[3],xyzn2[3],xyzn3[3],xyzn4[3],xyzn5[3],xyzn6[3];
338    
339     xyzn1[0]=n1->get_x();
340     xyzn1[1]=n1->get_y();
341     xyzn1[2]=n1->get_z();
342    
343     xyzn2[0]=n2->get_x();
344     xyzn2[1]=n2->get_y();
345     xyzn2[2]=n2->get_z();
346    
347     xyzn3[0]=n3->get_x();
348     xyzn3[1]=n3->get_y();
349     xyzn3[2]=n3->get_z();
350    
351     xyzn4[0]=n4->get_x();
352     xyzn4[1]=n4->get_y();
353     xyzn4[2]=n4->get_z();
354    
355     xyzn5[0]=n5->get_x();
356     xyzn5[1]=n5->get_y();
357     xyzn5[2]=n5->get_z();
358    
359     xyzn6[0]=n6->get_x();
360     xyzn6[1]=n6->get_y();
361     xyzn6[2]=n6->get_z();
362    
363     OT_VECTEUR_3D vec1(xyzn1,xyzn3);
364     OT_VECTEUR_3D vec3(xyzn1,xyzn5);
365     OT_VECTEUR_3D n=vec1&vec3;
366     n.norme();
367 francois 310
368 francois 612 jac[0]=get_fonction_derive_interpolation(1,1,uv)*xyzn1[0]+get_fonction_derive_interpolation(2,1,uv)*xyzn2[0]+get_fonction_derive_interpolation(3,1,uv)*xyzn3[0]+get_fonction_derive_interpolation(4,1,uv)*xyzn4[0]+get_fonction_derive_interpolation(6,1,uv)*xyzn6[0];
369     jac[1]=get_fonction_derive_interpolation(1,1,uv)*xyzn1[1]+get_fonction_derive_interpolation(2,1,uv)*xyzn2[1]+get_fonction_derive_interpolation(3,1,uv)*xyzn3[1]+get_fonction_derive_interpolation(4,1,uv)*xyzn4[1]+get_fonction_derive_interpolation(6,1,uv)*xyzn6[1];
370     jac[2]=get_fonction_derive_interpolation(1,1,uv)*xyzn1[2]+get_fonction_derive_interpolation(2,1,uv)*xyzn2[2]+get_fonction_derive_interpolation(3,1,uv)*xyzn3[2]+get_fonction_derive_interpolation(4,1,uv)*xyzn4[2]+get_fonction_derive_interpolation(6,1,uv)*xyzn6[2];
371    
372     jac[3]=get_fonction_derive_interpolation(1,2,uv)*xyzn1[0]+get_fonction_derive_interpolation(2,2,uv)*xyzn2[0]+get_fonction_derive_interpolation(4,2,uv)*xyzn4[0]+get_fonction_derive_interpolation(5,2,uv)*xyzn5[0]+get_fonction_derive_interpolation(6,2,uv)*xyzn6[0];
373     jac[4]=get_fonction_derive_interpolation(1,2,uv)*xyzn1[1]+get_fonction_derive_interpolation(2,2,uv)*xyzn2[1]+get_fonction_derive_interpolation(4,2,uv)*xyzn4[1]+get_fonction_derive_interpolation(5,2,uv)*xyzn5[1]+get_fonction_derive_interpolation(6,2,uv)*xyzn6[1];
374     jac[5]=get_fonction_derive_interpolation(1,2,uv)*xyzn1[2]+get_fonction_derive_interpolation(2,2,uv)*xyzn2[2]+get_fonction_derive_interpolation(4,2,uv)*xyzn4[2]+get_fonction_derive_interpolation(5,2,uv)*xyzn5[2]+get_fonction_derive_interpolation(6,2,uv)*xyzn6[2];
375    
376     jac[6]=n[0];
377     jac[7]=n[1];
378     jac[8]=n[2];
379    
380     double DET= jac[0]*(jac[4]*jac[8]-jac[7]*jac[5])+jac[1]*(jac[5]*jac[6]-jac[8]*jac[3])+jac[2]*(jac[3]*jac[7]-jac[6]*jac[4]);
381    
382     return DET;
383    
384 francois 310 }
385    
386     void FEM_TRIANGLE6::get_inverse_jacob(double* j,double *uv,double unite)
387     {
388 francois 612 double jac[9];
389     int lig,col;
390     double detj=this->get_jacobien(jac,uv,lig,col,unite);
391    
392     j[0] = (jac[4]*jac[8]-jac[5]*jac[7])/(detj);
393     j[1] = -(jac[1]*jac[8]-jac[2]*jac[7])/(detj);
394     j[2] =-(-jac[1]*jac[5]+jac[2]*jac[4])/(detj);
395    
396     j[3] = -(jac[1]*jac[8]-jac[5]*jac[6])/(detj);
397     j[4] = (jac[0]*jac[8]-jac[2]*jac[6])/(detj);
398     j[5] = -(jac[0]*jac[5]-jac[2]*jac[3])/(detj);
399    
400     j[6] =-(-jac[3]*jac[7]+jac[4]*jac[6])/(detj);
401     j[7] = -(jac[0]*jac[7]-jac[1]*jac[6])/(detj);
402     j[8] = (jac[0]*jac[4]-jac[1]*jac[4])/(detj);
403    
404     }
405