TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Operator_FT_Disc.cpp
1/****************************************************************************
2* Copyright (c) 2024, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16
17#include <Operator_FT_Disc.h>
18using namespace std;
19void Operator_FT_Disc::Operator_Laplacian_FT_element(const ArrOfDouble& Phi_Facet,const Maillage_FT_Disc& FTmesh, ArrOfDouble& Laplacian_Phi_Facet,DoubleTab& Grad_Phi_Sommet)
20{
21 Operator_Gradient_FT_sommets(Phi_Facet, FTmesh, Grad_Phi_Sommet, true);
22 const int dim = Objet_U::dimension;
23 int nbfa7=FTmesh.nb_facettes();
24 DoubleTab sommets=FTmesh.sommets();
25 IntTab facettes=FTmesh.facettes();
26 const DoubleTab& nfa7 = FTmesh.get_update_normale_facettes();
27 const Desc_Structure_FT& desc_facettes = FTmesh.desc_facettes();
28 Laplacian_Phi_Facet.resize(nbfa7);
29 for (int fa7=0 ; fa7<nbfa7 ; fa7++)
30 Laplacian_Phi_Facet[fa7]=0.;
31
32 for (int fa7=0 ; fa7<nbfa7 ; fa7++)
33 {
34 if(! FTmesh.facette_virtuelle(fa7))
35 {
36 ArrOfDouble nfac(dim);
37 nfac[0]=nfa7(fa7,0);
38 nfac[1]=nfa7(fa7,1);
39 nfac[2]=nfa7(fa7,2);
40
41 // positions des sommets de la fa7
42 DoubleTab x_sommets(dim,dim);
43 for (int sommet_fa7=0 ; sommet_fa7<dim ; sommet_fa7++)
44 {
45 int indice_sommet = facettes(fa7,sommet_fa7);
46 for (int dir=0 ; dir<dim ; dir++)
47 x_sommets(sommet_fa7,dir)=sommets(indice_sommet,dir);
48 }
49 // positions du barycentre de la fa7
50 ArrOfDouble x_g(dim);
51 for (int dir=0 ; dir<dim ; dir++)
52 x_g[dir] = (x_sommets(0, dir)+x_sommets(1, dir)+x_sommets(2, dir))/dim;
53
54 if (dim==3)
55 {
56 for (int sommet_fa7=0 ; sommet_fa7<dim ; sommet_fa7++)
57 {
58 ArrOfDouble p1(dim);
59 ArrOfDouble t1(dim);
60 ArrOfDouble x_midpoint(dim);
61 ArrOfDouble Grad_Phi_midpoint(dim);
62 for (int dir=0 ; dir<dim ; dir++)
63 {
64 t1[dir]=x_sommets(sommet_fa7,dir)-x_sommets(((sommet_fa7-1)%dim+dim)%dim,dir);
65 x_midpoint[dir]=(x_sommets(sommet_fa7,dir)+x_sommets(((sommet_fa7-1)%dim+dim)%dim,dir))/2.;
66 }
67
68 int indice_sommet = facettes(fa7,sommet_fa7);
69 int other_sommet = facettes(fa7,((sommet_fa7-1)%dim+dim)%dim);
70 for (int dir=0 ; dir<dim ; dir++)
71 Grad_Phi_midpoint(dir)=(Grad_Phi_Sommet(indice_sommet, dir)+Grad_Phi_Sommet(other_sommet, dir))/2.;
72
73 produit_vectoriel(nfac,t1,p1);
74
75 // il faut s'assurer que p1 soit dans la direction exterieur a l element de surface de la fa7.
76 // il faut donc que p1.(x_midpoint-x_g)>0
77 // sinon, il faut inverser p1
78 if (p1[0]*(x_midpoint[0]-x_g[0])+p1[1]*(x_midpoint[1]-x_g[1])+p1[2]*(x_midpoint[2]-x_g[2])<0)
79 {
80 for (int dir=0 ; dir<dim ; dir++)
81 p1[dir]=-p1[dir];
82 }
83 for (int dir=0 ; dir<dim ; dir++)
84 Laplacian_Phi_Facet[fa7]+=Grad_Phi_midpoint(dir)*p1[dir];
85 }
86 }
87 }
88 }
89 desc_facettes.echange_espace_virtuel(Laplacian_Phi_Facet);
90}
91
92void Operator_FT_Disc::Compute_interfaciale_source(const ArrOfDouble& sigma_Facet, const Maillage_FT_Disc& FTmesh,
93 DoubleTab& df_sigma, bool Normalised_with_Surface, bool use_tryggvason_formulation, bool with_marangoni)
94{
95 int dim = Objet_U::dimension;
96 int nbfa7=FTmesh.nb_facettes();
97 int nbsom=FTmesh.nb_sommets();
98 //DoubleTab sommets=FTmesh.sommets();
99 // IntTab facettes=FTmesh.facettes();
100 //const ArrOfDouble& Sfa7 = FTmesh.get_update_surface_facettes();
101 const Desc_Structure_FT& desc_sommets = FTmesh.desc_sommets();
102
103 /* initialisation des tableaux locaux */
104 ArrOfDouble Unit_Facet, Unit_Somm, Surface_sommet, sigma_sommet ;
105 DoubleTab df_sigma_bis ;
106 df_sigma.resize(nbsom, dim);
107 df_sigma_bis.resize(nbsom, dim);
108 Unit_Somm.resize(nbsom);
109 Unit_Facet.resize(nbfa7);
110 sigma_sommet.resize(nbsom);
111 Surface_sommet.resize(nbsom);
112 for (int fa7=0 ; fa7<nbfa7 ; fa7++)
113 {
114 Unit_Facet(fa7)=1. ;
115 }
116 for (int som=0 ; som<nbsom ; som++)
117 {
118 Unit_Somm(som)=1.;
119 sigma_sommet(som)=0.;
120 for (int dir=0 ; dir<dim ; dir++)
121 {
122 df_sigma(som, dir)= 0. ;
123 df_sigma_bis(som, dir)= 0. ;
124 }
125 }
126 /* Interpolation aux sommets */
127 Facette_to_Sommets(Surface_sommet, sigma_sommet, sigma_Facet, FTmesh, true);
128 Operator_integral_bord_facette_phi_p_dl(Surface_sommet, sigma_sommet, sigma_Facet, FTmesh, df_sigma, df_sigma_bis);
129
130 if (!with_marangoni and use_tryggvason_formulation)
131 {
132 // on ne veut pas du terme de marangoni
133 // Cela revient à extraire sigma de l'integrale
134 // on veut donc sigma * int_p_dl
135 for (int som=0 ; som<nbsom ; som++)
136 if(! FTmesh.sommet_virtuel(som))
137 for (int dir=0 ; dir<3 ; dir++)
138 df_sigma(som, dir) = df_sigma_bis(som, dir)*sigma_sommet[som];
139
140 }
141 else if(with_marangoni and !use_tryggvason_formulation)
142 {
143 // on ne veut QUE du terme de marangoni
144 // Cela revient à soustraire les deux contribution int_sigma_p_dl - sigma * int_p_dl
145 for (int som=0 ; som<nbsom ; som++)
146 if(! FTmesh.sommet_virtuel(som))
147 for (int dir=0 ; dir<3 ; dir++)
148 df_sigma(som, dir)-=df_sigma_bis(som, dir)*sigma_sommet[som];
149
150 }
151 else if (!with_marangoni and !use_tryggvason_formulation)
152 {
153 // on ne veut rien du tout
154 for (int som=0 ; som<nbsom ; som++)
155 for (int dir=0 ; dir<dim ; dir++)
156 df_sigma(som, dir)= 0. ;
157 }
158 // dans le cas with_marangoni and use_tryggvason_formulation, on veut df_sigma=int_sigma_p_dl
159 // Il n'y a donc rien a changer
160
161 desc_sommets.echange_espace_virtuel(df_sigma);
162}
163
164void Operator_FT_Disc::Operator_Gradient_FT_sommets(const ArrOfDouble& Phi_Facet, const Maillage_FT_Disc& FTmesh,
165 DoubleTab& Grad_Phi_Sommet, bool Normalised_with_Surface)
166{
167
168
169 int dim = Objet_U::dimension;
170 int nbfa7=FTmesh.nb_facettes();
171 int nbsom=FTmesh.nb_sommets();
172 //DoubleTab sommets=FTmesh.sommets();
173 //IntTab facettes=FTmesh.facettes();
174 //const ArrOfDouble& Sfa7 = FTmesh.get_update_surface_facettes();
175 const Desc_Structure_FT& desc_sommets = FTmesh.desc_sommets();
176
177 /* initialisation des tableaux locaux */
178 ArrOfDouble Unit_Facet, Unit_Somm, Phi_sommet, Surface_sommet ;
179 DoubleTab int_phi_p_dl, int_p_dl ;
180 Grad_Phi_Sommet.resize(nbsom, dim);
181 int_phi_p_dl.resize(nbsom, dim);
182 int_p_dl.resize(nbsom, dim);
183 Unit_Somm.resize(nbsom);
184 Unit_Facet.resize(nbfa7);
185 Phi_sommet.resize(nbsom);
186 Surface_sommet.resize(nbsom);
187 for (int fa7=0 ; fa7<nbfa7 ; fa7++)
188 {
189 Unit_Facet(fa7)=1. ;
190 }
191 for (int som=0 ; som<nbsom ; som++)
192 {
193 Unit_Somm(som)=1.;
194 for (int dir=0 ; dir<dim ; dir++)
195 {
196 Grad_Phi_Sommet(som, dir)= 0. ;
197 int_p_dl(som, dir)=0.;
198 int_phi_p_dl(som, dir)=0.;
199 }
200 }
201
202 /* Interpolation aux sommets */
203 Facette_to_Sommets(Surface_sommet, Phi_sommet, Phi_Facet, FTmesh, true);
204
205 /* Calcul des integrales surfaciques */
206 Operator_integral_bord_facette_phi_p_dl(Surface_sommet, Phi_sommet, Phi_Facet, FTmesh, int_phi_p_dl, int_p_dl);
207
208 /* Assemblage du gradient */
209
210 for (int som=0 ; som<nbsom ; som++)
211 if(! FTmesh.sommet_virtuel(som))
212 for (int dir=0 ; dir<dim ; dir++)
213 Grad_Phi_Sommet(som, dir) = int_phi_p_dl(som, dir) - int_p_dl(som, dir) *Phi_sommet[som];
214
215 /* normalisation si souhaitee */
216 if (!Normalised_with_Surface)
217 for (int som=0 ; som<nbsom ; som++)
218 if(! FTmesh.sommet_virtuel(som))
219 for (int dir=0 ; dir<dim ; dir++)
220 Grad_Phi_Sommet(som, dir)*= Surface_sommet[som];
221
222 desc_sommets.echange_espace_virtuel(Grad_Phi_Sommet);
223}
224
225void Operator_FT_Disc::Operator_integral_bord_facette_phi_p_dl(const ArrOfDouble& Surface_sommet, const ArrOfDouble& Phi_sommet, const ArrOfDouble& Phi_Facet, const Maillage_FT_Disc& FTmesh,
226 DoubleTab& int_phi_p_dl, DoubleTab& int_p_dl)
227{
228 int dim = Objet_U::dimension;
229 double R = 1.; // TODO GUILLAUME
230 using Kokkos::numbers::pi;
231 int nbfa7=FTmesh.nb_facettes();
232 int nbsom=FTmesh.nb_sommets();
233 DoubleTab sommets=FTmesh.sommets();
234 IntTab facettes=FTmesh.facettes();
235 const DoubleTab& nfa7 = FTmesh.get_update_normale_facettes();
236 const Desc_Structure_FT& desc_sommets = FTmesh.desc_sommets();
237// Calcul du gradient aux sommets
238 for (int fa7=0 ; fa7<nbfa7 ; fa7++)
239 {
240 if(! FTmesh.facette_virtuelle(fa7))
241 {
242 ArrOfDouble nfac(dim);
243 for (int dir=0 ; dir<dim ; dir++)
244 nfac[dir]=nfa7(fa7,dir);
245
246 // positions du barycentre de la fa7
247 ArrOfDouble x_g(dim);
248 for (int dir=0 ; dir<dim ; dir++)
249 {
250 for (int sommet_fa7=0 ; sommet_fa7<dim ; sommet_fa7++)
251 {
252 int indice_sommet = facettes(fa7,sommet_fa7);
253 x_g[dir] += sommets(indice_sommet, dir);
254 }
255 x_g[dir]/=dim;
256 }
257
258 // positions des 2 midpoints adjacents a chaques sommets de la fa7
259 // Moyenne de Phi a ces midpoints
260 DoubleTab x_midpoint1(dim,dim);
261 DoubleTab x_midpoint2(dim,dim);
262 ArrOfDouble Phi_midpoint1(dim);
263 ArrOfDouble Phi_midpoint2(dim);
264
265 for (int sommet_fa7=0 ; sommet_fa7<dim ; sommet_fa7++)
266 {
267 int indice_sommet = facettes(fa7,sommet_fa7);
268 int indice_sommet_second = facettes(fa7,((sommet_fa7-1)%dim+dim)%dim);
269 Phi_midpoint1[sommet_fa7] = (Phi_sommet[indice_sommet]+Phi_sommet[indice_sommet_second])/2.;
270 for (int dir=0 ; dir<dim ; dir++)
271 {
272 x_midpoint1(sommet_fa7, dir)=(sommets(indice_sommet, dir)+sommets(indice_sommet_second, dir))/2.;
273 }
274 if(dim==3)
275 {
276 int indice_sommet_third= facettes(fa7,((sommet_fa7+1)%dim+dim)%dim);
277 Phi_midpoint2[sommet_fa7] = (Phi_sommet[indice_sommet]+Phi_sommet[indice_sommet_third])/2.;
278 for (int dir=0 ; dir<dim ; dir++)
279 {
280 x_midpoint2(sommet_fa7, dir)=(sommets(indice_sommet, dir)+sommets(indice_sommet_third, dir))/2.;
281 }
282 }
283 }
284 // calcul de l integrale lineique de Phi.p sur le bord de la sous zone e du volument du controle du sommet.
285 // La sous-zone e est definie par le croisement des mediane de l element triangulaire.
286 // Le bord de la sous-zone est composee de 2 segments --> int = Phi1.p1.DS1 + Phi2.p2.DS2
287 // Voir Muradoglu et Tryggvason 2014 pour plus de details.
288
289 for (int sommet_fa7=0 ; sommet_fa7<dim ; sommet_fa7++)
290 {
291 int indice_sommet = facettes(fa7,sommet_fa7);
292 ArrOfDouble p1(dim), p2(dim);
293 ArrOfDouble t1(dim), t2(dim);
294 double Phi1 = 0.;
295 double Phi2 = 0.;
296 Phi1 = (Phi_Facet(fa7)+Phi_midpoint1(sommet_fa7))/2.;
297 if (dim==3)
298 Phi2 = (Phi_Facet(fa7)+Phi_midpoint2(sommet_fa7))/2.;
299
300 if (dim==3)
301 {
302 for (int dir=0 ; dir<dim ; dir++)
303 {
304 t1[dir]=x_midpoint1(sommet_fa7,dir)-x_g[dir];
305 t2[dir]=x_midpoint2(sommet_fa7,dir)-x_g[dir];
306 }
307 produit_vectoriel(nfac,t1,p1);
308 produit_vectoriel(nfac,t2,p2);
309 // il faut s'assurer que p1 et p2 sont dans la direction exterieur a la surface de controle du sommet.
310 // il faut donc que p1.(xg-x_sommet)>0
311 // sinon, il faut inverser p1, idem pour p2
312 // Uniquement en 3D
313 if (p1[0]*(x_g[0]-sommets(indice_sommet,0))+p1[1]*(x_g[1]-sommets(indice_sommet,1))+p1[2]*(x_g[2]-sommets(indice_sommet,2))<0)
314 {
315 for (int dir=0 ; dir<dim ; dir++)
316 p1[dir]=-p1[dir];
317 }
318 if (p2[0]*(x_g[0]-sommets(indice_sommet,0))+p2[1]*(x_g[1]-sommets(indice_sommet,1))+p2[2]*(x_g[2]-sommets(indice_sommet,2))<0)
319 {
320 for (int dir=0 ; dir<dim ; dir++)
321 p2[dir]=-p2[dir];
322 }
323 }
324 else if (dim==2)
325 {
326 for (int dir=0 ; dir<dim ; dir++)
327 p1[dir]=x_midpoint1(sommet_fa7,dir)-sommets(indice_sommet,dir);
328 unitarisation(p1);
329 for (int dir=0 ; dir<dim ; dir++)
330 p1[dir]*=2*pi*R;
331 }
332
333 for (int dir=0 ; dir<dim ; dir++)
334 {
335 int_phi_p_dl(indice_sommet, dir)+=Phi1*p1[dir];
336 if (dim==3)
337 int_phi_p_dl(indice_sommet, dir)+=Phi2*p2[dir];
338 int_p_dl(indice_sommet, dir)+=p1[dir];
339 if (dim==3)
340 int_p_dl(indice_sommet, dir)+=p2[dir];
341 }
342 }
343 }
344 }
345
346 desc_sommets.collecter_espace_virtuel(int_phi_p_dl, MD_Vector_tools::EV_SOMME);
348
349 for (int som=0 ; som<nbsom ; som++)
350 if(! FTmesh.sommet_virtuel(som))
351 for (int dir=0 ; dir<dim ; dir++)
352 {
353 int_phi_p_dl(som, dir)/= Surface_sommet[som];
354 int_p_dl(som, dir)/= Surface_sommet[som];
355 }
356
357 desc_sommets.echange_espace_virtuel(int_phi_p_dl);
358 desc_sommets.echange_espace_virtuel(int_p_dl);
359}
360
361
362void Operator_FT_Disc::Facette_to_Sommets(ArrOfDouble& Surface_sommet, DoubleTab& Phi_Som, const DoubleTab& Phi_Facet, const Maillage_FT_Disc& FTmesh, bool Normalised_with_Surface)
363{
364 int dim = Objet_U::dimension;
365 int nbfa7=FTmesh.nb_facettes();
366 int nbsom=FTmesh.nb_sommets();
367 ArrOfDouble Phi_Facet_dir ;
368 ArrOfDouble Phi_Som_dir ;
369 Phi_Facet_dir.resize(nbfa7);
370 Phi_Som_dir.resize(nbsom);
371 Phi_Som.resize(nbsom, dim);
372
373 for (int dir=0 ; dir<dim ; dir++)
374 {
375 for (int fa7=0 ; fa7<nbfa7 ; fa7++)
376 Phi_Facet_dir(fa7) = Phi_Facet(fa7, dir);
377
378 Facette_to_Sommets(Surface_sommet, Phi_Som_dir, Phi_Facet_dir, FTmesh, Normalised_with_Surface);
379
380 for (int som=0 ; som<nbsom ; som++)
381 Phi_Som(som, dir) = Phi_Som_dir(som) ;
382 }
383}
384
385void Operator_FT_Disc::Facette_to_Sommets(ArrOfDouble& Surface_sommet, ArrOfDouble& Phi_Som, const ArrOfDouble& Phi_Facet, const Maillage_FT_Disc& FTmesh, bool Normalised_with_Surface)
386{
387 int dim = Objet_U::dimension;
388 int nbfa7=FTmesh.nb_facettes();
389 int nbsom=FTmesh.nb_sommets();
390 IntTab facettes=FTmesh.facettes();
391 const ArrOfDouble& Sfa7 = FTmesh.get_update_surface_facettes();
392 Phi_Som.resize(nbsom);
393 Surface_sommet.resize(nbsom);
394
395 for (int som=0 ; som<nbsom ; som++)
396 {
397 Phi_Som[som]=0.;
398 Surface_sommet[som]=0.;
399 }
400
401 // interpolation des valeur de Phi et de la normale aux sommets en moyennant les contributions adjacentes
402 for (int fa7=0 ; fa7<nbfa7 ; fa7++)
403 {
404 if(! FTmesh.facette_virtuelle(fa7))
405 {
406 for (int sommet_fa7=0 ; sommet_fa7<dim ; sommet_fa7++)
407 {
408 int indice_sommet = facettes(fa7,sommet_fa7);
409 Phi_Som[indice_sommet]+=Phi_Facet[fa7]*Sfa7[fa7]/dim; // TODO Guillaume : il faut que Sfa7 en 2D contienne * 2 pi R ; sinon il faut le rajouter ?
410 Surface_sommet[indice_sommet]+=Sfa7[fa7]/dim; // TODO Guillaume : il faut que Sfa7 en 2D contienne * 2 pi R ; sinon il faut le rajouter ?
411 }
412 }
413 }
414
415 // On a calcule la contribution de chaque facette reelle aux differents sommets.
416 // Certaines contributions ont ete ajoutees a des sommets virtuels, il
417 // faut recuperer ces contributions sur le sommet reel.
418 const Desc_Structure_FT& desc_sommets = FTmesh.desc_sommets();
420 desc_sommets.collecter_espace_virtuel(Surface_sommet, MD_Vector_tools::EV_SOMME);
421
422 if (Normalised_with_Surface)
423 for (int som=0 ; som<nbsom ; som++)
424 {
425 if(! FTmesh.sommet_virtuel(som))
426 {
427 Phi_Som[som]/= Surface_sommet[som];
428 }
429 }
430
431
432 desc_sommets.echange_espace_virtuel(Phi_Som);
433}
434
435void Operator_FT_Disc::Sommets_to_Facettes(DoubleTab& Phi_Facet, const DoubleTab& Phi_Som, const Maillage_FT_Disc& FTmesh, bool Normalised_with_Surface)
436{
437 int dim = Objet_U::dimension;
438 int nbfa7=FTmesh.nb_facettes();
439 int nbsom=FTmesh.nb_sommets();
440 ArrOfDouble Phi_Facet_dir ;
441 ArrOfDouble Phi_Som_dir ;
442 Phi_Facet_dir.resize(nbfa7);
443 Phi_Som_dir.resize(nbsom);
444 Phi_Facet.resize(nbfa7, dim);
445
446 for (int dir=0 ; dir<dim ; dir++)
447 {
448 for (int som=0 ; som<nbsom ; som++)
449 Phi_Som_dir(som) = Phi_Som(som, dir);
450
451 Sommets_to_Facettes(Phi_Facet_dir, Phi_Som_dir, FTmesh, Normalised_with_Surface);
452
453 for (int fa7=0 ; fa7<nbfa7 ; fa7++)
454 Phi_Facet(fa7, dir)=Phi_Facet_dir(fa7);
455 }
456}
457
458void Operator_FT_Disc::Sommets_to_Facettes(ArrOfDouble& Phi_Facet, const ArrOfDouble& Phi_Som, const Maillage_FT_Disc& FTmesh, bool Normalised_with_Surface)
459{
460 int dim = Objet_U::dimension;
461 int nbfa7=FTmesh.nb_facettes();
462 IntTab facettes=FTmesh.facettes();
463 const ArrOfDouble& Sfa7 = FTmesh.get_update_surface_facettes();
464
465 Phi_Facet.resize(nbfa7);
466 for (int fa=0 ; fa<nbfa7 ; fa++)
467 Phi_Facet[fa]=0.;
468
469 // interpolation des valeur de Phi et de la normale aux sommets en moyennant les contributions adjacentes
470 for (int fa7=0 ; fa7<nbfa7 ; fa7++)
471 {
472 if(! FTmesh.facette_virtuelle(fa7))
473 {
474 for (int sommet_fa7=0 ; sommet_fa7<dim ; sommet_fa7++)
475 {
476 int indice_sommet = facettes(fa7,sommet_fa7);
477 Phi_Facet[fa7]+= Phi_Som[indice_sommet]/dim ;
478 }
479 if(!Normalised_with_Surface)
480 Phi_Facet[fa7]*=Sfa7[fa7];
481 }
482 }
483 const Desc_Structure_FT& desc_facettes = FTmesh.desc_facettes();
484 desc_facettes.echange_espace_virtuel(Phi_Facet);
485}
486
487
488void Operator_FT_Disc::produit_vectoriel(const ArrOfDouble& a, const ArrOfDouble& b, ArrOfDouble& resu)
489{
490 if (Objet_U::dimension == 3)
491 {
492 resu[0] = a[1]*b[2] - a[2]*b[1];
493 resu[1] = a[2]*b[0] - a[0]*b[2];
494 resu[2] = a[0]*b[1] - a[1]*b[0];
495 }
496}
497
498double Operator_FT_Disc::norme(const ArrOfDouble& a)
499{
500 double z =(Objet_U::dimension == 3) ? a[2]*a[2] : 0.;
501 return std::sqrt(a[0]*a[0]+a[1]*a[1]+z);
502}
504{
505 double normea=norme(a);
506 a[0] /= normea ;
507 a[1] /= normea ;
508 if (Objet_U::dimension == 3)
509 a[2] /= normea ;
510}
: class Desc_Structure_FT
void collecter_espace_virtuel(ArrOfDouble &tab, MD_Vector_tools::Operations_echange op) const
void echange_espace_virtuel(ArrOfDouble &tab) const
: class Maillage_FT_Disc Cette classe decrit un maillage:
int nb_sommets() const
renvoie le nombre de sommets (reels et virtuels) (egal a sommets().
const DoubleTab & sommets() const
renvoie le tableau des sommets (reels et virtuels) dimension(0) = nombre de sommets,
int nb_facettes() const
renvoie le nombre de facettes (reelles et virtuelles) (egal a facettes().
int facette_virtuelle(int i) const
Renvoie 0 si la facette m'appartient, 1 sinon.
const Desc_Structure_FT & desc_sommets() const
renvoie le descripteur des sommets (espace_distant/virtuel)
virtual const DoubleTab & get_update_normale_facettes() const
Calcule la grandeur demandee, stocke le resultat dans un tableau interne a la classe et renvoie le re...
const Desc_Structure_FT & desc_facettes() const
renvoie le descripteur des facettes (espace_distant/virtuel)
int sommet_virtuel(int i) const
virtual const ArrOfDouble & get_update_surface_facettes() const
Calcule la grandeur demandee, stocke le resultat dans un tableau interne a la classe et renvoie le re...
const IntTab & facettes() const
renvoie le tableau des facettes (reelles et virtuelles) dimension(0) = nombre de facettes,
static int dimension
Definition Objet_U.h:99
void Operator_Gradient_FT_sommets(const ArrOfDouble &Phi_Facet, const Maillage_FT_Disc &FTmesh, DoubleTab &Grad_Phi_Sommet, bool Normalised_with_Surface=true)
void Operator_Laplacian_FT_element(const ArrOfDouble &Phi_Facet, const Maillage_FT_Disc &FTmesh, ArrOfDouble &Laplacian_Phi_Facet, DoubleTab &Grad_Phi_Sommet)
void Compute_interfaciale_source(const ArrOfDouble &sigma_Facet, const Maillage_FT_Disc &FTmesh, DoubleTab &df_sigma, bool Normalised_with_Surface, bool use_tryggvason_formulation, bool with_marangoni=false)
void unitarisation(ArrOfDouble &a)
void produit_vectoriel(const ArrOfDouble &a, const ArrOfDouble &b, ArrOfDouble &resu)
void Facette_to_Sommets(ArrOfDouble &Surface_sommet, DoubleTab &Phi_Som, const DoubleTab &Phi_Facet, const Maillage_FT_Disc &FTmesh, bool Normalised_with_Surface)
void Sommets_to_Facettes(DoubleTab &Phi_Facet, const DoubleTab &Phi_Som, const Maillage_FT_Disc &FTmesh, bool Normalised_with_Surface)
void Operator_integral_bord_facette_phi_p_dl(const ArrOfDouble &Surface_sommet, const ArrOfDouble &Phi_sommet, const ArrOfDouble &Phi_Facet, const Maillage_FT_Disc &FTmesh, DoubleTab &int_phi_p_dl, DoubleTab &int_p_dl)
double norme(const ArrOfDouble &a)
void resize(_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTArray.h:156
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469