16#include <Op_Diff_VEFP1NCP1B_Face.h>
17#include <Champ_P1NC.h>
19#include <Dirichlet_homogene.h>
20#include <Periodique.h>
21#include <Neumann_paroi.h>
22#include <Neumann_homogene.h>
23#include <Neumann_sortie_libre.h>
24#include <Echange_externe_impose.h>
26#include <Champ_Uniforme.h>
29#include <TRUSTLists.h>
30#include <Champ_front_txyz.h>
31#include <Champ_Don_lu.h>
32#include <Champ_Don_Fonc_xyz.h>
33#include <Champ_Uniforme_Morceaux.h>
34#include <Porosites_champ.h>
35#include <Check_espace_virtuel.h>
36#include <Conduction.h>
44static inline double maximum(
const double x,
75 Motcle motlu, accouverte =
"{" , accfermee =
"}" ;
78 les_mots[0] =
"alphaE";
79 les_mots[1] =
"alphaS";
80 les_mots[2] =
"alphaA";
82 les_mots[4] =
"decentrage";
83 les_mots[5] =
"epsilon";
88 if (motlu!=accouverte)
90 Cerr <<
"Error in Op_Diff_VEFP1NCP1B_Face::readOn()" << finl;
91 Cerr <<
"Since version 1.5.5, the syntax of keyword P1NCP1B has changed." << finl;
92 Cerr <<
"An opening brace { is required first." << finl;
93 Cerr <<
"Optional settings go between the braces:" << finl;
94 Cerr <<
"Diffusion { P1NCP1B } -> Diffusion { P1NCB { } }" << finl;
101 while(motlu!=accfermee)
103 int rang = les_mots.search(motlu);
123 Cerr <<
"Error in Op_Diff_VEFP1NCP1B_Face::readOn()" << finl;
124 Cerr <<
"The alphaA option can only be enabled in dimension 3" << finl;
125 Cerr <<
"Exiting program" << finl;
147 Cerr <<
"Error in Op_Diff_VEFP1NCP1B_Face::readOn()" << finl;
148 Cerr <<
"Keyword " << motlu <<
" not recognised" << finl;
149 Cerr <<
"Recognised keywords are: " << les_mots << finl;
150 Cerr <<
"Exiting program" << finl;
187 Cerr <<
"\nBoundary conditions of 'Symetrie' type with P1NCP1B diffusion operator are only allowed for Conduction equation!" << finl;
188 Cerr <<
"Here you use a P1NCP1B diffusion operator in a '" <<
equation().
que_suis_je() <<
"' equation where" << finl;
189 Cerr <<
"boundary condition number " << i <<
", on boundary '" << la_cl->frontiere_dis().le_nom() <<
"' has been assigned to: '" << la_cl->que_suis_je() <<
"'." << finl;
215 const Domaine& domaine=domaine_VEF.
domaine();
219 const int nb_faces=domaine_VEF.
nb_faces();
225 DoubleTab coeffOperateur(nb_faces_tot);
230 const int nb_bords=les_cl.size();
238 double dt_stab=DMAXFLOAT;
242 modif_par_porosite_si_flag(
nu_,nu,!marq,porosite_elem);
249 domaine.creer_tableau_sommets(nu_p1);
261 for (face=0; face<nb_faces; face++)
263 coeffOperateur(face)/=volumes_entrelaces(face);
264 assert(coeffOperateur(face)>=0.);
265 coeffOperateur(face)=1./(coeffOperateur(face)+DMINFLOAT);
269 for (n_bord=0; n_bord<nb_bords; n_bord++)
280 for (ind_face=num1; ind_face<num2; ind_face++)
283 coeffOperateur(face)=1.e20;
289 for (face=0; face<nb_faces; face++)
290 if (coeffOperateur(face)<dt_stab)
291 dt_stab=coeffOperateur(face);
301 const Domaine& domaine=domaine_VEF.
domaine();
306 const DoubleVect& volumes=domaine_VEF.
volumes();
308 const IntTab& elem_faces=domaine_VEF.
elem_faces();
310 const int nb_elem_tot=domaine.nb_elem_tot();
311 const int nb_faces_elem=domaine.nb_faces_elem();
312 const int nb_bords=les_cl.size();
315 int face=0,face_loc=0;
316 int faceAss=0,faceAss_loc=0;
327 for (elem=0; elem<nb_elem_tot; elem++)
329 volume=volumes(elem);
332 for (face_loc=0; face_loc<nb_faces_elem; face_loc++)
334 face=elem_faces(elem,face_loc);
338 psc+=face_normales(face,dim)*face_normales(face,dim);
344 coeffOperateur(face)+=coeff;
348 for (n_bord=0; n_bord<nb_bords; n_bord++)
360 for (ind_face=num1; ind_face<num2; ind_face++)
364 faceAss=le_bord.
num_face(faceAss_loc);
368 coeffOperateur(faceAss)+=coeffOperateur(face);
369 coeffOperateur(face)=coeffOperateur(faceAss);
381 const int nb_faces=domaine_VEF.
nb_faces();
390 for (face=0; face<nb_faces; face++)
400 Cerr<<
"Error in Op_Diff_VEFP1NCP1B_Face::calculer_dt_stab_aretes()"<<finl;
401 Cerr<<
"Function not coded"<<finl;
412 const Domaine& domaine = domaine_VEF.
domaine();
413 const DoubleTab& face_normales = domaine_VEF.
face_normales();
414 const DoubleVect& volumes = domaine_VEF.
volumes();
415 const IntTab& elem_faces=domaine_VEF.
elem_faces();
418 const int nb_faces_elem=domaine.nb_faces_elem();
419 const int nb_elem_tot=domaine.nb_elem_tot();
420 int elem=0,face_loc=0,face=0,compi=0,compj=0;
426 for(elem=0; elem<nb_elem_tot; elem++)
427 for(face_loc=0; face_loc<nb_faces_elem; face_loc++)
429 face=elem_faces(elem,face_loc);
432 if(elem!=face_voisins(face,0)) signe=-1;
434 for(compi=0; compi<
dim_ch_; compi++)
438 face_normales(face,compj);
442 for (elem=0; elem<nb_elem_tot; elem++)
444 volume = volumes(elem);
446 for (compi=0; compi<
dim_ch_; compi++)
465 const Domaine& domaine = domaine_VEF.
domaine();
466 const Domaine& dom=domaine;
470 const int nb_faces_elem=domaine.nb_faces_elem();
473 const int nb_som=domaine_VEF.
nb_som();
474 const int nb_som_tot=domaine_VEF.
nb_som_tot();
475 const int nb_bords =les_cl.size();
476 int elem=0,face_loc=0,som_loc=0,face=0;
477 int compi=0,compj=0,som=0,num1=0,num2=0;
484 const DoubleTab& face_normales = domaine_VEF.
face_normales();
495 const IntTab& som_elem=domaine.les_elems();
496 const IntTab& elem_faces=domaine_VEF.
elem_faces();
502 for(elem=0; elem<nb_elem_tot; elem++)
505 for(face_loc=0; face_loc<nb_faces_elem; face_loc++)
507 face = elem_faces(elem,face_loc);
509 for(compi=0; compi<
dim_ch_; compi++)
510 sigma[compi]+=inconnue[face*
dim_ch_+compi];
513 for(face_loc=0; face_loc<nb_faces_elem; face_loc++)
516 face = elem_faces(elem,face_loc);
519 if(elem!=face_voisins(face,0)) signe=-1;
521 for(compi=0; compi<
dim_ch_; compi++)
523 secmem(som,compi,compj)+=coeff_som*signe*
524 sigma[compi]*face_normales(face,compj);
532 for (n_bord=0; n_bord<nb_bords; n_bord++)
544 else if (sub_type(
Dirichlet,la_cl.valeur()))
549 double x=0.,y=0.,z=0.;
550 double inconnue_pt=0.;
560 for (ind_face=num1; ind_face<num2; ind_face++)
564 for(som_loc=0; som_loc<nb_som_face; som_loc++)
572 x=coord_sommets(som,0);
573 y=coord_sommets(som,1);
576 for (compi=0; compi<
dim_ch_; compi++)
582 secmem(som,compi,compj) +=
583 1./6*(2*inconnue[face*
dim_ch_+compi]+inconnue_pt)
584 *face_normales(face,compj) ;
593 int som2=face_sommets(face,(som_loc+i)%nb_som_face);
597 x=(coord_sommets(som,0)+coord_sommets(som2,0))/2.;
598 y=(coord_sommets(som,1)+coord_sommets(som2,1))/2.;
599 z=(coord_sommets(som,2)+coord_sommets(som2,2))/2.;
602 for (compi=0; compi<
dim_ch_; compi++)
608 secmem(som, compi, compj) += 1./
dimension*
609 1/2.*inconnue_pt*face_normales(face,compj) ;
621 for (ind_face=num1; ind_face<num2; ind_face++)
625 for(som_loc=0; som_loc<nb_som_face; som_loc++)
629 for (compi=0; compi<
dim_ch_; compi++)
632 inconnue[face*
dim_ch_+compi]*face_normales(face,compj) ;
641 else if (!sub_type(
Periodique,la_cl.valeur()))
643 for (ind_face=num1; ind_face<num2; ind_face++)
647 for(som_loc=0; som_loc<nb_som_face; som_loc++)
651 for (compi=0; compi<
dim_ch_; compi++)
654 inconnue[face*
dim_ch_+compi]*face_normales(face,compj) ;
668 for (compi=0; compi<
dim_ch_; compi++)
671 for(i=0; i<nb_som_tot; i++)
674 secmemij(som)=secmem(som,compi,compj);
678 for(i=0; i<nb_som; i++)
681 gradij(som)=secmemij(som)/(
coeff_*volume_aux_sommets(som));
684 for(i=0; i<nb_som_tot; i++)
707 DoubleVect& div)
const
715 const int nb_bords =les_cl.size();
716 int n_bord=0, num1=0, num2=0;
717 int face=0, face_asso_loc=0, face_associee=0;
718 int ind_face=0, comp=0;
722 for (n_bord=0; n_bord<nb_bords; n_bord++)
736 for (ind_face=num1; ind_face<num2; ind_face++)
740 face_associee=le_bord.
num_face(face_asso_loc);
742 if (face<face_associee)
743 for (comp=0; comp<
dim_ch_; comp++)
758 for (ind_face=num1; ind_face<num2; ind_face++)
762 assert(face_voisins(face,0)!=-1);
764 for (comp=0; comp<
dim_ch_; comp++)
779 for (ind_face=num1; ind_face<num2; ind_face++)
783 for (comp=0; comp<
dim_ch_; comp++)
785 flux=la_cl_paroi.
h_imp(ind_face,comp)
787 flux*=(la_cl_paroi.
T_ext(ind_face,comp)-inconnue[face*
dim_ch_+comp]);
805 const DoubleTab& face_normales = domaine_VEF.
face_normales();
807 const IntTab& elem_faces=domaine_VEF.
elem_faces();
812 int elem=0,face_loc=0,face=0,compi=0,compj=0;
816 for(elem=0; elem<nb_elem_tot; elem++)
817 for(face_loc=0; face_loc<nb_faces_elem; face_loc++)
819 face=elem_faces(elem,face_loc);
822 if(elem!=face_voisins(face,0)) signe=-1.;
824 for(compi=0; compi<
dim_ch_; compi++)
828 *signe*face_normales(face,compj);
840 const Domaine& domaine = domaine_VEF.
domaine();
841 const Domaine& dom=domaine;
843 const DoubleTab& face_normales = domaine_VEF.
face_normales();
846 const IntTab& som_elem=domaine.les_elems();
847 const IntTab& elem_faces=domaine_VEF.
elem_faces();
850 const int nb_faces_elem=domaine.nb_faces_elem();
853 int elem=0,face_loc=0,face_loc2=0,face=0;
854 int compi=0,compj=0,som=0,ind_face=0;
855 int num1=0, num2=0,som_loc=0;
861 for(elem=0; elem<nb_elem_tot; elem++)
862 for(face_loc=0; face_loc<nb_faces_elem; face_loc++)
865 face=elem_faces(elem,face_loc);
868 if(elem!=face_voisins(face,0)) signe=-1;
871 sigma[compj]=signe*face_normales(face,compj);
873 for(face_loc2=0; face_loc2<nb_faces_elem; face_loc2++)
874 for(compi=0; compi<
dim_ch_; compi++)
876 div[elem_faces(elem,face_loc2)*
dim_ch_+compi]-=
883 const IntTab& face_sommets = domaine_VEF.
face_sommets();
884 const int nb_bords =les_cl.size();
888 for (
int n_bord=0; n_bord<nb_bords; n_bord++)
895 if (sub_type(
Neumann,la_cl.valeur()) ||
901 for (ind_face=num1; ind_face<num2; ind_face++)
907 elem=face_voisins(face,0);
913 for (som_loc=0; som_loc<nb_som_face; som_loc++)
917 for(compi=0; compi<
dim_ch_; compi++)
919 gradient_bord(compi,compj)+=
926 for(compi=0; compi<
dim_ch_; compi++)
929 gradient_bord(compi,compj)
930 *face_normales(face,compj);
975ajouter(
const DoubleTab& inconnue, DoubleTab& resu)
const
978 const Domaine& domaine=domaine_VEF.
domaine();
990 DoubleTab nu,nu_p1,nu_pA;
991 modif_par_porosite_si_flag(
nu_,nu,!marq,porosite_elem);
994 modif_par_porosite_si_flag(inconnue,inconnue1,marq,porosite_face);
996 const DoubleVect& inconnue2 = inconnue1;
997 DoubleVect& resu2 = resu;
998 DoubleVect resu3(resu2);
1015 nu_pA.
resize(nb_aretes_tot);
1036 domaine.creer_tableau_sommets(nu_p1);
1056calculer(
const DoubleTab& inconnue, DoubleTab& resu)
const
1059 return ajouter(inconnue,resu);
1065 tab_multiply_any_shape(grad, nu);
1112 int n_bord=0,ind_face=0;
1114 int compi=0,compj=0;
1119 double coeff_conv=1.;
1122 for (n_bord=0; n_bord<nb_bords; n_bord++)
1135 for (ind_face=num1; ind_face<num2; ind_face++)
1140 for (compi=0; compi<
dim_ch_; compi++)
1151 for (ind_face=num1; ind_face<num2; ind_face++)
1156 for (compi=0; compi<
dim_ch_; compi++)
1158 Text=la_cl_paroi.
T_ext(ind_face,compi);
1160 flux_bords_(face,compi)=coeff_conv*la_cl_paroi.
h_imp(ind_face,compi)*surface;
1170 for (ind_face=num1; ind_face<num2; ind_face++)
1174 for (compi=0; compi<
dim_ch_; compi++)
1180 for (ind_face=num1; ind_face<num2; ind_face++)
1183 elem=face_voisins(face,0);
1187 for (compi=0; compi<
dim_ch_; compi++)
1190 *face_normales(face,compj);
1201 const Domaine& domaine = domaine_VEF.
domaine();
1202 const Domaine& dom=domaine;
1212 int som=0,som_loc=0;
1213 int n_bord=0,ind_face=0;
1215 int compi=0,compj=0;
1219 double coeff_conv=1.;
1222 for (n_bord=0; n_bord<nb_bords; n_bord++)
1235 for (ind_face=num1; ind_face<num2; ind_face++)
1240 for (compi=0; compi<
dim_ch_; compi++)
1251 for (ind_face=num1; ind_face<num2; ind_face++)
1256 for (compi=0; compi<
dim_ch_; compi++)
1258 Text=la_cl_paroi.
T_ext(ind_face,compi);
1260 flux_bords_(face,compi)=coeff_conv*la_cl_paroi.
h_imp(ind_face,compi)*surface;
1270 for (ind_face=num1; ind_face<num2; ind_face++)
1274 for (compi=0; compi<
dim_ch_; compi++)
1280 for (ind_face=num1; ind_face<num2; ind_face++)
1285 for (som_loc=0; som_loc<nb_som_face; som_loc++)
1287 som=face_sommets(face,som_loc);
1290 for (compi=0; compi<
dim_ch_; compi++)
1293 face_normales(face,compj);
1296 for (compi=0; compi<
dim_ch_; compi++)
1306 Cerr<<
"Op_Dift_VEF_P1NCP1B_Face::calculer_flux_bords_aretes() not coded"<<finl;
1320 const Domaine_VEF& domaine_VEF = le_dom_vef.valeur();
1321 const IntTab& elem_faces = domaine_VEF.
elem_faces();
1322 const IntTab& face_voisins = domaine_VEF.
face_voisins();
1325 int nb_faces=domaine_VEF.
nb_faces();
1337 for (
int n_bord=0; n_bord<nb_bords; n_bord++)
1342 int num2 = num1 + le_bord.
nb_faces();
1348 for (num_face=num1; num_face<num2; num_face++)
1350 elem1 = face_voisins(num_face,0);
1359 while ((fac_loc<nb_faces_elem) && (elem_faces(elem1,fac_loc)!=num_face)) fac_loc++;
1360 if (fac_loc==nb_faces_elem) ok=0;
1362 for (i=0; i<nb_faces_elem; i++)
1363 if ( ( (j= elem_faces(elem1,i)) > num_face ) && (j != fac_asso ) )
1365 val =
viscA(num_face,j,elem1,nu(elem1));
1371 for (
int nc=0; nc<nb_comp; nc++)
1373 int n0=num_face*nb_comp+nc;
1374 int j0=j*nb_comp+nc;
1376 matrice(n0,n0)+=val*porosite_face(num_face)*coeff;
1377 matrice(n0,j0)-=val*porosite_face(j)*coeff;
1379 if (!ok) n0=fac_asso*nb_comp+nc;
1382 matrice(j0,n0)-=val*porosite_face((n0-nc)/nb_comp)*coeff;
1383 matrice(j0,j0)+=val*porosite_face(j)*coeff;
1390 elem2 = face_voisins(num_face,1);
1392 for (i=0; i<nb_faces_elem; i++)
1393 if ( ( (j= elem_faces(elem2,i)) > num_face ) && (j != fac_asso ) )
1395 val =
viscA(num_face,j,elem2,nu(elem2));
1397 for (
int nc=0; nc<nb_comp; nc++)
1399 int n0=num_face*nb_comp+nc;
1400 int j0=j*nb_comp+nc;
1402 matrice(n0,n0)+=val*porosite_face(num_face)*coeff;
1403 matrice(n0,j0)-=val*porosite_face(j)*coeff;
1411 for (num_face=num1; num_face<num2; num_face++)
1413 elem1 = face_voisins(num_face,0);
1415 for (i=0; i<nb_faces_elem; i++)
1416 if ( (j= elem_faces(elem1,i)) > num_face )
1418 val =
viscA(num_face,j,elem1,nu(elem1));
1419 for (
int nc=0; nc<nb_comp; nc++)
1421 int n0=num_face*nb_comp+nc;
1422 int j0=j*nb_comp+nc;
1424 matrice(n0,n0)+=val*porosite_face(num_face)*coeff;
1425 matrice(n0,j0)-=val*porosite_face(j)*coeff;
1428 matrice(j0,n0)-=val*porosite_face(num_face)*coeff;
1429 matrice(j0,j0)+=val*porosite_face(j)*coeff;
1441 elem1 = face_voisins(num_face,0);
1442 elem2 = face_voisins(num_face,1);
1444 for (i=0; i<nb_faces_elem; i++)
1446 if ( (j=elem_faces(elem1,i)) > num_face )
1448 val =
viscA(num_face,j,elem1,nu(elem1));
1449 for (
int nc=0; nc<nb_comp; nc++)
1451 int n0=num_face*nb_comp+nc;
1452 int j0=j*nb_comp+nc;
1454 matrice(n0,n0)+=val*porosite_face(num_face)*coeff;
1455 matrice(n0,j0)-=val*porosite_face(j)*coeff;
1458 matrice(j0,n0)-=val*porosite_face(num_face)*coeff;
1459 matrice(j0,j0)+=val*porosite_face(j)*coeff;
1465 if ( (j=elem_faces(elem2,i)) > num_face )
1467 val=
viscA(num_face,j,elem2,nu(elem2));
1468 for (
int nc=0; nc<nb_comp; nc++)
1470 int n0=num_face*nb_comp+nc;
1471 int j0=j*nb_comp+nc;
1473 matrice(n0,n0)+=val*porosite_face(num_face)*coeff;
1474 matrice(n0,j0)-=val*porosite_face(j)*coeff;
1477 matrice(j0,n0)-=val*porosite_face(num_face)*coeff;
1478 matrice(j0,j0)+=val*porosite_face(j)*coeff;
1500 const int nb_faces=domaine_VEF.
nb_faces();
1509 DoubleTab coeff_perio(nb_faces_tot);
1511 for (n_bord=0; n_bord<nb_bords; n_bord++)
1519 for (ind_face=num1; ind_face<num2; ind_face++)
1522 coeff_perio(face)=0.5;
1536 for (face=premiere_face_int; face<nb_faces; face++)
1539 gradient0,gradient1,
1540 porosite_face,nu_som,
1541 coeff_perio,matrice);
1544 for (n_bord=0; n_bord<nb_bords; n_bord++)
1556 for (ind_face=num1; ind_face<num2; ind_face++)
1563 gradient0,gradient1,
1564 porosite_face,nu_som,
1565 coeff_perio,matrice);
1569 else if (sub_type(
Symetrie,la_cl.valeur()))
1570 for (ind_face=num1; ind_face<num2; ind_face++)
1575 gradient0,gradient1,
1576 porosite_face,nu_som,
1577 coeff_perio,matrice);
1581 for (ind_face=num1; ind_face<num2; ind_face++)
1586 gradient0,gradient1,
1587 porosite_face,nu_som,
1588 coeff_perio,matrice);
1602 DoubleTab& gradient0, DoubleTab& gradient1,
1603 const DoubleVect& porosite_face,
const DoubleTab& nu_som,
1608 const auto& tab1=matrice.
get_tab1();
1609 const auto& tab2=matrice.
get_tab2();
1613 const int nb_faces=domaine_VEF.
nb_faces();
1616 int face2=0,face2_C=0;
1617 int som_loc=0,som=0;
1618 int som_loc0=0,som_loc1=0;
1619 int compi=0,compj=0;
1620 int elem0=0,elem1=0;
1624 double coeff_som=0.,coeff_mat=0.;
1625 double coeff_diff=0.;
1629 double coeff_conv=1.;
1633 assert(gradient0.
nb_dim()==2);
1636 assert(gradient1.
nb_dim()==1);
1651 for (som_loc=0; som_loc<nnz; som_loc++)
1653 som=liste_som(som_loc);
1654 coeff_som=volume_aux_sommets(som)*
coeff_;
1658 psc+=gradient0(compj,som_loc)
1659 *gradient0(compj,som_loc);
1666 coeff_mat*=coeff_conv;
1668 for (compi=0; compi<
dim_ch_; compi++)
1671 matrice(face_C,face_C)+=coeff_mat;
1680 auto debut=tab1[face_C]-1;
1681 auto size=tab1[face_C+1]-tab1[face_C];
1683 for (i=1; i<size; i++)
1685 face2_C=tab2[debut+i]-1;
1691 for (som_loc=0; som_loc<nnz; som_loc++)
1693 som=liste_som(som_loc);
1694 coeff_som=volume_aux_sommets(som)*
coeff_;
1695 isInStencil(face2,som,elem0,som_loc0,elem1,som_loc1);
1699 assert(som_loc0!=-1);
1701 gradient_som(face2,som,elem0,som_loc0,elem1,som_loc1,gradient1);
1705 psc+=gradient0(compj,som_loc)
1713 coeff_mat*=coeff_conv;
1714 coeff_diff=-1.*delta*maximum(0.,coeff_mat);
1715 coeff_mat+=coeff_diff;
1717 for (compi=0; compi<
dim_ch_; compi++)
1722 matrice(face_C,face2_C)+=coeff_mat*coeff_perio(face2);
1723 matrice(face_C,face_C)-=coeff_diff*coeff_perio(face2);
1726 matrice(face2_C,face_C)+=coeff_mat;
1727 matrice(face2_C,face2_C)-=coeff_diff;
1738 DoubleTab& gradient0, DoubleTab& gradient1,
1739 const DoubleVect& porosite_face,
const DoubleTab& nu_som,
1744 const auto& tab1=matrice.
get_tab1();
1745 const auto& tab2=matrice.
get_tab2();
1749 const int nb_faces=domaine_VEF.
nb_faces();
1752 int face2=0,face2_C=0;
1753 int som_loc=0,som=0;
1754 int som_loc0=0,som_loc1=0;
1755 int compi=0,compj=0;
1756 int elem0=0,elem1=0;
1760 double coeff_som=0.,coeff_mat=0.;
1761 double coeff_diff=0.;
1765 double coeff_conv=1.;
1769 assert(gradient0.
nb_dim()==2);
1772 assert(gradient1.
nb_dim()==1);
1787 for (som_loc=0; som_loc<nnz; som_loc++)
1789 som=liste_som(som_loc);
1790 coeff_som=volume_aux_sommets(som)*
coeff_;
1794 psc+=gradient0(compj,som_loc)
1795 *gradient0(compj,som_loc);
1802 coeff_mat*=coeff_conv;
1804 for (compi=0; compi<
dim_ch_; compi++)
1807 matrice(face_C,face_C)+=coeff_mat;
1816 auto debut=tab1[face_C]-1;
1817 auto size=tab1[face_C+1]-tab1[face_C];
1819 for (i=1; i<size; i++)
1821 face2_C=tab2[debut+i]-1;
1827 for (som_loc=0; som_loc<nnz; som_loc++)
1829 som=liste_som(som_loc);
1830 coeff_som=volume_aux_sommets(som)*
coeff_;
1831 isInStencil(face2,som,elem0,som_loc0,elem1,som_loc1);
1835 assert(som_loc0!=-1);
1837 gradient_som(face2,som,elem0,som_loc0,elem1,som_loc1,gradient1);
1841 psc+=gradient0(compj,som_loc)
1849 coeff_mat*=coeff_conv;
1850 coeff_diff=-1.*delta*maximum(0.,coeff_mat);
1851 coeff_mat+=coeff_diff;
1853 for (compi=0; compi<
dim_ch_; compi++)
1858 matrice(face_C,face2_C)+=coeff_mat*coeff_perio(face2);
1859 matrice(face_C,face_C)-=coeff_diff*coeff_perio(face2);
1862 matrice(face2_C,face_C)+=coeff_mat;
1863 matrice(face2_C,face2_C)-=coeff_diff;
1874 DoubleTab& gradient0, DoubleTab& gradient1,
1875 const DoubleVect& porosite_face,
const DoubleTab& nu_som,
1880 const auto& tab1=matrice.
get_tab1();
1881 const auto& tab2=matrice.
get_tab2();
1885 const int nb_faces=domaine_VEF.
nb_faces();
1888 int face2=0,face2_C=0;
1889 int som_loc=0,som=0;
1890 int som_loc0=0,som_loc1=0;
1891 int compi=0,compj=0;
1892 int elem0=0,elem1=0;
1896 double coeff_som=0.,coeff_mat=0.;
1897 double coeff_diff=0.;
1901 double coeff_conv=1.;
1905 assert(gradient0.
nb_dim()==2);
1908 assert(gradient1.
nb_dim()==1);
1923 for (som_loc=0; som_loc<nnz; som_loc++)
1925 som=liste_som(som_loc);
1926 coeff_som=volume_aux_sommets(som)*
coeff_;
1930 psc+=gradient0(compj,som_loc)
1931 *gradient0(compj,som_loc);
1938 coeff_mat*=coeff_conv;
1940 for (compi=0; compi<
dim_ch_; compi++)
1943 matrice(face_C,face_C)+=coeff_mat;
1955 auto debut=tab1[face_C]-1;
1956 auto size=tab1[face_C+1]-tab1[face_C];
1959 for (i=1; i<size; i++)
1961 face2_C=tab2[debut+i]-1;
1967 for (som_loc=0; som_loc<nnz; som_loc++)
1969 som=liste_som(som_loc);
1970 coeff_som=volume_aux_sommets(som)*
coeff_;
1971 isInStencil(face2,som,elem0,som_loc0,elem1,som_loc1);
1975 assert(som_loc0!=-1);
1977 gradient_som(face2,som,elem0,som_loc0,elem1,som_loc1,gradient1);
1981 psc+=gradient0(compj,som_loc)
1989 coeff_mat*=coeff_conv;
1990 coeff_diff=-1.*delta*maximum(0.,coeff_mat);
1991 coeff_mat+=coeff_diff;
1993 for (compi=0; compi<
dim_ch_; compi++)
1998 matrice(face_C,face2_C)+=coeff_mat*coeff_perio(face2);
1999 matrice(face_C,face_C)-=coeff_diff*coeff_perio(face2);
2002 matrice(face2_C,face_C)+=coeff_mat;
2003 matrice(face2_C,face2_C)-=coeff_diff;
2013 DoubleTab& gradient0, DoubleTab& gradient1,
2014 const DoubleVect& porosite_face,
const DoubleTab& nu_som,
2019 const auto& tab1=matrice.
get_tab1();
2020 const auto& tab2=matrice.
get_tab2();
2024 const int nb_faces=domaine_VEF.
nb_faces();
2027 int face2=0,face2_C=0;
2028 int som_loc=0,som=0;
2029 int som_loc0=0,som_loc1=0;
2030 int compi=0,compj=0;
2031 int elem0=0,elem1=0;
2035 double coeff_som=0.,coeff_mat=0.;
2036 double coeff_diff=0.;
2040 double coeff_conv=1.;
2044 assert(gradient0.
nb_dim()==2);
2047 assert(gradient1.
nb_dim()==1);
2062 for (som_loc=0; som_loc<nnz; som_loc++)
2064 som=liste_som(som_loc);
2065 coeff_som=volume_aux_sommets(som)*
coeff_;
2069 psc+=gradient0(compj,som_loc)
2070 *gradient0(compj,som_loc);
2077 coeff_mat*=coeff_conv;
2079 for (compi=0; compi<
dim_ch_; compi++)
2082 matrice(face_C,face_C)+=coeff_mat;
2091 auto debut=tab1[face_C]-1;
2092 auto size=tab1[face_C+1]-tab1[face_C];
2094 for (i=1; i<size; i++)
2096 face2_C=tab2[debut+i]-1;
2102 for (som_loc=0; som_loc<nnz; som_loc++)
2104 som=liste_som(som_loc);
2105 coeff_som=volume_aux_sommets(som)*
coeff_;
2106 isInStencil(face2,som,elem0,som_loc0,elem1,som_loc1);
2110 assert(som_loc0!=-1);
2112 gradient_som(face2,som,elem0,som_loc0,elem1,som_loc1,gradient1);
2116 psc+=gradient0(compj,som_loc)
2124 coeff_mat*=coeff_conv;
2125 coeff_diff=-1.*delta*maximum(0.,coeff_mat);
2126 coeff_mat+=coeff_diff;
2128 for (compi=0; compi<
dim_ch_; compi++)
2133 matrice(face_C,face2_C)+=coeff_mat*coeff_perio(face2);
2134 matrice(face_C,face_C)-=coeff_diff*coeff_perio(face2);
2137 matrice(face2_C,face_C)+=coeff_mat*coeff_perio(face);
2138 matrice(face2_C,face2_C)-=coeff_diff*coeff_perio(face);
2149 const Domaine& domaine=domaine_VEF.
domaine();
2156 DoubleVect porosite_face(
equation().milieu().porosite_face());
2157 if (!marq) porosite_face=1.;
2160 DoubleTab nu,nu_p1,nu_pA;
2162 modif_par_porosite_si_flag(
nu_,nu,!marq,porosite_elem);
2169 domaine.creer_tableau_sommets(nu_p1);
2194remplir_nu_p1(
const DoubleTab& nu_elem,DoubleTab& nu_p1)
const
2197 const Domaine& domaine=domaine_VEF.
domaine();
2198 const Domaine& dom=domaine;
2200 const int nb_som = dom.
nb_som();
2201 const int nb_elem_tot=domaine.nb_elem_tot();
2202 const int nb_som_elem=domaine.nb_som_elem();
2205 int som_loc=0,som=0;
2207 const IntTab& elem_som=domaine.les_elems();
2209 ArrOfInt nb_elem_per_som(nb_som);
2211 assert(nu_elem.
get_md_vector() == domaine.md_vector_elements());
2214 assert_espace_virtuel_vect(nu_elem);
2220 for (elem=0; elem<nb_elem_tot; elem++)
2222 const double nu = nu_elem[elem];
2223 for (som_loc=0; som_loc<nb_som_elem; som_loc++)
2225 som=elem_som(elem,som_loc);
2232 nb_elem_per_som[som]++;
2237 for (som = 0; som < nb_som; som++)
2240 int nvoisins = nb_elem_per_som[som_perio];
2245 nu_p1(som_perio) /= nvoisins;
2246 nb_elem_per_som[som_perio] = 0;
2248 if (som != som_perio)
2249 nu_p1(som) = nu_p1(som_perio);
2273remplir_nu_pA(
const DoubleTab& nu_elem,DoubleTab& nu_pA)
const
2275 Cerr <<
"Op_Diff_VEFP1NCP1B_Face::remplir_nu_pA() not coded" << finl;
2276 Cerr <<
"Exit" << finl;
2290 const Domaine& domaine = domaine_VEF.
domaine();
2291 const Domaine& dom=domaine;
2294 const IntTab& som_elem=domaine.
les_elems();
2295 const IntTab& elem_faces=domaine_VEF.
elem_faces();
2301 const int nb_som_elem=domaine.nb_som_elem();
2303 const int nb_faces_elem=domaine.nb_faces_elem();
2308 int elem=0,elem_loc=0;
2309 int som=0,som_loc=0;
2311 int n_bord=0,ind_face=0;
2315 IntTab faces_perio(nb_faces_tot);
2316 ArrOfBit fait(nb_faces_tot);
2317 IntLists sommets_faces(nb_som_tot);
2321 for (face=0; face<nb_faces_tot; face++)
2322 faces_perio(face)=face;
2324 for (n_bord=0; n_bord<nb_bords; n_bord++)
2337 for (ind_face=num1; ind_face<num2; ind_face++)
2349 faces_perio(face)=faceAss;
2350 faces_perio(faceAss)=face;
2357 for (elem=0; elem<nb_elem_tot; elem++)
2358 for (som_loc=0; som_loc<nb_som_elem; som_loc++)
2360 som=som_elem(elem,som_loc);
2363 for (face_loc=0; face_loc<nb_faces_elem; face_loc++)
2365 face=elem_faces(elem,face_loc);
2367 sommets_faces[som].add(face);
2368 if (faces_perio(face)!=face)
2369 sommets_faces[som].add(faces_perio(face));
2378 for (n_bord=0; n_bord<nb_bords; n_bord++)
2391 for (ind_face=num1; ind_face<num2; ind_face++)
2407 size=liste[face].
size();
2408 for (i=0; i<size; i++)
2409 fait.
setbit(liste[face][i]);
2416 liste[face][0]=face;
2417 liste[face].add(tmp);
2418 tmp=liste[faceAss][0];
2419 liste[faceAss][0]=faceAss;
2420 liste[faceAss].add(tmp);
2424 liste[face].add(face);
2425 liste[faceAss].add(faceAss);
2432 for (elem_loc=0; elem_loc<2; elem_loc++)
2434 elem=face_voisins(face,elem_loc);
2437 for (som_loc=0; som_loc<nb_som_elem; som_loc++)
2439 som=som_elem(elem,som_loc);
2442 size=sommets_faces[som].
size();
2443 for (i=0; i<size; i++)
2445 face2=sommets_faces[som][i];
2450 liste[face].add(face2);
2451 liste[faceAss].add(face2);
2452 liste[face2].add(face);
2453 liste[face2].add(faceAss);
2466 for (n_bord=0; n_bord<nb_bords; n_bord++)
2475 for (ind_face=num1; ind_face<num2; ind_face++)
2483 size=liste[face].
size();
2484 for (i=0; i<size; i++)
2485 fait.
setbit(liste[face][i]);
2492 liste[face][0]=face;
2493 liste[face].add(tmp);
2496 liste[face].add(face);
2501 elem=face_voisins(face,0);
2504 for (som_loc=0; som_loc<nb_som_elem; som_loc++)
2506 som=som_elem(elem,som_loc);
2509 size=sommets_faces[som].
size();
2510 for (i=0; i<size; i++)
2512 face2=sommets_faces[som][i];
2517 liste[face].add(face2);
2526 for (face=firstFaceInt; face<nb_faces_tot; face++)
2533 size=liste[face].
size();
2534 for (i=0; i<size; i++)
2535 fait.
setbit(liste[face][i]);
2542 liste[face][0]=face;
2543 liste[face].add(tmp);
2546 liste[face].add(face);
2551 for (elem_loc=0; elem_loc<2; elem_loc++)
2553 elem=face_voisins(face,elem_loc);
2556 for (som_loc=0; som_loc<nb_som_elem; som_loc++)
2558 som=som_elem(elem,som_loc);
2561 size=sommets_faces[som].
size();
2562 for (i=0; i<size; i++)
2564 face2=sommets_faces[som][i];
2569 liste[face].add(face2);
2600 const int elem0,
const int som_loc0,
2601 const int elem1,
const int som_loc1,
2602 DoubleTab& grad)
const
2609 const IntTab& elem_faces=domaine_VEF.
elem_faces();
2613 const double coeff_som=coeff/(
dimension+1);
2615 int face_opp=0,compj=0;
2619 assert(grad.
nb_dim()==1);
2627 assert(som_loc0!=-1);
2630 face_opp = elem_faces(elem0,som_loc0);
2632 if(elem0!=face_voisins(face_opp,0)) signe=-1.;
2635 grad(compj)=coeff_som*signe*
2636 face_normales(face_opp,compj);
2647 assert(som_loc1==-1);
2648 elem=face_voisins(face,1);
2649 assert(face_voisins(face,0)!=-1);
2652 if (elem==-1 && face_opp!=face)
2654 grad(compj)+=coeff*face_normales(face,compj) ;
2658 assert(som_loc1!=-1);
2659 face_opp=elem_faces(elem1,som_loc1);
2661 if(elem1!=face_voisins(face_opp,0)) signe=-1.;
2665 grad(compj)+=coeff_som*signe*
2666 face_normales(face_opp,compj);
2669 grad/=(
coeff_*volume_aux_sommets(som_glob));
2685gradient_som(
const int face,
int& nnz, IntVect& som_glob,DoubleTab& grad)
const
2688 const Domaine& domaine=domaine_VEF.
domaine();
2689 const Domaine& dom=domaine;
2694 const IntTab& elem_faces=domaine_VEF.
elem_faces();
2696 const IntTab& elem_som=domaine.les_elems();
2699 const double coeff_som=coeff/(
dimension+1);
2701 const int nb_som_elem=domaine.nb_som_elem();
2703 int face_opp=0,compj=0;
2704 int som_loc=0,som=0;
2712 assert(grad.
nb_dim()==2);
2721 elem=face_voisins(face,0);
2724 for (som_loc=0; som_loc<nb_som_elem; som_loc++)
2726 som=elem_som(elem,som_loc);
2729 face_opp=elem_faces(elem,som_loc);
2731 if(elem!=face_voisins(face_opp,0)) signe=-1.;
2734 som_glob(som_loc)=som;
2739 grad(compj,som_loc)=coeff_som*signe*
2740 face_normales(face_opp,compj);
2742 assert(nnz==nb_som_elem);
2745 elem=face_voisins(face,1);
2748 for (som_loc=0; som_loc<nb_som_elem; som_loc++)
2750 som=elem_som(elem,som_loc);
2753 face_opp=elem_faces(elem,som_loc);
2755 if(elem!=face_voisins(face_opp,0)) signe=-1.;
2758 for (loc=0; loc<nnz; loc++)
2759 if (som_glob[loc]==som)
2771 grad(compj,loc)+=coeff_som*signe*
2772 face_normales(face_opp,compj);
2776 for (som_loc=0; som_loc<nnz; som_loc++)
2778 som=som_glob(som_loc);
2779 volume=
coeff_*volume_aux_sommets(som);
2783 grad(compj,som_loc)/=volume;
2800gradient_som_CL(
const int face,
int& nnz, IntVect& som_glob,DoubleTab& grad)
const
2803 const Domaine& domaine=domaine_VEF.
domaine();
2804 const Domaine& dom=domaine;
2809 const IntTab& elem_faces=domaine_VEF.
elem_faces();
2811 const IntTab& elem_som=domaine.les_elems();
2815 const double coeff_som=coeff/(
dimension+1);
2817 const int nb_som_elem=domaine.nb_som_elem();
2820 int face_opp=0,compj=0;
2821 int som_loc=0,som=0;
2829 assert(grad.
nb_dim()==2);
2838 elem=face_voisins(face,0);
2841 for (som_loc=0; som_loc<nb_som_elem; som_loc++)
2843 som=elem_som(elem,som_loc);
2846 face_opp=elem_faces(elem,som_loc);
2848 if(elem!=face_voisins(face_opp,0)) signe=-1.;
2851 som_glob(som_loc)=som;
2856 grad(compj,som_loc)=coeff_som*signe*
2857 face_normales(face_opp,compj);
2859 assert(nnz==nb_som_elem);
2862 assert(face_voisins(face,1)==-1);
2864 for (som_loc=0; som_loc<nb_som_face; som_loc++)
2866 som=face_sommets(face,som_loc);
2869 for (loc=0; loc<nnz; loc++)
2870 if (som_glob(loc)==som)
2872 assert(som_loc<nnz);
2875 grad(compj,loc)+=coeff*face_normales(face,compj) ;
2879 for (som_loc=0; som_loc<nnz; som_loc++)
2881 som=som_glob(som_loc);
2882 volume=
coeff_*volume_aux_sommets(som);
2886 grad(compj,som_loc)/=volume;
2902 int& elem0,
int& som_loc0,
2903 int& elem1,
int& som_loc1)
const
2906 const Domaine& domaine=domaine_VEF.
domaine();
2907 const Domaine& dom=domaine;
2910 const IntTab& elem_som=domaine.les_elems();
2912 const int nb_som_elem=domaine.nb_som_elem();
2914 int elem00=0,elem11=0;
2915 int som_loc=0,som=0;
2917 elem00=face_voisins(face,0);
2920 for (som_loc=0; som_loc<nb_som_elem; som_loc++)
2922 som=elem_som(elem00,som_loc);
2932 if (som_loc==nb_som_elem)
2938 elem11=face_voisins(face,1);
2945 for (som_loc=0; som_loc<nb_som_elem; som_loc++)
2947 som=elem_som(elem11,som_loc);
2957 if (som_loc==nb_som_elem)
2964 if (elem0==-1 && elem1!=-1)
2978 const int nb_comp = inconnue_->valeurs().line_size();
2982 int comp=0,nnz=0,face_f77=0,face_C=0;
2983 int nb_faces_of_symetry=0;
2986 ArrOfBit is_symetry(nb_faces_tot);
2991 IntLists faces_faces;
3010 for (face=0; face<nb_faces_tot; face++)
3011 if (is_symetry[face])
3013 int nb_v=faces_faces[face].
size();
3014 size+=nb_v*(nb_comp-1)*nb_comp;
3020 tab1[nb_faces_tot*nb_comp]=size+1;
3026 size=faces_faces[0].
size();
3027 if (is_symetry[0]) size*=(nb_comp);
3028 for (comp=1; comp<nb_comp; comp++)
3031 tab1[face_C]=tab1[face_C-1]+size;
3035 for (face=1; face<nb_faces_tot; face++)
3037 size=faces_faces[face-1].
size();
3038 if (is_symetry[face-1]) size*=(nb_comp);
3039 for (comp=0; comp<nb_comp; comp++)
3041 face_C=face*nb_comp+comp;
3042 tab1[face_C]=tab1[face_C-1]+size;
3043 size=faces_faces[face].
size();
3044 if (is_symetry[face]) size*=(nb_comp);
3049 for (face=0; face<nb_faces_tot; face++)
3051 size=faces_faces[face].
size();
3053 for (comp=0; comp<nb_comp; comp++)
3055 auto debut=tab1[face*nb_comp+comp]-1;
3057 for (i=0; i<size; i++)
3059 face_C=faces_faces[face][i]*nb_comp+comp;
3061 tab2[debut+i]=face_f77;
3068 for (face=0; face<nb_faces_tot; face++)
3069 if (is_symetry[face])
3071 size=faces_faces[face].
size();
3073 for (comp=0; comp<nb_comp; comp++)
3075 auto debut=tab1[face*nb_comp+comp]-1;
3077 for (
int voi=0; voi<size; voi++)
3079 int face2=faces_faces[face][voi];
3080 for (i=0; i<nb_comp-1; i++)
3083 next=(comp+i+1)%nb_comp;
3084 face_C=face2*nb_comp+next;
3086 tab2[debut+i]=face_f77;
3088 assert(debut+i<tab1[face*nb_comp+comp+1]-1);
3101 Cerr <<
"Error in Op_Dift_VEFP1NCP1B_Face::dimensionner(Matrice_Morse&)" << finl;
3102 Cerr <<
"Sizing of the implicit matrix with the alphaA option"
3103 <<
" is not yet implemented" << finl;
3104 Cerr <<
"Exiting program" << finl;
3133 for (n_bord=0; n_bord<nb_bords; n_bord++)
3141 if (sub_type(
Symetrie,la_cl.valeur()))
3145 for (ind_face=num1; ind_face<num2; ind_face++)
3161 const Domaine& domaine = domaine_VEF.
domaine();
3162 const Domaine& dom=domaine;
3171 const DoubleTab& xv=domaine_VEF.
xv();
3174 DoubleTab inco(unknown);
3175 DoubleVect& incoV = inco;
3180 DoubleTab resu(unknown);
3181 DoubleVect& resuV = resu;
3182 DoubleTab resuMat(unknown);
3183 const DoubleVect& resuMatV = resuMat;
3194 DoubleVect poroF(
equation().milieu().porosite_face());
3195 if (!marq) poroF=1.;
3200 modif_par_porosite_si_flag(
nu_,nu,!marq,poroE);
3213 int compi=0,compj=0;
3216 int num1=0,num2=0,ind_face=0;
3239 les_mots[0] =
"matrice";
3240 les_mots[1] =
"result";
3241 les_mots[2] =
"res";
3242 les_mots[3] =
"resMat";
3243 les_mots[4] =
"grad";
3244 les_mots[5] =
"gradMat";
3245 les_mots[6] =
"div";
3246 les_mots[7] =
"ligne_mat";
3251 for (i=0; i<les_mots.size(); i++)
3257 ofstream mat(les_mots[0].getChar());
3259 for (i=0; i<domaine_VEF.
nb_faces(); i++)
3262 mat<<matConst(i,j)<<
",";
3266 double coeff_diag=0.;
3267 double sum_coeff_extra_diag=0.;
3268 ofstream ligneMat(les_mots[7].getChar());
3271 coeff_diag=matConst(i,i);
3272 ligneMat<<
"Ligne : "<<i<<endl;
3273 ligneMat<<
"Coeff diag : "<<coeff_diag<<endl;
3275 ligneMat<<
"Coeff extra diag : ";
3276 sum_coeff_extra_diag=0.;
3278 if (j!=i) sum_coeff_extra_diag+=matConst(i,j);
3279 ligneMat<<sum_coeff_extra_diag<<endl;
3281 ligneMat<<
"Coeff extra diag par colonne : ";
3282 sum_coeff_extra_diag=0.;
3284 if (j!=i) sum_coeff_extra_diag+=matConst(j,i);
3285 ligneMat<<sum_coeff_extra_diag<<endl;
3293 int elem0=0,elem1=0;
3294 int som_loc0=1,som_loc1=1;
3296 const int nb_som_elem=domaine.nb_som_elem();
3298 const IntTab& elem_som=domaine.les_elems();
3299 ofstream grad1(gradi.getChar());
3300 for (face=0; face<size0; face++)
3302 grad1<<
"Face : "<<face<<endl;
3305 grad1<<xv(face,i)<<
",";
3308 for (ii=0; ii<2; ii++)
3310 elem=face_voisins(face,ii);
3312 for (som_loc=0; som_loc<nb_som_elem; som_loc++)
3314 som=elem_som(elem,som_loc);
3316 isInStencil(face,som,elem0,som_loc0,elem1,som_loc1);
3320 elem1,som_loc1,gradient1);
3324 grad1<<xs(som,i)<<
",";
3327 grad1<<gradient1(compj)<<
",";
3333 ofstream result(les_mots[1].getChar());
3334 ofstream res(les_mots[2].getChar());
3335 ofstream resMat(les_mots[3].getChar());
3336 ofstream grad(les_mots[4].getChar());
3337 ofstream gradMat(les_mots[5].getChar());
3338 ofstream div(les_mots[6].getChar());
3340 for (face=firstFaceInt; face<size0; face++)
3350 grad<<
"Face interne : "<<face*size1+comp<<endl;
3353 grad<<xv(face,i)<<
",";
3355 for (som=0; som<nb_som_tot; som++)
3359 grad<<xs(som,i)<<
",";
3361 for (compi=0; compi<
dim_ch_; compi++)
3371 gradMat<<
"Face interne : "<<face*size1+comp<<endl;
3374 gradMat<<xv(face,i)<<
",";
3376 for (i=0; i<nnz; i++)
3378 gradMat<<som_glob[i]<<
"(";
3380 gradMat<<xs(som_glob[i],ii)<<
",";
3383 gradMat<<gradientMat(compj,i)<<
",";
3391 div<<
"Face interne : "<<face*size1+comp<<endl;
3394 div<<xv(face,i)<<
",";
3396 for (i=0; i<size0; i++)
3402 for (j=0; j<size1; j++)
3403 div<<resu[i*size1+j]<<
",";
3408 res<<
"Face interne : "<<face*size1+comp<<endl;
3411 res<<xv(face,i)<<
",";
3413 for (i=0; i<size0; i++)
3419 for (j=0; j<size1; j++)
3420 res<<resu[i*size1+j]<<
",";
3429 resMat<<
"Face interne :"<<face*size1+comp<<endl;
3432 resMat<<xv(face,i)<<
",";
3434 for (i=0; i<size0; i++)
3438 resMat<<xv(i,ii)<<
",";
3440 for (j=0; j<size1; j++)
3441 resMat<<resuMatV[i*size1+j]<<
",";
3452 result<<
"Diff pour face interne : "<<face*size1+comp<<endl;
3455 result<<xv(face,i)<<
",";
3457 for (i=0; i<size0; i++)
3460 for (j=0; j<size1; j++)
3461 test1|=(std::fabs(resuV[i*size1+j])>1.e-14);
3467 result<<xv(i,ii)<<
",";
3469 for (j=0; j<size1; j++)
3470 result <<resuV[i*size1+j]<<
",";
3477 result<<
"Diff pour face interne : "<<face*size1+comp<<endl;
3478 result<<
"Maximum : "<<max<<endl;
3486 for (n_bord=0; n_bord<nb_bords; n_bord++)
3501 else if (sub_type(
Dirichlet,la_cl.valeur()))
3502 for (ind_face=num1; ind_face<num2; ind_face++)
3511 grad<<
"Face Dirichlet : "<<face*size1+comp<<endl;
3514 grad<<xv(face,i)<<
",";
3516 for (som=0; som<nb_som_tot; som++)
3520 grad<<xs(som,i)<<
",";
3522 for (compi=0; compi<
dim_ch_; compi++)
3532 gradMat<<
"Face Dirichlet : "<<face*size1+comp<<endl;
3535 gradMat<<xv(face,i)<<
",";
3537 for (i=0; i<nnz; i++)
3539 gradMat<<som_glob[i]<<
"(";
3541 gradMat<<xs(som_glob[i],ii)<<
",";
3544 gradMat<<gradientMat(compj,i)<<
",";
3548 for (i=0; i<size0; i++)
3549 for (j=0; j<size1; j++)
3550 resuV[i*size1+j]=0.;
3553 else if (sub_type(
Periodique,la_cl.valeur()))
3558 for (ind_face=num1; ind_face<num2; ind_face++)
3572 grad <<
"Face perio : "<<face*size1+comp<<endl;
3575 grad<<xv(face,i)<<
",";
3577 for (som=0; som<nb_som_tot; som++)
3581 grad<<xs(som,i)<<
",";
3583 for (compi=0; compi<
dim_ch_; compi++)
3593 gradMat<<
"Face perio : "<<face*size1+comp<<endl;
3596 gradMat<<xv(face,i)<<
",";
3598 for (i=0; i<nnz; i++)
3600 gradMat<<som_glob[i]<<
"(";
3602 gradMat<<xs(som_glob[i],ii)<<
",";
3605 gradMat<<gradientMat(compj,i)<<
",";
3613 div<<
"Face perio : "<<face*size1+comp<<endl;
3616 div<<xv(face,i)<<
",";
3618 for (i=0; i<size0; i++)
3624 for (j=0; j<size1; j++)
3625 div<<resu[i*size1+j]<<
",";
3630 res<<
"Face perio : "<<face*size1+comp<<endl;
3633 res<<xv(face,i)<<
",";
3635 for (i=0; i<size0; i++)
3641 for (j=0; j<size1; j++)
3642 res<<resu[i*size1+j]<<
",";
3651 resMat<<
"Face perio :"<<face*size1+comp<<endl;
3654 resMat<<xv(face,i)<<
",";
3656 for (i=0; i<size0; i++)
3660 resMat<<xv(i,ii)<<
",";
3662 for (j=0; j<size1; j++)
3663 resMat<<resuMatV[i*size1+j]<<
",";
3674 result<<
"Diff pour face perio : "<<face*size1+comp<<endl;
3677 result<<xv(face,i)<<
",";
3679 for (i=0; i<size0; i++)
3682 for (j=0; j<size1; j++)
3683 test1|=(std::fabs(resuV[i*size1+j])>1.e-14);
3689 result<<xv(i,ii)<<
",";
3691 for (j=0; j<size1; j++)
3692 result <<resuV[i*size1+j]<<
",";
3699 result<<
"Diff pour face perio : "<<face*size1+comp<<endl;
3700 result<<
"Maximum : "<<max<<endl;
3709 for (ind_face=num1; ind_face<num2; ind_face++)
3720 grad <<
"Face CL : "<<face*size1+comp<<endl;
3723 grad<<xv(face,i)<<
",";
3725 for (som=0; som<nb_som_tot; som++)
3729 grad<<xs(som,i)<<
",";
3731 for (compi=0; compi<
dim_ch_; compi++)
3741 gradMat<<
"Face CL : "<<face*size1+comp<<endl;
3744 gradMat<<xv(face,i)<<
",";
3746 for (i=0; i<nnz; i++)
3748 gradMat<<som_glob[i]<<
"(";
3750 gradMat<<xs(som_glob[i],ii)<<
",";
3753 gradMat<<gradientMat(compj,i)<<
",";
3761 div<<
"Face CL : "<<face*size1+comp<<endl;
3764 div<<xv(face,i)<<
",";
3766 for (i=0; i<size0; i++)
3772 for (j=0; j<size1; j++)
3773 div<<resu[i*size1+j]<<
",";
3778 res<<
"Face CL : "<<face*size1+comp<<endl;
3781 res<<xv(face,i)<<
",";
3783 for (i=0; i<size0; i++)
3786 for (j=0; j<size1; j++)
3787 test1|=(std::fabs(resuV[i*size1+j])>max);
3795 for (j=0; j<size1; j++)
3796 res<<resu[i*size1+j]<<
",";
3806 resMat<<
"Face CL :"<<face*size1+comp<<endl;
3809 resMat<<xv(face,i)<<
",";
3811 for (i=0; i<size0; i++)
3815 resMat<<xv(i,ii)<<
",";
3817 for (j=0; j<size1; j++)
3818 resMat<<resuMatV[i*size1+j]<<
",";
3829 result<<
"Diff pour face CL : "<<face*size1+comp<<endl;
3832 result<<xv(face,i)<<
",";
3834 for (i=0; i<size0; i++)
3837 for (j=0; j<size1; j++)
3838 test1|=(std::fabs(resuV[i*size1+j])>1.e-14);
3844 result<<xv(i,ii)<<
",";
3846 for (j=0; j<size1; j++)
3847 result <<resuV[i*size1+j]<<
",";
3854 result<<
"Diff pour face CL : "<<face*size1+comp<<endl;
3855 result<<
"Maximum : "<<max<<endl;
3870 const int nb_bords =les_cl.size();
3871 int n_bord=0, num1=0, num2=0;
3872 int face=0, face_associee=0;
3873 int ind_face=0, comp=0;
3875 for (n_bord=0; n_bord<nb_bords; n_bord++)
3887 for (ind_face=num1; ind_face<num2; ind_face++)
3893 if (face<face_associee)
3894 for (comp=0; comp<
dim_ch_; comp++)
int_t size_array() const
Returns the size of the array in bits.
void setbit(int_t i) const
Set bit e to 1.
class Champ_Don_Fonc_xyz This class represents a data field that is a function
: class Champ_Don_lu This class represents a data field read from a file with the following conventio...
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
DoubleTab & valeurs() override
Returns the array of field values at the current time.
class Champ_base This class is the base of the fields hierarchy.
class Champ_front_txyz Derived class of Champ_front_var representing
double valeur_au_temps_et_au_point(double temps, int som, double x, double y, double z, int comp) const override
Champ_front_base & champ_front()
class Cond_lim Generic class used to represent any class
class Conds_lim This class represents a vector of boundary conditions.
static void verifier(const char *const msg, double)
Classe Dirichlet_homogene This class is the base class of the hierarchy of homogeneous Dirichlet-type...
Dirichlet This class is the base class of the hierarchy of Dirichlet-type boundary conditions.
int_t nb_aretes_tot() const
returns the total number of edges (real+virtual).
virtual const MD_Vector & md_vector_sommets() const
virtual void creer_tableau_elements(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
Creates a parallel array of values at elements.
DoubleTab_t & les_sommets()
int_t get_renum_som_perio(int_t i) const
int nb_faces_elem(int=0) const
Returns the number of faces of type i of the geometric elements that make up the domain.
const DoubleTab_t & coord_sommets() const
virtual void creer_tableau_sommets(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
Creates an array with one "row" per mesh vertex.
int_t nb_som_tot() const
Returns the total number of vertices of the domain i.e. the number of real and virtual vertices on th...
int_t nb_som() const
Returns the number of vertices of the domain.
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
int nb_cond_lim() const
Returns the number of boundary conditions.
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
const DoubleVect & volume_aux_sommets() const
void creer_tableau_aretes(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
virtual const DoubleVect & face_surfaces() const
int nb_faces() const
Returns the total number of faces.
DoubleVect & volumes_entrelaces()
int nb_faces_tot() const
Returns the total number of faces.
virtual double face_normales(int face, int comp) const
double xv(int num_face, int k) const
double volumes(int i) const
int face_sommets(int i, int j) const
Returns the index of the i-th vertex of face num_face.
virtual double surface(int i) const
int est_une_face_virt_bord(int) const
Returns 1 if face is a virtual boundary face, 0 otherwise.
int nb_som_face() const
Returns the number of vertices per face.
int elem_faces(int i, int j) const
Returns the index of the i-th face of element num_elem; the face numbering convention is.
int premiere_face_int() const
A face is internal if and only if it separates two elements.
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
int nb_faces_bord() const
Returns the number of faces on which boundary conditions are applied:
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
const Domaine & domaine() const
Classe Echange_externe_impose: This class represents the special case of the class.
virtual double h_imp(int num) const
Returns the value of the imposed heat exchange coefficient on the i-th component.
virtual double T_ext(int num) const
Returns the value of the imposed temperature on the i-th component of the boundary field.
Class defining operators and methods for all reading operation in an input flow (file,...
virtual const Milieu_base & milieu() const =0
Solveur_Masse_base & solv_masse()
Returns the mass solver associated with the equation.
virtual const Champ_Inc_base & inconnue() const =0
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
virtual Nature_du_champ nature_du_champ() const
int num_premiere_face() const
int num_face(const int) const
Matrice_Morse class - Represents a (sparse) matrix M, not necessarily square,.
const auto & get_tab2() const
void dimensionner(int n, _SIZE_ nnz)
Size the matrix with n lines and n columns and nnz zero-values coefficients.
const auto & get_tab1() const
int nb_colonnes() const override
Return local number of columns (=size on the current proc).
int nb_lignes() const override
Return local number of lines (=size on the current proc).
DoubleTab & ajouter_multTab_(const DoubleTab &, DoubleTab &) const override
Matrix-matrix multiply-accumulate operation (saxpy) (matrix X represented by an array).
DoubleVect & porosite_elem()
DoubleVect & porosite_face()
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
A character string (Nom) in uppercase.
An array of Motcle objects.
Classe Neumann_homogene This class is the base class of the hierarchy of homogeneous Neumann-type bou...
Classe Neumann_paroi This boundary condition corresponds to an imposed flux for the.
Neumann_sortie_libre This class represents an open boundary without imposed velocity.
Classe Neumann_val_ext This class is the base class of the hierarchy of.
Classe Neumann This class is the base class of the hierarchy of Neumann-type boundary conditions.
virtual double flux_impose(int i) const
Returns the value of the imposed flux on the i-th component of the field representing the flux at the...
const Nom & que_suis_je() const
Returns the string identifying the class.
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
void coeff_matrice_som(const int, IntVect &, DoubleTab &, DoubleTab &, const DoubleVect &, const DoubleTab &, const DoubleTab &, Matrice_Morse &) const
void associer(const Domaine_dis_base &, const Domaine_Cl_dis_base &, const Champ_Inc_base &) override
DoubleTab & corriger_pour_diffusivite(const DoubleTab &, DoubleTab &) const
void liste_face(IntLists &, int &) const
void coeff_matrice_som_symetrie(const int, IntVect &, DoubleTab &, DoubleTab &, const DoubleVect &, const DoubleTab &, const DoubleTab &, Matrice_Morse &) const
void ajouter_contribution_elem(const DoubleTab &, const DoubleVect &, const DoubleTab &, Matrice_Morse &) const
void coeff_matrice_som_CL(const int, IntVect &, DoubleTab &, DoubleTab &, const DoubleVect &, const DoubleTab &, const DoubleTab &, Matrice_Morse &) const
void calculer_dt_stab_som(const DoubleTab &, DoubleTab &) const
DoubleVect & calculer_divergence_aretes(DoubleVect &) const
void calculer_laplacien_som(const DoubleTab &) const
void gradient_som_CL(const int, int &, IntVect &, DoubleTab &) const
void remplir_nu_pA(const DoubleTab &, DoubleTab &) const
void dimensionner(Matrice_Morse &) const override
Size/initialize the matrix.
void calculer_flux_bords_elem(const DoubleVect &) const
void isInStencil(int, int, int &, int &, int &, int &) const
DoubleVect & calculer_divergence_som(DoubleVect &) const
const Domaine_VEF & domaine_vef() const
void ajouter_contribution_som(const DoubleTab &, const DoubleVect &, const DoubleTab &, Matrice_Morse &) const
DoubleVect & calculer_gradient_elem(const DoubleVect &) const
void calculer_dt_stab_aretes(const DoubleTab &, DoubleTab &) const
double calculer_dt_stab() const override
Computes dt_stab.
void ajouter_contribution(const DoubleTab &, Matrice_Morse &) const
DoubleTab & calculer(const DoubleTab &, DoubleTab &) const override
DoubleTab & ajouter(const DoubleTab &, DoubleTab &) const override
void remplir_nu_p1(const DoubleTab &, DoubleTab &) const
Compute the diffusivity "nu_p1" at mesh vertices from the element diffusivity "nu_elem".
void calculer_flux_bords_som(const DoubleVect &) const
DoubleVect & calculer_gradient_som(const DoubleVect &) const
void ajouter_contribution_aretes(const DoubleTab &, const DoubleVect &, const DoubleTab &, Matrice_Morse &) const
void coeff_matrice_som_perio(const int, const int, IntVect &, DoubleTab &, DoubleTab &, const DoubleVect &, const DoubleTab &, const DoubleTab &, Matrice_Morse &) const
void corriger_Cl_test(DoubleTab &) const
DoubleVect & calculer_gradient_aretes(const DoubleVect &) const
void calculer_dt_stab_elem(const DoubleTab &, DoubleTab &) const
DoubleVect & corriger_div_pour_Cl(const DoubleVect &, const DoubleTab &, DoubleVect &) const
void gradient_som(const int face, const int, const int, const int, const int, const int, DoubleTab &) const
void calculer_flux_bords_aretes(const DoubleVect &) const
DoubleVect & calculer_divergence_elem(DoubleVect &) const
void isFaceOfSymetry(ArrOfBit &, int &) const
Op_Diff_VEFP1NCP1B_Face()
Matrice_Morse laplacien_p1_
void completer() override
Associates the operator with the domaine_dis, the domaine_Cl_dis, and the unknown of its equation.
const Champ_base & diffusivite() const override
void completer() override
Associates the operator with the domaine_dis, the domaine_Cl_dis, and the unknown of its equation.
int phi_psi_diffuse(const Equation_base &eq) const
Determine whether to compute div(phi nu grad Psi) or div(nu grad Phi psi).
virtual void remplir_nu(DoubleTab &) const
double viscA(int face_i, int face_j, int num_elem, const _TYPE_ &diffu) const
void dimensionner(const Domaine_VEF &, const Domaine_Cl_VEF &, Matrice_Morse &) const
Dimensioning of the matrix that will receive the coefficients from convection and diffusion for the f...
void modifier_flux(const Operateur_base &) const
class Periodique This class represents a periodic boundary condition.
int face_associee(int i) const
static double mp_min(double)
static bool is_parallel()
static int me()
Returns the rank of the local processor in the current communication group. See Comm_Group::rank() an...
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
static int je_suis_maitre()
Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
double temps_courant() const
Returns the current time.
Solveur_Masse_base Represents the mass matrix of an equation.
virtual DoubleTab & appliquer(DoubleTab &) const
Returns appliquer_impl(x/temporal_coefficient) if a temporal coefficient is set, otherwise returns ap...
Base class for output streams.
virtual void declare_support_masse_volumique(int ok)
The constructor of a derived class that uses the density field must call this function with the value...
Symetrie On symmetry faces, the following properties hold:
void dimensionner(int)
Resizes an array of lists.
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
_SIZE_ dimension(int d) const
_TYPE_ local_max_abs_vect(Mp_vect_options opt=VECT_REAL_ITEMS) const
virtual const MD_Vector & get_md_vector() const
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")