TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Paroi_negligeable_VDF.cpp
1/****************************************************************************
2* Copyright (c) 2025, 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 <Paroi_negligeable_VDF.h>
17#include <Dirichlet_paroi_fixe.h>
18#include <Modele_turbulence_hyd_base.h>
19
20#include <Champ_Face_VDF.h>
21#include <Champ_Uniforme.h>
22#include <Domaine_Cl_VDF.h>
23#include <Equation_base.h>
24#include <distances_VDF.h>
25#include <Fluide_base.h>
26
27Implemente_instanciable_sans_constructeur(Paroi_negligeable_VDF, "negligeable_VDF", Paroi_hyd_base_VDF);
28
29Sortie& Paroi_negligeable_VDF::printOn(Sortie& s) const { return s << que_suis_je() << " " << le_nom(); }
30
32
38
39int Paroi_negligeable_VDF::calculer_hyd(DoubleTab& tab_k_eps)
40{
41 const Equation_base& eqn_hydr = mon_modele_turb_hyd->equation();
42 if (sub_type(Fluide_base, eqn_hydr.milieu()))
43 {
44 int ndeb, nfin, elem, ori, l_unif;
45 double norm_tau, u_etoile, norm_v = 0, dist, val0, val1, val2, d_visco = 0, visco = 1.;
46
47 const Domaine_VDF& domaine_VDF = ref_cast(Domaine_VDF, le_dom_dis_.valeur());
48 const IntTab& face_voisins = domaine_VDF.face_voisins();
49 const IntVect& orientation = domaine_VDF.orientation();
50 const Fluide_base& le_fluide = ref_cast(Fluide_base, eqn_hydr.milieu());
51 const Champ_Don_base& ch_visco_cin = le_fluide.viscosite_cinematique();
52 const DoubleTab& tab_visco = ch_visco_cin.valeurs();
53 const DoubleTab& vit = eqn_hydr.inconnue().valeurs();
54
55 if (sub_type(Champ_Uniforme, ch_visco_cin))
56 {
57 visco = tab_visco(0, 0);
58 l_unif = 1;
59 }
60 else
61 l_unif = 0;
62
63 for (int n_bord = 0; n_bord < domaine_VDF.nb_front_Cl(); n_bord++)
64 {
65 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
66
67 if (sub_type(Dirichlet_paroi_fixe, la_cl.valeur()))
68 {
69 const Front_VF& le_bord = ref_cast(Front_VF, la_cl->frontiere_dis());
70 ndeb = le_bord.num_premiere_face();
71 nfin = ndeb + le_bord.nb_faces();
72
73 for (int num_face = ndeb; num_face < nfin; num_face++)
74 {
75
76 if (face_voisins(num_face, 0) != -1)
77 elem = face_voisins(num_face, 0);
78 else
79 elem = face_voisins(num_face, 1);
80
81 if (dimension == 2)
82 {
83 ori = orientation(num_face);
84 norm_v = norm_2D_vit(vit, elem, ori, domaine_VDF, val0);
85 }
86 else if (dimension == 3)
87 {
88 ori = orientation(num_face);
89 norm_v = norm_3D_vit(vit, elem, ori, domaine_VDF, val1, val2);
90 }
91
92 if (axi)
93 dist = domaine_VDF.dist_norm_bord_axi(num_face);
94 else
95 dist = domaine_VDF.dist_norm_bord(num_face);
96 if (l_unif)
97 d_visco = visco;
98 else
99 d_visco = tab_visco[elem];
100
101 norm_tau = d_visco * norm_v / dist;
102 u_etoile = sqrt(norm_tau);
103 tab_u_star_(num_face) = u_etoile;
104
105 } // loop on faces
106
107 } // Fin paroi fixe
108
109 } // Fin boucle sur les bords
110
111 }
112 return 1;
113}
114
115int Paroi_negligeable_VDF::calculer_hyd(DoubleTab& tab_nu_t, DoubleTab& tab_k)
116{
117 const Equation_base& eqn_hydr = mon_modele_turb_hyd->equation();
118 if (sub_type(Fluide_base, eqn_hydr.milieu()))
119 {
120 int ndeb, nfin, elem, ori, l_unif;
121 double norm_tau, u_etoile, norm_v = 0, dist, val0, val1, val2, d_visco = 0, visco = 1.;
122
123 const Domaine_VDF& domaine_VDF = ref_cast(Domaine_VDF, le_dom_dis_.valeur());
124 const IntTab& face_voisins = domaine_VDF.face_voisins();
125 const IntVect& orientation = domaine_VDF.orientation();
126 const Fluide_base& le_fluide = ref_cast(Fluide_base, eqn_hydr.milieu());
127 const Champ_Don_base& ch_visco_cin = le_fluide.viscosite_cinematique();
128 const DoubleTab& tab_visco = ch_visco_cin.valeurs();
129 const DoubleTab& vit = eqn_hydr.inconnue().valeurs();
130
131 if (sub_type(Champ_Uniforme, ch_visco_cin))
132 {
133 visco = tab_visco(0, 0);
134 l_unif = 1;
135 }
136 else
137 l_unif = 0;
138
139 for (int n_bord = 0; n_bord < domaine_VDF.nb_front_Cl(); n_bord++)
140 {
141 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
142
143 if (sub_type(Dirichlet_paroi_fixe, la_cl.valeur()))
144 {
145 const Front_VF& le_bord = ref_cast(Front_VF, la_cl->frontiere_dis());
146 ndeb = le_bord.num_premiere_face();
147 nfin = ndeb + le_bord.nb_faces();
148
149 for (int num_face = ndeb; num_face < nfin; num_face++)
150 {
151
152 if (face_voisins(num_face, 0) != -1)
153 elem = face_voisins(num_face, 0);
154 else
155 elem = face_voisins(num_face, 1);
156
157 if (dimension == 2)
158 {
159 ori = orientation(num_face);
160 norm_v = norm_2D_vit(vit, elem, ori, domaine_VDF, val0);
161 }
162 else if (dimension == 3)
163 {
164 ori = orientation(num_face);
165 norm_v = norm_3D_vit(vit, elem, ori, domaine_VDF, val1, val2);
166 }
167
168 if (axi)
169 dist = domaine_VDF.dist_norm_bord_axi(num_face);
170 else
171 dist = domaine_VDF.dist_norm_bord(num_face);
172 if (l_unif)
173 d_visco = visco;
174 else
175 d_visco = tab_visco[elem];
176
177 norm_tau = d_visco * norm_v / dist;
178 u_etoile = sqrt(norm_tau);
179 tab_u_star_(num_face) = u_etoile;
180
181 } // loop on faces
182
183 } // Fin paroi fixe
184
185 } // Fin boucle sur les bords
186
187 }
188 return 1;
189}
190
191int Paroi_negligeable_VDF::calculer_hyd_BiK(DoubleTab& tab_k, DoubleTab& tab_eps)
192{
193 return calculer_hyd(tab_k); // the value in argument is not used anyway
194}
195
197{
198 return false;
199}
200
classe Champ_Don_base classe de base des Champs donnes (non calcules)
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
classe Champ_Fonc_base Classe de base des champs qui sont fonction d'une grandeur calculee
DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ au temps courant.
classe Champ_Uniforme Represente un champ constant dans l'espace et dans le temps.
classe Cond_lim Classe generique servant a representer n'importe quelle classe
Definition Cond_lim.h:31
classe Dirichlet_paroi_fixe Represente une paroi immobile dans une equation de type Navier_Stokes.
class Domaine_VDF
Definition Domaine_VDF.h:64
double dist_norm_bord_axi(int num_face) const
int orientation(int) const override
inline DoubleVect& Domaine_VDF::porosite_face() {
double dist_norm_bord(int num_face) const override
int face_voisins(int num_face, int i) const
renvoie l'element voisin de numface dans la direction i.
Definition Domaine_VF.h:418
int nb_front_Cl() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
virtual const Milieu_base & milieu() const =0
virtual const Champ_Inc_base & inconnue() const =0
classe Fluide_base Cette classe represente un d'un fluide incompressible ainsi que
Definition Fluide_base.h:38
const Champ_Don_base & viscosite_cinematique() const
Definition Fluide_base.h:58
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
static int dimension
Definition Objet_U.h:99
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual const Nom & le_nom() const
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
Definition Objet_U.cpp:319
static int axi
Definition Objet_U.h:101
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
virtual int calculer_scal(Champ_Fonc_base &)
int calculer_hyd_BiK(DoubleTab &, DoubleTab &) override
bool use_shear() const override
int calculer_hyd(DoubleTab &) override
Classe de base des flux de sortie.
Definition Sortie.h:52