TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Modele_turbulence_hyd_LES_Smago_filtre_VEF.cpp
1/****************************************************************************
2* Copyright (c) 2024, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16
17#include <Modele_turbulence_hyd_LES_Smago_filtre_VEF.h>
18#include <Domaine_Cl_VEF.h>
19#include <Domaine_VEF.h>
20#include <Champ_P1NC.h>
21
22Implemente_instanciable(Modele_turbulence_hyd_LES_Smago_filtre_VEF, "Modele_turbulence_hyd_sous_maille_Smago_filtre_VEF", Modele_turbulence_hyd_LES_Smago_VEF);
23
25
27
29{
30 const DoubleTab& la_vitesse = mon_equation_->inconnue().valeurs();
31 const Domaine_Cl_VEF& domaine_Cl_VEF = ref_cast(Domaine_Cl_VEF, le_dom_Cl_.valeur());
32 const Domaine_VEF& domaine_VEF = ref_cast(Domaine_VEF, le_dom_VF_.valeur());
33 const int nb_elem = domaine_VEF.nb_elem();
34
35 const DoubleVect& vol = domaine_VEF.volumes();
36 const Domaine& domaine = domaine_VEF.domaine();
37 int nb_faces_elem = domaine.nb_faces_elem();
38
39 const IntTab& face_voisins = domaine_VEF.face_voisins();
40 const IntTab& elem_faces = domaine_VEF.elem_faces();
41 const int nb_face = domaine_VEF.nb_faces();
42
43 int i, elem;
44 int fac = 0;
45
46 //////////////////////////////
47 //Filtrage du champ de vitesse
48 //////////////////////////////
49 DoubleTab vitesse(la_vitesse);
50
51 for (; fac < nb_face; fac++)
52 {
53 int num1;
54 num1 = face_voisins(fac, 0);
55 int num2;
56 num2 = face_voisins(fac, 1);
57
58 int fac1, fac2, facel;
59
60 vitesse = 0.;
61
62 for (facel = 0; facel < nb_faces_elem; facel++)
63 {
64 fac1 = elem_faces(num1, facel);
65 //Correction pour avoir le champ de vitesse par face
66 for (i = 0; i < dimension; i++)
67 vitesse(fac, i) += la_vitesse(fac1, i) / double(2 * nb_faces_elem);
68 fac2 = elem_faces(num2, facel);
69 for (i = 0; i < dimension; i++)
70 vitesse(fac, i) += la_vitesse(fac2, i) / double(2 * nb_faces_elem);
71 }
72
73 }
74
75 Champ_P1NC::calcul_S_barre(vitesse, SMA_barre_, domaine_Cl_VEF);
76
77 // On recalcule la longueur caracteristique de l'element
78
79 for (elem = 0; elem < nb_elem; elem++)
80 {
81 double voltot = vol(elem);
82 double eldif = 1.;
83 int num1, facel;
84
85 for (facel = 0; facel < nb_faces_elem; facel++)
86 {
87 fac = elem_faces(elem, facel);
88 num1 = face_voisins(fac, 0);
89 if (num1 == elem)
90 num1 = face_voisins(fac, 1);
91
92 if (num1 != -1)
93 {
94 voltot += vol(num1);
95 eldif += 1.;
96 }
97 }
98
99 voltot /= eldif;
100 l_(elem) = 2.0 * pow(6. * voltot, 1. / double(dimension));
101 }
102}
static DoubleVect & calcul_S_barre(const DoubleTab &, DoubleVect &, const Domaine_Cl_VEF &)
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
class Domaine_VEF
Definition Domaine_VEF.h:53
int nb_faces() const
Returns the total number of faces.
Definition Domaine_VF.h:471
double volumes(int i) const
Definition Domaine_VF.h:113
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
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
Definition Domaine_VF.h:418
const Domaine & domaine() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Class Modele_turbulence_hyd_LES_Smago_VEF.
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
virtual const Nom & le_nom() const
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Objet_U.cpp:317
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
Base class for output streams.
Definition Sortie.h:52