TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_Face_VDF_bis.cpp
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#include <Transport_Interfaces_FT_Disc.h>
17#include <Dirichlet_paroi_fixe.h>
18#include <Fluide_Diphasique.h>
19#include <Champ_Face_VDF.h>
20#include <Champ_Face_VDF.h>
21#include <Champ_Uniforme.h>
22#include <Probleme_base.h>
23#include <distances_VDF.h>
24#include <Domaine_Cl_VDF.h>
25
26void Champ_Face_VDF::calcul_y_plus_diphasique(DoubleTab& y_plus, const Domaine_Cl_VDF& domaine_Cl_VDF)
27{
28 // On initialise le champ y_plus avec une valeur negative,
29 // comme ca lorsqu'on veut visualiser le champ pres de la paroi,
30 // on n'a qu'a supprimer les valeurs negatives et n'apparaissent
31 // que les valeurs aux parois.
32
33 int ndeb, nfin, elem, ori, l_unif;
34 double norm_tau, u_etoile, norm_v = 0, dist, val0, val1, val2, d_visco = 0, visco_ph0 = 1.;
35 y_plus = -1.;
36
37 const Champ_Face_VDF& vit = *this;
38 const Domaine_VDF& domaine_VDF = domaine_vdf();
39 const IntTab& face_voisins = domaine_VDF.face_voisins();
40 const IntVect& orientation = domaine_VDF.orientation();
41 const Equation_base& eqn_hydr = equation();
42
43 // Physical properties of both phases
44 const Fluide_Diphasique& le_fluide = ref_cast(Fluide_Diphasique, eqn_hydr.milieu());
45 const Fluide_base& phase_1 = le_fluide.fluide_phase(1);
46 const Fluide_base& phase_0 = le_fluide.fluide_phase(0);
47 const Champ_Don_base& ch_visco_cin_ph1 = phase_1.viscosite_cinematique();
48 const Champ_Don_base& ch_visco_cin_ph0 = phase_0.viscosite_cinematique();
49 const DoubleTab& tab_visco_ph1 = phase_1.viscosite_cinematique().valeurs();
50 const DoubleTab& tab_visco_ph0 = phase_0.viscosite_cinematique().valeurs();
51 const double delta_nu = tab_visco_ph1(0, 0) - tab_visco_ph0(0, 0);
52
53 // One way to get the Transport equation to pass the indicator DoubleTab
54 const Domaine_Cl_dis_base& domaine_Cl_dis_base = eqn_hydr.domaine_Cl_dis();
55 const Equation_base& eqn_trans = domaine_Cl_dis_base.equation().probleme().equation("Transport_Interfaces_FT_Disc");
56 const Transport_Interfaces_FT_Disc& eqn_interf = ref_cast(Transport_Interfaces_FT_Disc, eqn_trans);
57 const DoubleTab& indic = eqn_interf.inconnue().valeurs();
58
59 if (sub_type(Champ_Uniforme,ch_visco_cin_ph1) && sub_type(Champ_Uniforme, ch_visco_cin_ph0))
60 {
61 visco_ph0 = std::max(tab_visco_ph0(0, 0), DMINFLOAT);
62 l_unif = 1;
63 }
64 else
65 l_unif = 0;
66
67 if ((!l_unif) && ((tab_visco_ph1.local_min_vect() < DMINFLOAT) || (tab_visco_ph0.local_min_vect() < DMINFLOAT)))
68 {
69 Cerr << "Negative viscosity !!!" << finl;
70 Process::exit(-1);
71 }
72
73 DoubleTab yplus_faces(1, 1); // will contain yplus values if available
74 int yplus_already_computed = 0; // flag
75
76 const RefObjU& modele_turbulence = eqn_hydr.get_modele(TURBULENCE);
77 if (modele_turbulence && sub_type(Modele_turbulence_hyd_base, modele_turbulence.valeur()))
78 {
79 const Modele_turbulence_hyd_base& mod_turb = ref_cast(Modele_turbulence_hyd_base, modele_turbulence.valeur());
80 const Turbulence_paroi_base& loipar = mod_turb.loi_paroi();
81 yplus_faces.resize(domaine_VDF.nb_faces_tot());
82 yplus_faces.ref(loipar.tab_d_plus());
83 yplus_already_computed = 1;
84 }
85
86 for (int n_bord = 0; n_bord < domaine_VDF.nb_front_Cl(); n_bord++)
87 {
88 const Cond_lim& la_cl = domaine_Cl_VDF.les_conditions_limites(n_bord);
89
90 if (sub_type(Dirichlet_paroi_fixe, la_cl.valeur()))
91 {
92 const Front_VF& le_bord = ref_cast(Front_VF, la_cl->frontiere_dis());
93 ndeb = le_bord.num_premiere_face();
94 nfin = ndeb + le_bord.nb_faces();
95
96 for (int num_face = ndeb; num_face < nfin; num_face++)
97 {
98
99 if (face_voisins(num_face, 0) != -1)
100 elem = face_voisins(num_face, 0);
101 else
102 elem = face_voisins(num_face, 1);
103
104 if (yplus_already_computed)
105 {
106 // y+ is only defined on faces so we take the face value to put in the element
107 y_plus(elem) = yplus_faces(num_face);
108 }
109 else
110 {
111 if (dimension == 2)
112 {
113 ori = orientation(num_face);
114 norm_v = norm_2D_vit(vit.valeurs(), elem, ori, domaine_VDF, val0);
115 }
116 else if (dimension == 3)
117 {
118 ori = orientation(num_face);
119 norm_v = norm_3D_vit(vit.valeurs(), elem, ori, domaine_VDF, val1, val2);
120 } // dim 3
121
122 if (axi)
123 dist = domaine_VDF.dist_norm_bord_axi(num_face);
124 else
125 dist = domaine_VDF.dist_norm_bord(num_face);
126
127 if (l_unif)
128 d_visco = visco_ph0 + indic(elem) * delta_nu;
129 else
130 d_visco = (tab_visco_ph0.nb_dim() == 1 ? (tab_visco_ph0(elem) + indic(elem) * delta_nu) : (tab_visco_ph0(elem, 0) + indic(elem) * delta_nu));
131
132 // PQ : 01/10/03 : corrections par rapport a la version premiere
133 norm_tau = d_visco * norm_v / dist;
134
135 u_etoile = sqrt(norm_tau);
136 y_plus(elem) = dist * u_etoile / d_visco;
137
138 } // else yplus already computed
139 } // loop on faces
140 } // Fin paroi fixe
141 } // Fin boucle sur les bords
142}
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
const Domaine_VDF & domaine_vdf() const override
void calcul_y_plus_diphasique(DoubleTab &, const Domaine_Cl_VDF &)
DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ au temps courant.
class Domaine_Cl_VDF
const Cond_lim & les_conditions_limites(int) const
Renvoie la i-ieme condition aux limites.
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 nb_faces_tot() const
renvoie le nombre total de faces.
Definition Domaine_VF.h:481
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
virtual const Milieu_base & milieu() const =0
virtual const RefObjU & get_modele(Type_modele type) const
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Renvoie le domaine des conditions aux limite discretisee associee a l'equation.
Probleme_base & probleme()
Renvoie le probleme associe a l'equation.
const Fluide_Incompressible & fluide_phase(int la_phase) const
const Champ_Don_base & viscosite_cinematique() const
Definition Fluide_base.h:58
int nb_faces() const
Definition Front_VF.h:53
int num_premiere_face() const
Definition Front_VF.h:63
const Turbulence_paroi_base & loi_paroi() const
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
static int dimension
Definition Objet_U.h:99
static int axi
Definition Objet_U.h:101
virtual const Equation_base & equation(int) const =0
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
int nb_dim() const
Definition TRUSTTab.h:199
_TYPE_ local_min_vect(Mp_vect_options opt=VECT_REAL_ITEMS) const
Definition TRUSTVect.h:155
const Objet_U & valeur() const
Definition TRUST_Ref.h:134
const Champ_Inc_base & inconnue() const override
const DoubleVect & tab_d_plus() const