TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Domaine_EF.cpp
1/****************************************************************************
2* Copyright (c) 2026, 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#include <interface_INITGAUSS.h>
17#include <interface_CALCULBIJ.h>
18#include <Domaine_Cl_dis_base.h>
19#include <Quadrangle_VEF.h>
20#include <Domaine_Cl_EF.h>
21#include <Equation_base.h>
22#include <Hexaedre_VEF.h>
23#include <Milieu_base.h>
24#include <Domaine_EF.h>
25#include <Periodique.h>
26#include <Segment_EF.h>
27#include <Rectangle.h>
28#include <Tetraedre.h>
29#include <Quadri_EF.h>
30#include <Hexaedre.h>
31#include <Triangle.h>
32#include <Tetra_EF.h>
33#include <EFichier.h>
34#include <Segment.h>
35#include <Hexa_EF.h>
36#include <Domaine.h>
37#include <Scatter.h>
38#include <Tri_EF.h>
39
40Implemente_instanciable(Domaine_EF, "Domaine_EF", Domaine_VF);
41
42Sortie& Domaine_EF::ecrit(Sortie& os) const
43{
45 os << "____ h_carre "<<finl;
46 os << h_carre << finl;
47 os << "____ type_elem_ "<<finl;
48 os << type_elem_.valeur() << finl;
49 os << "____ nb_elem_std_ "<<finl;
50 os << nb_elem_std_ << finl;
51 os << "____ volumes_entrelaces_ "<<finl;
52 volumes_entrelaces_.ecrit(os);
53 os << "____ face_normales_ "<<finl;
54 face_normales_.ecrit(os);
55 os << "____ nb_faces_std_ "<<finl;
56 os << nb_faces_std_ << finl;
57 os << "____ rang_elem_non_std_ "<<finl;
58 rang_elem_non_std_.ecrit(os);
59 return os;
60}
61
63{
65
66 os << h_carre << finl;
67 os << type_elem_.valeur() << finl;
68 os << nb_elem_std_ << finl;
69 os << volumes_entrelaces_ << finl;
70 os << face_normales_ << finl;
71 os << xp_ << finl;
72 os << xv_ << finl;
73 os << nb_faces_std_ << finl;
74 os << rang_elem_non_std_ << finl;
75 return os;
76}
77
79{
81 is >> h_carre;
82
83 /* read type_elem */
84 {
85 Nom type;
86 is >> type;
87 if (type == "Tri_EF")
88 type_elem_ = Tri_EF();
89 else if (type == "Tetra_EF")
90 type_elem_ = Tetra_EF();
91 else if (type == "Quadri_EF")
92 type_elem_ = Quadri_EF();
93 else if (type == "Hexa_EF")
94 type_elem_ = Hexa_EF();
95 else
96 {
97 Cerr << type << " is not an Elem_EF !" << finl;
99 }
100 }
101
102 is >> nb_elem_std_ ;
103 is >> volumes_entrelaces_ ;
104 is >> face_normales_ ;
105 is >> xp_;
106 is >> xv_;
107 is >> nb_faces_std_ ;
108 is >> rang_elem_non_std_ ;
109 return is;
110}
111
113{
114 int nbelem=domaine().nb_elem();
115 int nb_som_elem=domaine().nb_som_elem();
116 if (IPhi_.size() == 0) IPhi_.resize(nbelem,nb_som_elem);
118 // Scatter::creer_tableau_distribue(domaine().domaine(), JOINT_ITEM::ELEMENT, IPhi_);
120 double rap=1./domaine().nb_som_elem();
121
122 // computation of IPhi_ version valid for squares...
123 for (int elem=0; elem<nbelem; elem++)
124 {
125 double vol=volumes(elem)*rap;
126 for (int s=0; s<nb_som_elem; s++)
127 {
128 IPhi_(elem,s)=vol;
129 IPhi_thilde_(elem,s)=vol*zcl.equation().milieu().porosite_elem(elem);
130 }
131 }
132 IPhi_.echange_espace_virtuel();
133 IPhi_thilde_.echange_espace_virtuel();
134}
135
137{
138 // volumes_sommets_thilde_.resize(nb_som());
139 //Scatter::creer_tableau_distribue(domaine().domaine(), JOINT_ITEM::SOMMET, volumes_sommets_thilde_);
140// domaine().creer_tableau_sommets(volumes_sommets_thilde_);
141
142 calculer_IPhi(zcl);
143
144 // computation of volumes_sommets_thilde
145 const IntTab& les_elems=domaine().les_elems() ;
146
147 DoubleVect volumes_som_prov(volumes_sommets_thilde_);
148 for (int elem=0; elem<domaine().nb_elem_tot(); elem++)
149 {
150
151 for (int s=0; s<domaine().nb_som_elem(); s++)
152 {
153 double vol=IPhi_thilde_(elem,s);
154 int s_glob=les_elems(elem,s);
155 volumes_sommets_thilde_(s_glob)+=vol;
156 volumes_som_prov(s_glob)+=IPhi_(elem,s);
157 }
158 }
159
160// volumes_sommets_thilde_.resize(nb_som());
161 volumes_sommets_thilde_.echange_espace_virtuel();
162 if (porosite_sommets_.size_array()==0)
163 {
164 // abort();
165 porosite_sommets_=volumes_sommets_thilde_;
166
167 for (int som=0; som<nb_som(); som++)
168 {
169 porosite_sommets_(som)=volumes_sommets_thilde_(som)/volumes_som_prov(som);
170 }
171 porosite_sommets_.echange_espace_virtuel();
172 }
173#if 0
174 if (0)
175 {
176 porosite_sommets_.resize(0);
177 DoubleVect volumes_som_prov(volumes_sommets_thilde_);
178 DoubleVect volumes_som_prov_b(volumes_sommets_thilde_);
179 volumes_som_prov=0;
180 volumes_som_prov_b=0;
181 for (int elem=0; elem<domaine().nb_elem_tot(); elem++)
182 {
183
184 for (int s=0; s<domaine().nb_som_elem(); s++)
185 {
186 double vol=IPhi_thilde_(elem,s);
187 double v2=IPhi_(elem,s);
188 int s_glob=les_elems(elem,s);
189 volumes_som_prov(s_glob)+=v2/vol;
190 volumes_som_prov_b(s_glob)+=1;
191 }
192 }
193 Cerr<<mp_max_vect(porosite_elem_)<<" "<<mp_min_vect( porosite_elem_)<<finl;
194 Cerr<<mp_max_vect(volumes_som_prov)<<" "<<mp_min_vect( volumes_som_prov)<<finl;
195 Cerr<<mp_max_vect(volumes_som_prov_b)<<" "<<mp_min_vect( volumes_som_prov_b)<<finl;
196
197 if (porosite_sommets_.size_array()==0)
198 {
199 // abort();
200 porosite_sommets_=volumes_sommets_thilde_;
201
202 for (int som=0; som<nb_som(); som++)
203 {
204 porosite_sommets_(som)=1./volumes_som_prov(som)*volumes_som_prov_b(som);
205
206 }
207 porosite_sommets_.echange_espace_virtuel();
208 }
209 Cerr<<mp_max_vect( porosite_sommets_)<<" "<<mp_min_vect( porosite_sommets_)<<finl;
210 for (int elem=0; elem<domaine().nb_elem_tot(); elem++)
211 for (int s=0; s<domaine().nb_som_elem(); s++)
212 IPhi_thilde_(elem,s)= IPhi_thilde_(elem,s)*porosite_sommets_(les_elems(elem,s));
213 }
214#endif
215
216 volumes_thilde_=volumes_;
217 for (int elem=0; elem<domaine().nb_elem_tot(); elem++)
218 {
219 volumes_thilde_(elem)=volumes_(elem)*zcl.equation().milieu().porosite_elem(elem);
220 }
221}
222
223void Domaine_EF::swap(int fac1, int fac2, int nb_som_faces )
224{
225
226}
227
228void Domaine_EF::typer_elem(Domaine& domaine_geom)
229{
230 const Elem_geom_base& elem_geom = domaine_geom.type_elem().valeur();
231 if (sub_type(Rectangle, elem_geom))
232 domaine_geom.typer("Quadrangle");
233 else if (sub_type(Hexaedre, elem_geom))
234 domaine_geom.typer("Hexaedre_VEF");
235
236 const Nom& type_elem_geom = domaine_geom.type_elem()->que_suis_je();
237 Nom type;
238
239 if (type_elem_geom == "Triangle")
240 type = "Tri_EF";
241 else if (type_elem_geom == "Tetraedre")
242 type = "Tetra_EF";
243 else if (type_elem_geom == "Quadrangle")
244 type = "Quadri_EF";
245 else if (type_elem_geom == "Hexaedre_VEF")
246 type = "Hexa_EF";
247 else if (type_elem_geom == "Segment")
248 type = "Segment_EF";
249 else if (type_elem_geom == "Segment_axi")
250 type = "Segment_EF_axi";
251 else if (type_elem_geom == "Point")
252 type = "Point_EF";
253 else
254 {
255 Cerr << "typing problem in Domaine_EF::typer_elem => geometric type : " << type_elem_geom << finl;
257 }
258 type_elem_.typer(type);
259}
260
262{
263 if (domaine().axi1d())
264 {
265 Cerr << "*****************************************************************************" << finl;
266 Cerr << " Error in " << que_suis_je() << " : the type of domain " << domaine().que_suis_je();
267 Cerr << " is not compatible" << finl;
268 Cerr << " with the discretisation EF. " << finl;
269 Cerr << " Please use the discretization EF_axi or define a domain of type Domaine." << finl;
270 Cerr << "*****************************************************************************" << finl;
272 }
273}
274
276{
278
279 Domaine& domaine_geom=domaine();
280 typer_elem(domaine_geom);
281 Elem_geom_base& elem_geom = domaine_geom.type_elem().valeur();
283
284 // Correction of the face_voisins array:
285 // After Domaine_VF::discretiser(), neighbor elements 0 and 1 of a
286 // face are the same on all processors that own the face.
287 // If the face is virtual and one of the two neighbor elements is not
288 // known (it is not within the joint thickness), that neighbor element
289 // is -1. It can be either neighbor 0 or neighbor 1.
290 // Virtual faces are corrected so that, if a neighbor element is not
291 // known, it is placed as neighbor 1. Neighbor 0 is therefore always valid.
292 {
293 IntTab& face_vois = face_voisins();
294 const int debut = nb_faces();
295 const int fin = nb_faces_tot();
296 for (int i = debut; i < fin; i++)
297 {
298 if (face_voisins(i, 0) == -1)
299 {
300 face_vois(i, 0) = face_vois(i, 1);
301 face_vois(i, 1) = -1;
302 }
303 }
304 }
305
306 // Verification of coherence between the geometric element and
307 // the discretisation element
308
309
310 if (sub_type(Segment_EF,type_elem_.valeur()))
311 {
312 if (!sub_type(Segment,elem_geom))
313 {
314 Cerr << " The type of geometric element " << elem_geom.que_suis_je() << " is incorrect" << finl;
315 exit();
316 }
317 }
318 else if (sub_type(Tri_EF,type_elem_.valeur()))
319 {
320 if (!sub_type(Triangle,elem_geom))
321 {
322 Cerr << " The type of geometric element " <<
323 elem_geom.que_suis_je() << " is incorrect" << finl;
324 Cerr << " Only the Triangle type is compatible with the EF discretisation in dimension 2" << finl;
325 Cerr << " You must triangulate the domain when using the internal mesher" ;
326 Cerr << " using the instruction: Trianguler nom_dom" << finl;
327 exit();
328 }
329 }
330 else if (sub_type(Tetra_EF,type_elem_.valeur()))
331 {
332 if (!sub_type(Tetraedre,elem_geom))
333 {
334 Cerr << " The type of geometric element " <<
335 elem_geom.que_suis_je() << " is incorrect" << finl;
336 Cerr << " Only the Tetraedre type is compatible with the EF discretisation in dimension 3" << finl;
337 Cerr << " You must tetrahedralise the domain when using the internal mesher";
338 Cerr << " using the instruction: Tetraedriser nom_dom" << finl;
339 exit();
340 }
341 }
342
343 else if (sub_type(Quadri_EF,type_elem_.valeur()))
344 {
345
346 if (!sub_type(Quadrangle_VEF,elem_geom))
347 {
348 Cerr << " The type of geometric element " << elem_geom.que_suis_je() << " is incorrect" << finl;
349 exit();
350 }
351 }
352 else if (sub_type(Hexa_EF,type_elem_.valeur()))
353 {
354
355 if (!sub_type(Hexaedre_VEF,elem_geom))
356 {
357 Cerr << " The type of geometric element " << elem_geom.que_suis_je() << " is incorrect" << finl;
358 exit();
359 }
360 }
361
362 int num_face;
363
364
365 // Fill the face_normales_ array.
366 // Note: the face_voisins array is not exactly a distributed array.
367 // A face does not have its two neighbors in the same order on all
368 // processors that own the face.
369 // Therefore the face normal can change direction from one processor
370 // to another, including for joint faces.
371 {
372 const int n = nb_faces();
373 face_normales_.resize(n, dimension);
374 // const Domaine & dom = domaine();
375 // Scatter::creer_tableau_distribue(dom, JOINT_ITEM::FACE, face_normales_);
377 const IntTab& face_som = face_sommets();
378 const IntTab& face_vois = face_voisins();
379 const IntTab& elem_face = elem_faces();
380 const int n_tot = nb_faces_tot();
381 for (num_face = 0; num_face < n_tot; num_face++)
382 {
383 type_elem_->normale(num_face,
385 face_som, face_vois, elem_face, domaine_geom);
386 }
387 }
388
389 domaine().creer_tableau_sommets(volumes_sommets_thilde_);
390}
391
393{
394 const IntTab& les_elems=domaine().les_elems() ;
395 int nbsom_face=nb_som_face();
396 int nbelem=nb_elem_tot();
397 int nbsom_elem=domaine().nb_som_elem();
398 const IntTab& elemfaces=elem_faces_;
399 int nbface_elem=domaine().nb_faces_elem();
400
401 for (int elem=0; elem<nbelem; elem++)
402 for (int i=0; i<nbsom_elem; i++)
403 {
404 // search for contributing faces, this is not optimal
405 for (int f=0; f<nbface_elem; f++)
406 {
407 int face=elemfaces(elem,f);
408 const double ratio = bidim_axi && xv_(face, 0) > 1e-10 ? xp_(elem, 0) / xv_(face, 0) : 1.0;
409 for (int s=0; s<nbsom_face; s++)
410 if (face_sommets_(face,s)==les_elems(elem,i))
411
412 // search for contributing faces, this is not optimal
413 for (int j=0; j<dimension; j++)
414 {
415 bij(elem,i,j)+=face_normales(face,j)*oriente_normale(face,elem) * ratio;
416 }
417 }
418 }
419}
420
421void Domaine_EF::calculer_Bij(DoubleTab& bij)
422{
423 int nbsom_face=nb_som_face();
424 int nbelem=nb_elem_tot();
425 int nbsom_elem=domaine().nb_som_elem();
426 bij.resize(nbelem,nbsom_elem,dimension);
427 const IntTab& les_elems=domaine().les_elems() ;
428 if (nbsom_elem!=8)
429 {
430 calculer_Bij_gen(bij);
431
432 bij/=nbsom_face;
433 Bij_thilde_=bij;
434 {
435 //int nbelem=nb_elem_tot();
436 //int nbsom_elem=domaine().nb_som_elem();
437 const IntTab& elems=domaine().les_elems() ;
438 //Cerr<<min(porosite_elem_)<<finl;abort();
439 for (int elem=0; elem<nbelem; elem++)
440 for (int i=0; i<nbsom_elem; i++)
441 {
442 int som_glob=elems(elem,i);;
443 for (int j=0; j<dimension; j++)
444 {
445 Bij_thilde_(elem,i,j)=bij(elem,i,j)*porosite_sommets_(som_glob);
446 }
447 }
448
449 // essai
450 if(0)
451 {
452 EFichier bthilde("Bthilde");
453 for (int elem=0; elem<nbelem; elem++)
454 for (int i=0; i<nbsom_elem; i++)
455 for (int j=0; j<dimension; j++)
456 {
457 int ii,jj,ele;
458 //Cout<< elem<<" "<<i<<" "<<j<<" "<<Bij_thilde_(elem,i,j)<<" uuu ";
459 int i2=i;
460 if (i2==2) i2=3;
461 if (i2==3) i2=2;
462 if (i2==7) i2=6;
463 if (i2==6) i2=7;
464 Cout<< elem<<" "<<i<<" "<<j<<" "<<Bij_thilde_(elem,i2,j)<<" uuu ";
465 bthilde >> ele>> ii >> jj >> Bij_thilde_(elem,i2,j);
466 Cout<< Bij_thilde_(elem,i2,j)<<finl;
467 assert(ele==elem+1);
468 assert(ii==i+1);
469 assert(jj==j+1);
470 }
471 }
472 }
473 }
474 else
475 {
476 volumes_sommets_thilde_=0;
477
478 Bij_thilde_.resize(nbelem,nbsom_elem,dimension);
479 ArrOfInt filter(8) ;
480
481
482 filter[0] = 0 ;
483 filter[1] = 2 ;
484 filter[2] = 3 ;
485 filter[3] = 1 ;
486 filter[4] = 4 ;
487 filter[5] = 6 ;
488 filter[6] = 7 ;
489 filter[7] = 5 ;
490 interface_INITGAUSS init_gauss;
491 int npgau=27;
492 // npgau=1;
493 int nbnn=nbsom_elem;
494 DoubleTab xgau(npgau,3),frgau(npgau,nbnn),dfrgau(npgau,nbnn,(int)3),poigau(npgau);
495 DoubleVect volumes_sommets_(volumes_sommets_thilde_);
496 int dim=3;
497 // init_gauss.compute(&dim,&nbnn,&npgau,xgau.addr(),frgau.addr(),dfrgau.addr(),poigau.addr());
498 init_gauss.Compute(dim,nbnn,npgau,xgau,frgau,dfrgau,poigau);
499 ArrOfInt num(nbnn);
500 interface_CALCULBIJ CALCULBIJ;
501 DoubleTab xl(dimension,nbnn),bijl(dimension,nbnn);
502 DoubleTab detj(npgau),ajm1(npgau*9),aj(npgau*9),df(npgau*nbnn*3),iphi(nbnn);
503 int ip=0;
504 const DoubleTab& coord=domaine().coord_sommets();
505 for (int elem=0; elem<nbelem; elem++)
506 {
507 for (int i=0; i<nbnn; i++)
508 num[i]=les_elems(elem,filter[i]);
509 for (int i=0; i<nbnn; i++)
510 for (int d=0; d<dimension; d++)
511 {
512 xl(d,i)=coord(num[i],d);
513 }
514 num+=1;
515 ip=0;
516 double vol;
517 int nbsom_tot=volumes_sommets_.size_totale();
518 CALCULBIJ.Compute(nbnn,nbsom_tot, xl, num, bijl,
519 porosite_sommets_, ip,
520 npgau, xgau, frgau, dfrgau,
521 poigau,detj, ajm1, aj, df,vol,volumes_sommets_,iphi);
522 if (!est_egal(volumes_(elem),vol,1e-5))
523 {
524 Cerr<<"Error volume "<<elem<< " vol: "<<volumes_(elem)<<" new "<<vol<<" delta "<<volumes_(elem)-vol;
525 exit();
526 }
527 for (int i=0; i<nbnn; i++)
528 {
529 for (int d=0; d<dimension; d++)
530 {
531 bij(elem,filter[i],d)=bijl(d,(i));
532 IPhi_(elem,filter[i])=iphi(i);
533 }
534 }
535 ip=1;
536
537 CALCULBIJ.Compute(nbnn, nbsom_tot, xl, num, bijl,
538 porosite_sommets_, ip,
539 npgau, xgau, frgau, dfrgau,
540 poigau,detj, ajm1, aj, df,volumes_thilde_(elem),volumes_sommets_thilde_,iphi);
541
542 for (int i=0; i<nbnn; i++)
543 {
544 for (int d=0; d<dimension; d++)
545 {
546 Bij_thilde_(elem,filter[i],d)=bijl(d,(i));
547 IPhi_thilde_(elem,filter[i])=iphi(i);
548 }
549
550 }
551 //exit();
552 }
553 }
554 if (0)
555 {
556 for (int elem=0; elem<nbelem; elem++)
557 {
558 for (int i=0; i<nbsom_elem; i++)
559 {
560 for (int d=0; d<dimension; d++)
561 Cerr<<" BIJ "<<elem<<" "<< i<< " "<<d<<" "<<bij(elem,i,d)<<" "<<Bij_thilde_(elem,i,d)<<finl;
562 Cerr<< " Iphi " << IPhi_(elem,i)<<" "<<IPhi_thilde_(elem,i)<<finl;
563 }
564 Cerr<<"vol elem "<<volumes_(elem)<< " "<<volumes_thilde_(elem)<<finl;
565 }
566 for (int elem=0; elem<volumes_sommets_thilde_.size_array(); elem++)
567 Cerr<<elem<<" vol som "<< volumes_sommets_thilde_(elem)<<finl;
568 }
569 // verif
570 Cerr<<"max/min/max_abs bij "<<mp_max_vect(bij)<< " "<<mp_min_vect(bij)<<" "<<mp_max_abs_vect(bij)<<finl;
571 if (bidim_axi) return;
572 int err=0;
573 for (int elem=0; elem<nbelem; elem++)
574 for (int j=0; j<dimension; j++)
575 {
576 double tot=0;
577 for (int i=0; i<nbsom_elem; i++)
578 tot+=bij(elem,i,j);
579 if (!est_egal(tot,0))
580 {
581 err++;
582 Cerr<<" pb elem "<< elem<<" direction "<<j<<" : "<<tot<<finl;
583 }
584 //Cerr<<"vol elem "<<volumes_(elem)<< " "<<volumes_thilde_(elem)<<finl;
585 }
586 if (err) exit();
587
588}
590{
591
592
593 porosite_sommets_.resize(nb_som());
594 porosite_sommets_=1;
595}
597{
598 // Computation of h_carre
599 h_carre = 1.e30;
600 h_carre_.resize(nb_faces());
601 // Computation of face areas
602 const DoubleVect& surfaces=face_surfaces();
603 const int nb_faces_elem=domaine().nb_faces_elem();
604 const int nbe=nb_elem();
605 for (int num_elem=0; num_elem<nbe; num_elem++)
606 {
607 double surf_max = 0;
608 for (int i=0; i<nb_faces_elem; i++)
609 {
610 double surf = surfaces(elem_faces(num_elem,i));
611 surf_max = (surf > surf_max)? surf : surf_max;
612 }
613 double vol = volumes(num_elem)/surf_max;
614 vol *= vol;
615 h_carre_(num_elem) = vol;
616 h_carre = ( vol < h_carre )? vol : h_carre;
617 }
618}
619
621{
622 // Cerr << "les normales aux faces " << face_normales() << finl;
623 // Compute the interleaved volumes;
624 // volumes_entrelaces_.resize(nb_faces());
626 int elem1,elem2;
627 int nb_faces_elem=domaine().nb_faces_elem();
628 int num_face;
629 for (num_face=0; num_face<premiere_face_int(); num_face++)
630 {
631 elem1 = face_voisins_(num_face,0);
632 volumes_entrelaces_[num_face] = volumes_[elem1]/nb_faces_elem;
633 }
634 for (num_face=premiere_face_int(); num_face<nb_faces(); num_face++)
635 {
636 elem1 = face_voisins_(num_face,0);
637 elem2 = face_voisins_(num_face,1);
638 volumes_entrelaces_[num_face] = (volumes_[elem1] + volumes_[elem2])
639 /
640 nb_faces_elem;
641 }
642 volumes_entrelaces_.echange_espace_virtuel();
643}
644
646{
647
648
649 //if (volumes_sommets_thilde_.size()!=nb_som())
650 if (Bij_.nb_dim()==1)
651 {
652
653 calculer_volumes_sommets(conds_lim[0]->domaine_Cl_dis());
654 Cerr << "le Domaine_EF a ete rempli avec succes" << finl;
655
657 // Compute porosities
658
659 // vertex porosities are not used
660 //calculer_porosites_sommets();
661 calculer_Bij(Bij_);
662
663
664
665 }
666 Journal() << "Domaine_EF::Modifier_pour_Cl" << finl;
667 for (auto& itr : conds_lim)
668 {
669 //for cl
670 const Cond_lim_base& cl = itr.valeur();
671 if (sub_type(Periodique, cl))
672 {
673 //if Perio
674 const Periodique& la_cl_period = ref_cast(Periodique,cl);
675 int nb_faces_elem = domaine().nb_faces_elem();
676 const Front_VF& la_front_dis = ref_cast(Front_VF,cl.frontiere_dis());
677 int ndeb = 0;
678 int nfin = la_front_dis.nb_faces_tot();
679#ifndef NDEBUG
680 int num_premiere_face = la_front_dis.num_premiere_face();
681 int num_derniere_face = num_premiere_face+nfin;
682#endif
683 int nbr_faces_bord = la_front_dis.nb_faces();
684 assert((nb_faces()==0)||(ndeb<nb_faces()));
685 assert(nfin>=ndeb);
686 int elem1,elem2,k;
687 int face;
688 // Modification of face_voisins_, face_normales_, volumes_entrelaces_ arrays.
689 // Some normals are reoriented so that normals to periodic faces point
690 // from face_voisins(face,0) toward face_voisins(face,1),
691 // as is the case for internal faces.
692
693 DoubleVect C1C2(dimension);
694 double vol,psc=0;
695
696 for (int ind_face=ndeb; ind_face<nfin; ind_face++)
697 {
698 //for ind_face
699 face = la_front_dis.num_face(ind_face);
700 if ( (face_voisins_(face,0) == -1) || (face_voisins_(face,1) == -1) )
701 {
702 int faassociee = la_front_dis.num_face(la_cl_period.face_associee(ind_face));
703 if (ind_face<nbr_faces_bord)
704 {
705 assert(faassociee>=num_premiere_face);
706 assert(faassociee<num_derniere_face);
707 }
708
709 elem1 = face_voisins_(face,0);
710 elem2 = face_voisins_(faassociee,0);
711 vol = (volumes_[elem1] + volumes_[elem2])/nb_faces_elem;
712 volumes_entrelaces_[face] = vol;
713 volumes_entrelaces_[faassociee] = vol;
714 face_voisins_(face,1) = elem2;
715 face_voisins_(faassociee,0) = elem1;
716 face_voisins_(faassociee,1) = elem2;
717 psc = 0;
718 for (k=0; k<dimension; k++)
719 {
720 C1C2[k] = xv_(face,k) - xp_(face_voisins_(face,0),k);
721 psc += face_normales_(face,k)*C1C2[k];
722 }
723
724 if (psc < 0)
725 for (k=0; k<dimension; k++)
726 face_normales_(face,k) *= -1;
727
728 for (k=0; k<dimension; k++)
729 face_normales_(faassociee,k) = face_normales_(face,k);
730 }
731 }
732 }
733 }
734
735 // PQ: 10/10/05: since periodic faces have a double contribution,
736 // the call to marquer_faces_double_contrib is made in this method
737 // in order to have access to conds_lim.
739}
740
class Cond_lim_base Base class for the hierarchy of classes that represent the different boundary con...
virtual Frontiere_dis_base & frontiere_dis()
Returns the discretized boundary to which the boundary conditions apply.
class Conds_lim This class represents a vector of boundary conditions.
Definition Conds_lim.h:32
int nb_som_elem() const
Returns the number of vertices of the geometric elements that make up the domain.
Definition Domaine.h:474
int_t nb_elem_tot() const
Definition Domaine.h:132
virtual void creer_tableau_elements(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
Creates a parallel array of values at elements.
Definition Domaine.cpp:850
IntTab_t & les_elems()
Definition Domaine.h:129
int_t nb_elem() const
Definition Domaine.h:131
int nb_faces_elem(int=0) const
Returns the number of faces of type i of the geometric elements that make up the domain.
Definition Domaine.h:484
void typer(const Nom &)
Sets the element type of the domain using the name passed as parameter.
Definition Domaine.h:457
const DoubleTab_t & coord_sommets() const
Definition Domaine.h:112
virtual void creer_tableau_sommets(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
Creates an array with one "row" per mesh vertex.
Definition Domaine.cpp:999
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class Domaine_EF
Definition Domaine_EF.h:56
void calculer_volumes_sommets(const Domaine_Cl_dis_base &zcl)
void calculer_h_carre()
virtual void calculer_Bij_gen(DoubleTab &bij)
void modifier_pour_Cl(const Conds_lim &) override
void calculer_Bij()
Definition Domaine_EF.h:79
DoubleTab IPhi_thilde_
Definition Domaine_EF.h:97
void calculer_porosites_sommets()
void discretiser() override
DoubleTab IPhi_
Definition Domaine_EF.h:97
void swap(int, int, int)
virtual void verifie_compatibilite_domaine()
void calculer_volumes_entrelaces()
void typer_elem(Domaine &domaine_geom) override
virtual void calculer_IPhi(const Domaine_Cl_dis_base &zcl)
class Domaine_VF
Definition Domaine_VF.h:44
IntVect rang_elem_non_std_
Definition Domaine_VF.h:252
virtual const DoubleVect & face_surfaces() const
Definition Domaine_VF.h:51
int nb_faces() const
Returns the total number of faces.
Definition Domaine_VF.h:471
DoubleTab xp_
Definition Domaine_VF.h:218
IntTab & face_sommets() override
Returns the face/vertex connectivity array.
Definition Domaine_VF.h:590
DoubleVect volumes_entrelaces_
Definition Domaine_VF.h:210
int nb_faces_tot() const
Returns the total number of faces.
Definition Domaine_VF.h:481
void creer_tableau_faces(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
DoubleTab xv_
Definition Domaine_VF.h:219
int nb_elem_std_
Definition Domaine_VF.h:250
IntTab face_sommets_
Definition Domaine_VF.h:223
int nb_faces_std_
Definition Domaine_VF.h:251
void discretiser() override
Generates the faces and builds the boundaries.
IntTab & elem_faces()
Returns the element/face connectivity array.
Definition Domaine_VF.h:550
int nb_som_face() const
Returns the number of vertices per face.
Definition Domaine_VF.h:493
DoubleVect volumes_
Definition Domaine_VF.h:208
IntTab face_voisins_
Definition Domaine_VF.h:216
IntTab elem_faces_
Definition Domaine_VF.h:222
DoubleVect & volumes()
Definition Domaine_VF.h:119
DoubleTab face_normales_
Definition Domaine_VF.h:212
int oriente_normale(int f, int e) const
Definition Domaine_VF.h:194
int premiere_face_int() const
A face is internal if and only if it separates two elements.
Definition Domaine_VF.h:463
virtual DoubleTab & face_normales()
Definition Domaine_VF.h:48
IntTab & face_voisins() override
Returns the face-element connectivity array; see above.
Definition Domaine_VF.h:426
void marquer_faces_double_contrib(const Conds_lim &)
int nb_elem_tot() const
const Domaine & domaine() const
File for reading. This class is to the C++ ifstream class what the Entree class is to the.
Definition EFichier.h:29
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual const Milieu_base & milieu() const =0
class Front_VF
Definition Front_VF.h:36
int nb_faces() const
Definition Front_VF.h:53
int num_premiere_face() const
Definition Front_VF.h:63
int nb_faces_tot() const
Definition Front_VF.h:58
int num_face(const int) const
Definition Front_VF.h:68
DoubleVect & porosite_elem()
Definition Milieu_base.h:58
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
static int dimension
Definition Objet_U.h:94
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
static int bidim_axi
Definition Objet_U.h:97
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
class Periodique This class represents a periodic boundary condition.
Definition Periodique.h:31
int face_associee(int i) const
Definition Periodique.h:35
static Sortie & Journal(int message_level=0)
Returns a static Sortie object used as an event journal.
Definition Process.cpp:592
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469
_SIZE_ size_totale() const
Definition TRUSTVect.tpp:61
void Compute(const int idimg, const int nbnn, const int npgau, ArrOfDouble &xgau, ArrOfDouble &frgau, ArrOfDouble &dfrgau, ArrOfDouble &poigau) const