15#include <Op_Diff_VEF_Face_Penalise.h>
16#include <Dirichlet_paroi_fixe.h>
36 Cerr<<
"In Op_Diff_VEF_Face_Penalise::readOn()"<<finl;
43 Cerr <<
"Error in Op_Diff_VEF_Face_Penalise::readOn()" << finl;
44 Cerr <<
"Problem dimension must be 2" << finl;
63calculer(
const DoubleTab& inconnue, DoubleTab& resu)
const
81ajouter(
const DoubleTab& inconnue, DoubleTab& resu)
const
84 int nb_composante,numero_global_face,local;
85 int face_penalisation,face;
87 IntList voisinage_ordre1,voisinage_ordre1_strict;
88 IntList voisinage_ordre2,voisinage_ordre2_strict;
89 IntList ensemble_faces;
95 for (nb_composante = 0; nb_composante <
dimension; nb_composante++)
101 voisinage(numero_global_face,voisinage_ordre1);
102 voisinage(voisinage_ordre1,voisinage_ordre2);
103 reduction(voisinage_ordre1,voisinage_ordre2,voisinage_ordre2_strict);
110 for (local = 0 ; local < voisinage_ordre2_strict.
size(); local++)
112 face = voisinage_ordre2_strict[local];
127 for (
int mm = 0; mm < ensemble_faces.
size(); mm++)
129 face_penalisation = ensemble_faces[mm];
131 resu(numero_global_face,nb_composante) +=
132 inconnue(face,nb_composante)*
133 signe(numero_global_face,face)*
144 for (local = 0 ; local < voisinage_ordre1_strict.
size(); local++)
146 assert(voisinage_ordre1_strict.
size() == 2
147 || voisinage_ordre1_strict.
size() == 4);
149 face = voisinage_ordre1_strict[local];
150 face_penalisation =
autre_face(numero_global_face,face);
152 resu(numero_global_face,nb_composante) +=
153 inconnue(face,nb_composante)*
162 if (numero_global_face <
domaine_vef().nb_faces_bord())
163 for (local = 0; local < voisinage_ordre1.
size(); local++)
165 assert(voisinage_ordre1.
size() == 3);
167 face_penalisation = voisinage_ordre1[local];
169 if (numero_global_face == face_penalisation)
174 resu(numero_global_face,nb_composante) +=
175 inconnue(numero_global_face,nb_composante) *
183 for (local = 0; local < voisinage_ordre1_strict.
size(); local++)
185 assert( voisinage_ordre1_strict.
size() == 4);
187 face_penalisation = voisinage_ordre1_strict[local];
189 resu(numero_global_face,nb_composante) +=
190 inconnue(numero_global_face,nb_composante) *
218voisinage(
const int Numero_face, IntList& Voisinage)
const
231 const int nb_faces_element = domaine().nb_faces_elem();
242 for (numero_local = 0; numero_local < nb_faces_element; numero_local++)
245 const int numero_global_face =
257 for (numero_local = 0; numero_local < nb_faces_element; numero_local++)
262 const int numero_global_face =
287voisinage(
const IntList& Ensemble_faces, IntList& Voisinage)
const
295 int nb_elements_Ensemble_faces,nb_elements_liste_temporaire;
296 IntList liste_temporaire;
298 for (nb_elements_Ensemble_faces = 0;
299 nb_elements_Ensemble_faces < Ensemble_faces.
size();
300 nb_elements_Ensemble_faces++)
303 const int numero_face_dans_Ensemble_faces =
304 Ensemble_faces[nb_elements_Ensemble_faces];
307 if (! liste_temporaire.
est_vide() ) liste_temporaire.
vide();
312 voisinage(numero_face_dans_Ensemble_faces,liste_temporaire);
316 for (nb_elements_liste_temporaire = 0;
317 nb_elements_liste_temporaire < liste_temporaire.
size();
318 nb_elements_liste_temporaire++)
322 const int numero_face_dans_liste_temporaire =
323 liste_temporaire[nb_elements_liste_temporaire];
326 Voisinage.
add_if_not(numero_face_dans_liste_temporaire);
345signe(
const int Face1,
const int Face2)
const
358 IntList sommets_Face2;
360 for (numero_local = 0 ; numero_local < nb_sommets_par_face ; numero_local++)
361 sommets_Face2.
add(domaine_vef().face_sommets(Face2,numero_local));
366 for (numero_local = 0; numero_local < nb_sommets_par_face ; numero_local++)
367 if ( sommets_Face2.
contient(domaine_vef().face_sommets(Face1,numero_local)))
392 double coefficientpenalisation = 0.;
400 if (voisin1 == -1 && voisin2 == -1)
402 Cerr <<
"Error in Op_Dift_standard_Face_VEF_penalise::"
403 <<
"coefficient_penalisation()" << finl;
407 if (voisin1 != -1 && voisin2 != -1)
410 coefficientpenalisation = 1./
diametre(voisin1);
413 coefficientpenalisation = std::min(coefficientpenalisation,eta);
417 coefficientpenalisation = 1./
diametre(voisin2);
420 coefficientpenalisation = 1./
diametre(voisin1);
422 return coefficientpenalisation;
439 IntList& Faces_communes)
const
444 if (! Faces_communes.
est_vide() ) Faces_communes.
vide();
447 IntList voisinage_Face1,voisinage_Face2;
448 int nb_element_voisinage_Face2;
455 for (nb_element_voisinage_Face2 = 0;
456 nb_element_voisinage_Face2 < voisinage_Face2.
size();
457 nb_element_voisinage_Face2++)
459 const int numero_face_voisinage_Face2 =
460 voisinage_Face2[nb_element_voisinage_Face2];
462 if (voisinage_Face1.
contient(numero_face_voisinage_Face2))
463 Faces_communes.
add_if_not(numero_face_voisinage_Face2);
479reduction(
const IntList& Liste1,
const IntList& Liste2,
480 IntList& Liste_reduite)
const
487 const IntList *liste_de_plus_petite_taille,*liste_de_plus_grande_taille;
488 int nb_element_dans_liste;
495 liste_de_plus_petite_taille = &Liste2;
496 liste_de_plus_grande_taille = &Liste1;
500 liste_de_plus_petite_taille = &Liste1;
501 liste_de_plus_grande_taille = &Liste2;
507 for (
int ll = 0 ; ll < (*liste_de_plus_grande_taille).size() ; ll++)
508 Liste_reduite.
add( (*liste_de_plus_grande_taille)[ll] );
510 for (nb_element_dans_liste = 0;
511 nb_element_dans_liste < (*liste_de_plus_petite_taille).size();
512 nb_element_dans_liste++)
514 (Liste_reduite.
contient( (*liste_de_plus_petite_taille)
515 [nb_element_dans_liste] ) )
516 Liste_reduite.
suppr( (*liste_de_plus_petite_taille)
517 [nb_element_dans_liste] );
548 if (voisin1_Face1 != -1)
549 if (voisin1_Face1 == voisin1_Face2 || voisin1_Face1 == voisin2_Face2)
550 return voisin1_Face1;
552 if (voisin2_Face1 != -1)
553 if (voisin2_Face1 == voisin1_Face2 || voisin2_Face1 == voisin2_Face2)
554 return voisin2_Face1;
556 Cerr <<
" Op_Diff_VEF_Face_Penalise::element_commun()" << finl;
557 Cerr <<
"Warning: face " << Face1 <<
" and face " << Face2
558 <<
" have no common element" << finl;
559 Cerr <<
"Exiting element_commun" << finl;
583 int numero_local,lautre_face=-1;
589 if (elem_commun == -1)
591 Cerr <<
"Function element_commun" << finl;
592 Cerr <<
"The 2 faces do not belong to the same element." << finl;
597 const int nb_faces_element = domaine().nb_faces_elem();
599 for (numero_local = 0; numero_local < nb_faces_element; numero_local++)
603 const int numero_global_face =
606 if ( numero_global_face != Face1 && numero_global_face != Face2)
608 lautre_face = numero_global_face;
int nb_faces() const
Returns the total number of faces.
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 face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
Class defining operators and methods for all reading operation in an input flow (file,...
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 reduction(const IntList &Liste1, const IntList &Liste2, IntList &Liste_reduite) const
void faces_communes(const int Face1, const int Face2, IntList &Face_commune) const
Member function returning the list of faces belonging to the neighbourhood of both Face1 AND Face2.
double signe(const int Face1, const int Face2) const
double diametre(const int Element) const
DoubleTab & ajouter(const DoubleTab &inconnue, DoubleTab &resu) const override
Method that computes the velocity at time n+1 when the explicit scheme is used.
void voisinage(const int Numero_face, IntList &Voisinage) const
Method computing the neighbourhood of a face.
DoubleTab & calculer(const DoubleTab &inconnue, DoubleTab &resu) const override
Method that computes the contribution of the operator.
double coefficient_penalisation(const int Numero_face) const
Member function returning the penalisation coefficient associated with each face of the primary mesh.
double longueur(const int Face) const
int autre_face(const int Face1, const int Face2) const
Member function returning the 3rd face of element Element if Face1 and Face2 belong to the same eleme...
int element_commun(const int Face1, const int Face2) const
Member function returning the index of the element containing both Face1 and Face2 if it exists,...
DoubleTab & ajouter(const DoubleTab &, DoubleTab &) const override
const Domaine_VEF & domaine_vef() const
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Base class for output streams.
TRUSTList & add(_TYPE_)
insertion en queue
TRUSTList & add_if_not(_TYPE_)
Ajout d'un element a la liste ssi il n'existe pas deja.
void suppr(_TYPE_)
Supprime un element contenu dans la liste.
int contient(_TYPE_) const
Verifie si un element appartient ou non a la liste.
void vide()
Vide la liste.