TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Viscosite_turbulente_sato.cpp
1/****************************************************************************
2* Copyright (c) 2021, 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 <Viscosite_turbulente_sato.h>
17#include <Pb_Multiphase.h>
18#include <Masse_ajoutee_base.h>
19#include <TRUSTTab_parts.h>
20#include <Probleme_base.h>
21#include <Champ_base.h>
22#include <Param.h>
23#include <Champ_Face_PolyMAC_MPFA.h>
24
25Implemente_instanciable(Viscosite_turbulente_sato, "Viscosite_turbulente_sato", Viscosite_turbulente_base);
26
28{
29 return os;
30}
31
33{
34 Param param(que_suis_je());
35 param.ajouter("coef_sato", &coef_sato_);
36 param.lire_avec_accolades_depuis(is);
37
38 //identification des phases
39 Pb_Multiphase *pbm = sub_type(Pb_Multiphase, pb_.valeur()) ? &ref_cast(Pb_Multiphase, pb_.valeur()) : nullptr;
40
41 if (!pbm || pbm->nb_phases() == 1)
42 Process::exit(que_suis_je() + " : not needed for single-phase flow!");
43
44 for (int n = 0; n < pbm->nb_phases(); n++) //recherche de n_l_, n_g : phase {liquide,gaz}_continu en priorite
45 if (pbm->nom_phase(n).debute_par("liquide")
46 && (n_l_ < 0 || pbm->nom_phase(n).finit_par("continu")))
47 n_l_ = n;
48
49 if (n_l_ < 0)
50 Process::exit(que_suis_je() + " : liquid phase not found!");
51
52 pbm->creer_champ("distance_paroi_globale"); // Besoin de distance a la paroi
53
54 return is;
55}
56
58{
59 nu_t = 0; // La contribution de nu_sato est ajouter via un terme source dans la qdm
60}
61
62void Viscosite_turbulente_sato::reynolds_stress(DoubleTab& R_ij) const // Renvoie <u_i'u_j'>
63{
64
65 // Récupère les champs de vitesse - alpha - d_bulles (diamètre des bulles) - grad vitesse
66 const Pb_Multiphase* pbm = sub_type(Pb_Multiphase, pb_.valeur()) ? &ref_cast(Pb_Multiphase, pb_.valeur()) : nullptr ;
67 const Domaine_PolyMAC_MPFA& domaine = ref_cast(Domaine_PolyMAC_MPFA, pb_->domaine_dis());
68 const DoubleTab& tab_u = pb_->get_champ("vitesse").passe();
69 const DoubleTab& d_bulles = pb_->get_champ("diametre_bulles").passe();
70 const DoubleTab& alpha = pb_->get_champ("alpha").passe();
71 const DoubleTab& tab_grad = pbm->get_champ("gradient_vitesse").passe();
72
73 const int D = dimension;
74 const int nf_tot = domaine.nb_faces_tot();
75 const int N = alpha.dimension(1);
76
77 // Champ de vitesse
78 ConstDoubleTab_parts p_u(tab_u); //en PolyMAC_MPFA, tab_u contient (nf.u) aux faces, puis (u_i) aux elements
79 int i_part = -1;
80
81 for (int i = 0; i < p_u.size(); i++)
82 if (p_u[i].get_md_vector() == R_ij.get_md_vector())
83 i_part = i; //on cherche une partie ayant le meme support
84
85 if (i_part < 0)
86 Process::exit("Viscosite_turbulente_sato : inconsistency between velocity and Rij!");
87
88 const DoubleTab& u = p_u[i_part]; //le bon tableau
89
90 // vitesse relative
91 DoubleTrav u_r(R_ij.dimension(0), 1);
92
93 // Tenseur Reynolds de Sato
94 for (int e = 0 ; e < R_ij.dimension(0); e++) // elements
95 for (int i = 0; i < D; i++) // dimension i
96 for (int j = 0; j < D; j++) // dimension j
97 for (int k = 0; k < N; k++) // phases
98 if (k != n_l_) // iteration sur phases gazeuses
99 {
100 // Compute the relative velocity norm
101 double u_r_carre = 0.;
102 for (int d = 0; d < D; d++)
103 u_r_carre += (u(e, d, k) - u(e, d, n_l_))*(u(e, d, k) - u(e, d, n_l_)); // relative speed = gas speed - liquid speed
104 u_r(e, 0) = std::sqrt(u_r_carre);
105
106 // Compute Sato eddy viscosity
107 const double nu_sato = coef_sato_ * alpha(e, k) * d_bulles(e, k) * u_r(e,0);
108
109 // Tenseur des taux de déformations Sij = gradv_ij + gradv_ji (facteur 1/2 supprimé car il se simplifie après)
110 const double S_ij = tab_grad(nf_tot + i + e * D , D * n_l_ + j) + tab_grad(nf_tot + j + e * D , D * n_l_ + i);
111
112 // Tenseur de Reynolds BIA
113 R_ij(e, k, i, j) = 0 ; // No BIT for gas phase
114 R_ij(e, 0, i, j) -= nu_sato * S_ij; // <u_i'u_j'> = - nu_sato * S_ij
115 }
116}
117
118void Viscosite_turbulente_sato::k_over_eps(DoubleTab& k_sur_eps) const
119{
120 k_sur_eps = 0;
121}
122
123void Viscosite_turbulente_sato::eps(DoubleTab& eps_) const
124{
125 eps_ = 0;
126}
virtual DoubleTab & passe(int i=1)
Definition Champ_Proto.h:50
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual int debute_par(const char *const n) const
Definition Nom.cpp:319
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 Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
classe Pb_Multiphase Cette classe represente un probleme de thermohydraulique multiphase de type "3*N...
const Nom & nom_phase(int i) const
int nb_phases() const
void creer_champ(const Motcle &motlu) override
const Champ_base & get_champ(const Motcle &nom) const override
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
classe Viscosite_turbulente_base correlations de viscosite turbulente decrivant le tenseur de Reynold...
classe Viscosite_turbulente_sato Viscosite turbulente induite par les bulles : nu_b = coef_sato*alpha...
void reynolds_stress(DoubleTab &R_ij) const override
void eddy_viscosity(DoubleTab &nu_t) const override
void eps(DoubleTab &eps) const override
void k_over_eps(DoubleTab &k_sur_eps) const override