TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Op_Diff_VEF_Face_Penalise.h
1/****************************************************************************
2* Copyright (c) 2023, 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#ifndef Op_Diff_VEF_Face_Penalise_included
18#define Op_Diff_VEF_Face_Penalise_included
19#include <Op_Diff_VEF_Face.h>
20#include <Domaine_Cl_VEF.h>
21#include <TRUSTList.h>
22#include <Domaine.h>
23
25{
26
27 Declare_instanciable(Op_Diff_VEF_Face_Penalise);
28
29public :
30 /* Member function computing the penalised diffusion.
31 * Overrides the base class version.
32 */
33 DoubleTab& ajouter(const DoubleTab& inconnue, DoubleTab& resu) const override;
34 DoubleTab& calculer(const DoubleTab& inconnue, DoubleTab& resu) const override;
35
36protected:
37
38 /* Member function returning in the list Voisinage the set
39 * of face indices neighbouring face Numero_face.
40 * Neighbouring faces are those belonging to elements
41 * that contain face Numero_face.
42 * Note: Voisinage also contains face Numero_face itself.
43 */
44 void voisinage(const int Numero_face, IntList& Voisinage) const;
45
46 /* Member function returning in the list Voisinage
47 * the set of faces constituting the neighbourhood of the list
48 * Ensemble_faces.
49 * Note: Voisinage also contains the elements of Ensemble_faces.
50 */
51 void voisinage(const IntList& Ensemble_faces, IntList& Voisinage) const;
52
53 /* Member function returning the appropriate sign for
54 * computing the interactions of the basis functions of faces
55 * Face1 and Face2 along another face.
56 */
57 double signe(const int Face1, const int Face2 ) const;
58
59 /* Member function returning the penalisation coefficient
60 * to be applied on each edge of the primary mesh.
61 */
62 double coefficient_penalisation(const int Numero_face) const;
63
64 /* Member function returning the list Faces_communes of faces
65 * that belong to the neighbourhood of both Face1 AND Face2.
66 */
67 void faces_communes(const int Face1,const int Face2,
68 IntList& Face_commune) const;
69
70 /* Member function returning the list Liste_reduite which is
71 * the set difference of Liste1 and Liste2.
72 * Note: the function dynamically checks the lengths of
73 * Liste1 and Liste2 before executing.
74 */
75 void reduction(const IntList& Liste1,const IntList& Liste2,
76 IntList& Liste_reduite) const;
77
78 /* Member function returning the index of the element shared by
79 * Face1 and Face2 if it exists, or -1 otherwise.
80 */
81 int element_commun(const int Face1,const int Face2) const;
82
83 /* Member function returning the index of the 3rd face
84 * of an element, if Face1 and Face2 belong to the same element.
85 * Returns -1 otherwise.
86 */
87 int autre_face(const int Face1, const int Face2) const;
88
89 /* Member function returning the diameter of element Element.
90 * Note: assumed to operate in 2D.
91 */
92 inline double diametre(const int Element) const;
93
94 /* Member function returning the length of face Face.
95 * Note: assumed to operate in 2D.
96 */
97 inline double longueur(const int Face) const;
98
99
100private:
101 /* Member function returning the Domaine_VEF of the domain. */
102 inline const Domaine_VEF& domaine_vef() const;
103
104 /* Member function returning the Domaine of the problem. */
105 inline const Domaine& domaine() const;
106
107 /* Member function returning the boundary conditions domain. */
108 inline const Domaine_Cl_VEF& domaine_cl() const;
109
110};
111
112
113
114
115inline double Op_Diff_VEF_Face_Penalise::longueur(const int Face) const
116{
117 double x_sommet1,x_sommet2;
118 double y_sommet1,y_sommet2;
119
120 int sommet1 = domaine_vef().face_sommets(Face,0);
121 int sommet2 = domaine_vef().face_sommets(Face,1);
122
123 x_sommet1 = domaine().coord(sommet1,0);
124 y_sommet1 = domaine().coord(sommet1,1);
125
126 x_sommet2 = domaine().coord(sommet2,0);
127 y_sommet2 = domaine().coord(sommet2,1);
128
129 return sqrt( pow(x_sommet1 - x_sommet2,2) + pow(y_sommet1 - y_sommet2,2) );
130}
131
132inline double Op_Diff_VEF_Face_Penalise::diametre(const int Element) const
133{
134 int face1,face2,face3;
135 double longueur_face1,longueur_face2,longueur_face3;
136 double longueur_max,diametre_element;
137
138 face1 = domaine_vef().elem_faces(Element,0);
139 face2 = domaine_vef().elem_faces(Element,1);
140 face3 = domaine_vef().elem_faces(Element,2);
141
142 longueur_face1 = longueur(face1);
143 longueur_face2 = longueur(face2);
144 longueur_face3 = longueur(face3);
145
146 longueur_max = longueur_face1 >= longueur_face2 ? longueur_face1 :
147 longueur_face2;
148 diametre_element = longueur_face3 >= longueur_max ? longueur_face3 :
149 longueur_max;
150
151 return diametre_element;
152}
153
155{
156 return le_dom_vef.valeur();
157}
158
159inline const Domaine_Cl_VEF& Op_Diff_VEF_Face_Penalise::domaine_cl() const
160{
161 return la_zcl_vef.valeur();
162}
163
164inline const Domaine& Op_Diff_VEF_Face_Penalise::domaine() const
165{
166 return domaine_vef().domaine();
167}
168
169
170#endif
class Domaine_VEF
Definition Domaine_VEF.h:53
int face_sommets(int i, int j) const
Returns the index of the i-th vertex of face num_face.
Definition Domaine_VF.h:582
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.
Definition Domaine_VF.h:542
const Domaine & domaine() const
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,...
const Domaine_VEF & domaine_vef() const