TrioCFD 1.9.9_beta
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 } // End fixed wall
108
109 } // End loop over boundaries
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 } // End fixed wall
184
185 } // End loop over boundaries
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
class Champ_Don_base base class of Given Fields (not calculated)
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
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.
Champ_Uniforme Represents a field that is constant in space and time.
class Cond_lim Generic class used to represent any class
Definition Cond_lim.h:31
Dirichlet_paroi_fixe Represents a fixed wall in a Navier-Stokes type equation.
class Domaine_VDF
Definition Domaine_VDF.h:61
double dist_norm_bord_axi(int num_face) const
Returns the normal distance for a boundary face (cylindrical coordinates).
int orientation(int) const override
inline DoubleVect& Domaine_VDF::porosite_face() {
double dist_norm_bord(int num_face) const override
Returns the normal distance for a boundary face (Cartesian coordinates).
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in 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
class Equation_base The role of an equation is the calculation of one or more fields....
virtual const Milieu_base & milieu() const =0
virtual const Champ_Inc_base & inconnue() const =0
Base class for an incompressible fluid and its properties:
Definition Fluide_base.h:36
const Champ_Don_base & viscosite_cinematique() const
Definition Fluide_base.h:56
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: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
static int axi
Definition Objet_U.h:96
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
virtual int calculer_scal(Champ_Fonc_base &)
int calculer_hyd_BiK(DoubleTab &, DoubleTab &) override
bool use_shear() const override
int calculer_hyd(DoubleTab &) override
Base class for output streams.
Definition Sortie.h:52