ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_penta6.cpp
Revision: 876
Committed: Fri Mar 24 19:40:04 2017 UTC (8 years, 1 month ago) by francois
File size: 14373 byte(s)
Log Message:
ajouts des elements pentaedriques dans le mg_maillage et dans le fem_maillage (6 et 15 noeuds).
+notion sur les coquilles minces (incomplet)
+operations sur les fem_solution

-->a venir reste sur les coquilles minces + mailleur coquille mince

File Contents

# User Rev Content
1 francois 876 //------------------------------------------------------------
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_triangle3.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_penta6.h"
27     #include "fem_maillage.h"
28     #include "fem_noeud.h"
29     #include "mg_element_maillage.h"
30     #include "ot_tenseur.h"
31     #include "ot_quadrature_gauss.h"
32    
33    
34     FEM_PENTA6::FEM_PENTA6(unsigned long num,class MG_ELEMENT_MAILLAGE* mai,class FEM_NOEUD** tabnoeud):FEM_ELEMENT3(num,mai),FEM_TEMPLATE_ELEMENT<6>(tabnoeud)
35     {
36     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
37     tab[0]->get_lien_element3()->ajouter(this);
38     tab[1]->get_lien_element3()->ajouter(this);
39     tab[2]->get_lien_element3()->ajouter(this);
40     tab[3]->get_lien_element3()->ajouter(this);
41     tab[4]->get_lien_element3()->ajouter(this);
42     tab[5]->get_lien_element3()->ajouter(this);
43     get_fem_noeudpetitid()->get_lien_petit_element3()->ajouter(this);
44     }
45    
46     FEM_PENTA6::FEM_PENTA6(class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT3(mai),FEM_TEMPLATE_ELEMENT<6>(tabnoeud)
47     {
48     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
49     tab[0]->get_lien_element3()->ajouter(this);
50     tab[1]->get_lien_element3()->ajouter(this);
51     tab[2]->get_lien_element3()->ajouter(this);
52     tab[3]->get_lien_element3()->ajouter(this);
53     tab[4]->get_lien_element3()->ajouter(this);
54     tab[5]->get_lien_element3()->ajouter(this);
55     get_fem_noeudpetitid()->get_lien_petit_element3()->ajouter(this);
56     }
57    
58     FEM_PENTA6::FEM_PENTA6(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,class FEM_NOEUD** tabnoeud):FEM_ELEMENT3(num,topo),FEM_TEMPLATE_ELEMENT<6>(tabnoeud)
59     {
60     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
61     tab[0]->get_lien_element3()->ajouter(this);
62     tab[1]->get_lien_element3()->ajouter(this);
63     tab[2]->get_lien_element3()->ajouter(this);
64     tab[3]->get_lien_element3()->ajouter(this);
65     tab[4]->get_lien_element3()->ajouter(this);
66     tab[5]->get_lien_element3()->ajouter(this);
67     get_fem_noeudpetitid()->get_lien_petit_element3()->ajouter(this);
68     }
69    
70     FEM_PENTA6::FEM_PENTA6(class MG_ELEMENT_TOPOLOGIQUE* topo,FEM_NOEUD** tabnoeud):FEM_ELEMENT3(topo),FEM_TEMPLATE_ELEMENT<6>(tabnoeud)
71     {
72     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
73     tab[0]->get_lien_element3()->ajouter(this);
74     tab[1]->get_lien_element3()->ajouter(this);
75     tab[2]->get_lien_element3()->ajouter(this);
76     tab[3]->get_lien_element3()->ajouter(this);
77     tab[4]->get_lien_element3()->ajouter(this);
78     tab[5]->get_lien_element3()->ajouter(this);
79     get_fem_noeudpetitid()->get_lien_petit_element3()->ajouter(this);
80     }
81    
82     FEM_PENTA6::FEM_PENTA6(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,class FEM_NOEUD** tabnoeud):FEM_ELEMENT3(num,topo,mai),FEM_TEMPLATE_ELEMENT<6>(tabnoeud)
83     {
84     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
85     tab[0]->get_lien_element3()->ajouter(this);
86     tab[1]->get_lien_element3()->ajouter(this);
87     tab[2]->get_lien_element3()->ajouter(this);
88     tab[3]->get_lien_element3()->ajouter(this);
89     tab[4]->get_lien_element3()->ajouter(this);
90     tab[5]->get_lien_element3()->ajouter(this);
91     get_fem_noeudpetitid()->get_lien_petit_element3()->ajouter(this);
92     }
93    
94     FEM_PENTA6::FEM_PENTA6(class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT3(topo,mai),FEM_TEMPLATE_ELEMENT<6>(tabnoeud)
95     {
96     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
97     tab[0]->get_lien_element3()->ajouter(this);
98     tab[1]->get_lien_element3()->ajouter(this);
99     tab[2]->get_lien_element3()->ajouter(this);
100     tab[3]->get_lien_element3()->ajouter(this);
101     tab[4]->get_lien_element3()->ajouter(this);
102     tab[5]->get_lien_element3()->ajouter(this);
103     get_fem_noeudpetitid()->get_lien_petit_element3()->ajouter(this);
104     }
105    
106    
107    
108    
109     FEM_PENTA6::FEM_PENTA6(FEM_PENTA6& mdd):FEM_ELEMENT3(mdd),FEM_TEMPLATE_ELEMENT<6>(mdd)
110     {
111     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
112     tab[0]->get_lien_element3()->ajouter(this);
113     tab[1]->get_lien_element3()->ajouter(this);
114     tab[2]->get_lien_element3()->ajouter(this);
115     tab[3]->get_lien_element3()->ajouter(this);
116     tab[4]->get_lien_element3()->ajouter(this);
117     tab[5]->get_lien_element3()->ajouter(this);
118     get_fem_noeudpetitid()->get_lien_petit_element3()->ajouter(this);
119     }
120     FEM_PENTA6::~FEM_PENTA6()
121     {
122     if (liaison_topologique!=NULL)
123     if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_fem_maillage()->supprimer(this);
124     tab[0]->get_lien_element3()->supprimer(this);
125     tab[1]->get_lien_element3()->supprimer(this);
126     tab[2]->get_lien_element3()->supprimer(this);
127     tab[3]->get_lien_element3()->supprimer(this);
128     tab[4]->get_lien_element3()->supprimer(this);
129     tab[5]->get_lien_element3()->supprimer(this);
130     get_fem_noeudpetitid()->get_lien_petit_element3()->supprimer(this);
131     }
132    
133    
134     FEM_ELEMENT_MAILLAGE* FEM_PENTA6::dupliquer(FEM_MAILLAGE *femmai,long decalage)
135     {
136     FEM_NOEUD* tabnoeud[8];
137     tabnoeud[0]=femmai->get_fem_noeudid(tab[0]->get_id()+decalage);
138     tabnoeud[1]=femmai->get_fem_noeudid(tab[1]->get_id()+decalage);
139     tabnoeud[2]=femmai->get_fem_noeudid(tab[2]->get_id()+decalage);
140     tabnoeud[3]=femmai->get_fem_noeudid(tab[3]->get_id()+decalage);
141     tabnoeud[4]=femmai->get_fem_noeudid(tab[4]->get_id()+decalage);
142     tabnoeud[5]=femmai->get_fem_noeudid(tab[5]->get_id()+decalage);
143     FEM_PENTA6* pen=new FEM_PENTA6(get_id()+decalage,maillage,tabnoeud);
144     femmai->ajouter_fem_element3(pen);
145     return pen;
146     }
147    
148     void FEM_PENTA6::get_voisin_noeud(class FEM_NOEUD* no,TPL_LISTE_ENTITE<FEM_NOEUD*> &voisin)
149     {
150     voisin.vide();
151     if (no==tab[0])
152     {
153     voisin.ajouter(tab[1]);
154     voisin.ajouter(tab[2]);
155     voisin.ajouter(tab[3]);
156     }
157     if (no==tab[1])
158     {
159     voisin.ajouter(tab[0]);
160     voisin.ajouter(tab[2]);
161     voisin.ajouter(tab[4]);
162     }
163     if (no==tab[2])
164     {
165     voisin.ajouter(tab[0]);
166     voisin.ajouter(tab[1]);
167     voisin.ajouter(tab[5]);
168     }
169     if (no==tab[3])
170     {
171     voisin.ajouter(tab[0]);
172     voisin.ajouter(tab[4]);
173     voisin.ajouter(tab[5]);
174     }
175     if (no==tab[4])
176     {
177     voisin.ajouter(tab[1]);
178     voisin.ajouter(tab[3]);
179     voisin.ajouter(tab[5]);
180     }
181     if (no==tab[5])
182     {
183     voisin.ajouter(tab[2]);
184     voisin.ajouter(tab[3]);
185     voisin.ajouter(tab[4]);
186     }
187     }
188    
189     bool FEM_PENTA6::valide_parametre_EF(double* uvw)
190     {
191     if (uvw[0]>=-1e-10)
192     if (uvw[1]>=-1e-10)
193     if (uvw[2]>=-1.-1e-10)
194     if (1.-uvw[0]-uvw[1]<=1.+1e-10)
195     if (uvw[2]<=1.+1e-10)
196     return true;
197     return false;
198     }
199    
200     void FEM_PENTA6::reinit_boite_3D(void)
201     {
202     FEM_TEMPLATE_ELEMENT<6>::reinit_boite_3D();
203     }
204    
205     int FEM_PENTA6::get_type_entite(void)
206     {
207     return IDFEM_PENTA6;
208     }
209    
210     int FEM_PENTA6::get_dimension(void)
211     {
212     return 3;
213     }
214    
215    
216    
217     int FEM_PENTA6::get_nb_fem_noeud(void)
218     {
219     return FEM_TEMPLATE_ELEMENT<6>::get_nb_fem_noeud();
220     }
221    
222     FEM_NOEUD* FEM_PENTA6::get_fem_noeud(int num)
223     {
224     return FEM_TEMPLATE_ELEMENT<6>::get_fem_noeud(num);
225     }
226    
227     void FEM_PENTA6::change_noeud(int num,FEM_NOEUD* noeud)
228     {
229     FEM_TEMPLATE_ELEMENT<6>::change_noeud(num,noeud);
230     }
231    
232     BOITE_3D& FEM_PENTA6::get_boite_3D(void)
233     {
234     return FEM_TEMPLATE_ELEMENT<6>::get_boite_3D();
235     }
236    
237    
238     void FEM_PENTA6::enregistrer(std::ostream& o,double version)
239     {
240     if (maillage!=NULL)
241     if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_PENTA6($"<< 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;
242     else o << "%" << get_id() << "=FEM_PENTA6(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;
243     else
244     if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_PENTA6($"<< 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;
245     else o << "%" << get_id() << "=FEM_PENTA6(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;
246    
247     }
248    
249    
250     int FEM_PENTA6::get_nb_pt_gauss(int degre)
251     {
252     return OT_POINTS_GAUSS::get_nb_point_penta(degre);
253     }
254    
255     void FEM_PENTA6::get_pt_gauss(int degre,int num,double &w,double *uvw)
256     {
257     return OT_POINTS_GAUSS::get_pt_gauss_penta(degre,num,w,uvw);
258     }
259    
260     int FEM_PENTA6::get_degre_gauss(int num)
261     {
262     return OT_POINTS_GAUSS::get_degre_gauss_penta(num);
263     }
264    
265     int FEM_PENTA6::get_nb_fonction_interpolation(void)
266     {
267     return 6;
268     }
269    
270     int FEM_PENTA6::get_degremax_fonction_interpolation(void)
271     {
272     return 2;
273     }
274     double FEM_PENTA6::get_fonction_interpolation(int num,double *uv)
275     {
276     double val;
277     switch (num)
278     {
279     case 1:
280     val=0.5*uv[1]*(1.-uv[0]);
281     break;
282     case 2:
283     val=0.5*uv[2]*(1.-uv[0]);
284     break;
285     case 3:
286     val=0.5*(1.-uv[1]-uv[2])*(1.-uv[0]);
287     break;
288     case 4:
289     val=0.5*uv[1]*(uv[0]+1.);
290     break;
291     case 5:
292     val=0.5*uv[2]*(uv[0]+1.);
293     break;
294     case 6:
295     val=0.5*(1.-uv[1]-uv[2])*(uv[0]+1);
296     break;
297     }
298     return val;
299     }
300    
301     double FEM_PENTA6::get_fonction_derive_interpolation(int num,int num_variable,double *uv)
302     {
303     double val;
304     switch (num)
305     {
306     case 1:
307     switch (num_variable)
308     {
309     case 1:
310     val=-0.5*uv[1];
311     break;
312     case 2:
313     val=0.5*(1.-uv[0]);
314     break;
315     case 3:
316     val=0.;
317     break;
318     } break;
319     case 2:
320     switch (num_variable)
321     {
322     case 1:
323     val=-0.5*uv[2];
324     break;
325     case 2:
326     val=0.;
327     break;
328     case 3:
329     val=0.5*(1.-uv[0]);
330     break;
331     } break;
332     case 3:
333     switch (num_variable)
334     {
335     case 1:
336     val=-0.5*(1.-uv[1]-uv[2]);
337     break;
338     case 2:
339     val=-0.5*(1.-uv[0]);
340     break;
341     case 3:
342     val=-0.5*(1.-uv[0]);
343     break;
344     } break;
345     case 4:
346     switch (num_variable)
347     {
348     case 1:
349     val=0.5*uv[1];
350     break;
351     case 2:
352     val=0.5*(uv[0]+1.);
353     break;
354     case 3:
355     val=0.;
356     break;
357     } break;
358     case 5:
359     switch (num_variable)
360     {
361     case 1:
362     val=0.5*uv[2];
363     break;
364     case 2:
365     val=0;
366     break;
367     case 3:
368     val=0.5*(uv[1]+1.);
369     break;
370     } break;
371     case 6:
372     switch (num_variable)
373     {
374     case 1:
375     val=0.5*(1.-uv[1]-uv[2]);
376     break;
377     case 2:
378     val=-0.5*(uv[0]+1.);
379     break;
380     case 3:
381     val=-0.5*(uv[0]+1.);
382     break;
383     } break;
384     }
385     return val;
386     }
387    
388     double FEM_PENTA6::get_jacobien(double* jac,double *uv,int& li,int& col,double unite)
389     {
390     li=3;col=3;
391     OT_TENSEUR Ni(3,6),Xi(6,3);
392     for (int i=0;i<3;i++)
393     for (int j=0;j<6;j++)
394     Ni(i,j)=get_fonction_derive_interpolation(j+1,i+1,uv);
395     for (int i=0;i<6;i++)
396     {
397     double *xyz=tab[i]->get_coord();
398     Xi(i,0)=xyz[0]*unite;
399     Xi(i,1)=xyz[1]*unite;
400     Xi(i,2)=xyz[2]*unite;
401     }
402     OT_TENSEUR jacobi=Ni*Xi;
403     jac[0]=jacobi(0,0).get_x();
404     jac[1]=jacobi(0,1).get_x();
405     jac[2]=jacobi(0,2).get_x();
406     jac[3]=jacobi(1,0).get_x();
407     jac[4]=jacobi(1,1).get_x();
408     jac[5]=jacobi(1,2).get_x();
409     jac[6]=jacobi(2,0).get_x();
410     jac[7]=jacobi(2,1).get_x();
411     jac[8]=jacobi(2,2).get_x();
412     double det=jac[0]*jac[4]*jac[8]+jac[3]*jac[7]*jac[2]+jac[6]*jac[1]*jac[5]-jac[2]*jac[4]*jac[6]-jac[5]*jac[7]*jac[0]-jac[8]*jac[1]*jac[3];
413     return det;
414    
415     }
416    
417     void FEM_PENTA6::get_inverse_jacob(double* j,double *uv,double unite)
418     {
419     double jac[9];
420     int li,col;
421     double detj=get_jacobien(jac,uv,li,col,unite);
422     j[0*3+0] = (jac[1*3+1]*jac[2*3+2]-jac[1*3+2]*jac[2*3+1])/(detj);
423     j[0*3+1] = -(jac[0*3+1]*jac[2*3+2]-jac[0*3+2]*jac[2*3+1])/(detj);
424     j[0*3+2] =-(-jac[0*3+1]*jac[1*3+2]+jac[0*3+2]*jac[1*3+1])/(detj);
425    
426     j[1*3+0] = -(jac[1*3+0]*jac[2*3+2]-jac[1*3+2]*jac[2*3+0])/(detj);
427     j[1*3+1] = (jac[0*3+0]*jac[2*3+2]-jac[0*3+2]*jac[2*3+0])/(detj);
428     j[1*3+2] = -(jac[0*3+0]*jac[1*3+2]-jac[0*3+2]*jac[1*3+0])/(detj);
429    
430     j[2*3+0] =-(-jac[1*3+0]*jac[2*3+1]+jac[1*3+1]*jac[2*3+0])/(detj);
431     j[2*3+1] = -(jac[0*3+0]*jac[2*3+1]-jac[0*3+1]*jac[2*3+0])/(detj);
432     j[2*3+2] = (jac[0*3+0]*jac[1*3+1]-jac[0*3+1]*jac[1*3+0])/(detj);
433    
434     }
435    
436    
437    
438     int FEM_PENTA6::verifie_validite_decoupage_xfem(double *vol)
439     {
440    
441     }