TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Loi_paroi_adaptative.cpp
1/****************************************************************************
2* Copyright (c) 2022, 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 <Loi_paroi_adaptative.h>
17#include <Navier_Stokes_std.h>
18#include <Correlation_base.h>
19#include <QDM_Multiphase.h>
20#include <TRUSTTab_parts.h>
21#include <Cond_lim_base.h>
22#include <Pb_Multiphase.h>
23#include <Domaine_VF.h>
24#include <TRUSTTrav.h>
25#include <Motcle.h>
26#include <Param.h>
27#include <math.h>
28#include <Nom.h>
29#include <Champ_Face_base.h>
30
31Implemente_instanciable(Loi_paroi_adaptative, "Loi_paroi_adaptative", Loi_paroi_log);
32
34{
35 return os;
36}
37
39{
40 return Loi_paroi_log::readOn(is);
41}
42
43void Loi_paroi_adaptative::calc_y_plus(const DoubleTab& vit, const DoubleTab& nu_visc)
44{
45 const int cnu = nu_visc.dimension(0) == 1;
46 Domaine_VF& domaine = ref_cast(Domaine_VF, pb_->domaine_dis());
47 DoubleTab& u_t = valeurs_loi_paroi_["u_tau"];
48 DoubleTab& y_p = valeurs_loi_paroi_["y_plus"];
49 const DoubleTab& n_f = domaine.face_normales();
50 const DoubleVect& fs = domaine.face_surfaces();
51 const IntTab& f_e = domaine.face_voisins();
52
53 const int nf_tot = domaine.nb_faces_tot();
54 const int D = dimension;
55 const int N = vit.line_size();
56
57 DoubleTab pvit_elem(0, N * dimension);
58 if (nf_tot == vit.dimension_tot(0))
59 {
60 const Champ_Face_base& ch = ref_cast(Champ_Face_base, pb_->equation(0).inconnue());
61 domaine.domaine().creer_tableau_elements(pvit_elem);
62 ch.get_elem_vector_field(pvit_elem, true);
63 }
64
65 int n = 0; // pour l'instant, turbulence dans seulement une phase
66
67 for (int f = 0 ; f < nf_tot ; f ++)
68 if (Faces_a_calculer_(f,0)==1)
69 {
70 const int c = (f_e(f, 0) >= 0) ? 0 : 1;
71 if (f_e(f, (c == 0) ? 1 : 0) >= 0)
72 Process::exit("Error in the definition of the boundary conditions for wall laws");
73 const int e = f_e(f, c);
74
75 double u_orth {0.0};
76 DoubleTrav u_parallel(D);
77 if (nf_tot == vit.dimension_tot(0)) // VDF case
78 {
79 for (int d = 0; d < D; d++)
80 u_orth -= pvit_elem(e, N*d + n)*n_f(f,d)/fs(f); // ! n_f pointe vers la face 1 donc vers l'exterieur de l'element, d'ou le -
81 for (int d = 0 ; d < D; d++)
82 u_parallel(d) = pvit_elem(e, N*d + n) - u_orth*(-n_f(f,d))/fs(f) ; // ! n_f pointe vers la face 1 donc vers l'exterieur de l'element, d'ou le -
83 }
84 else // PolyMAC case
85 {
86 for (int d = 0; d < D; d++)
87 u_orth -= vit(nf_tot + e * D + d, n)*n_f(f, d)/fs(f); // ! n_f pointe vers la face 1 donc vers l'exterieur de l'element, d'ou le -
88 for (int d = 0; d < D; d++)
89 u_parallel(d) = vit(nf_tot + e * D + d, n) - u_orth*(-n_f(f, d))/fs(f) ; // ! n_f pointe vers la face 1 donc vers l'exterieur de l'element, d'ou le -
90 }
91
92 double residu = 0;
93 for (int d = 0; d < D; d++)
94 residu += u_parallel(d)*n_f(f, d)/fs(f);
95 if (residu > 1e-8)
96 Process::exit("Loi_paroi_adaptative : Error in the calculation of the parallel velocity for wall laws");
97
98 const double norm_u_parallel = std::sqrt(domaine.dot(&u_parallel(0), &u_parallel(0)));
99
100 const double y_loc = (c == 0) ? domaine.dist_face_elem0(f, e) : domaine.dist_face_elem1(f, e) ;
101 y_p(f, n) = std::max(y_p_min_,
102 calc_y_plus_loc(norm_u_parallel, nu_visc(!cnu * e, n), y_loc, y_p(f, n)));
103 u_t(f, n) = y_p(f, n)*nu_visc(!cnu * e, n)/y_loc;
104 }
105}
106
107double Loi_paroi_adaptative::u_plus_de_y_plus(double y_p) // Blended Reichardt model
108{
109 const double reichardt = std::log(1 + 0.4*y_p)/von_karman_
110 + 7.8*(1 - std::exp(-y_p/11) - y_p/11*std::exp(-y_p/3));
111 const double log_law = std::log(y_p + limiteur_y_p_)/von_karman_ + 5.1;
112 const double blending = std::tanh( y_p/27*y_p/27*y_p/27*y_p/27);
113
114 return (1.0 - blending)*reichardt + blending*log_law;
115}
116
118{
119 const double reichardt = std::log(1 + 0.4*y_p)/von_karman_
120 + 7.8*(1 - std::exp(-y_p/11) - y_p/11*std::exp(-y_p/3));
121 const double log_law = std::log(y_p + limiteur_y_p_)/von_karman_ + 5.1;
122 const double blending = std::tanh( y_p/27*y_p/27*y_p/27*y_p/27);
123
124 const double d_reichardt = 0.4/(1 + 0.4*y_p)*1/von_karman_ + 7.8/11*std::exp(-y_p/11)
125 - 7.8/11*std::exp(-y_p/3) + 7.8*y_p/33*std::exp(-y_p/3) ;
126 const double d_log_law = 1.0/(y_p + limiteur_y_p_)*1./von_karman_;
127 const double d_blending = 4.0/27*(y_p/27*y_p/27*y_p/27)*(1 - blending*blending);
128
129 return (1 - blending)*d_reichardt - reichardt*d_blending + blending*d_log_law + d_blending*log_law ;
130}
virtual DoubleTab & get_elem_vector_field(DoubleTab &, bool passe=false) const
class Domaine_VF
Definition Domaine_VF.h:44
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual const Champ_Inc_base & inconnue() const =0
classe Loi_paroi_adaptative correlation pour une loi de paroi adaptative qui calcule u_tau et du y_pl...
double deriv_u_plus_de_y_plus(double y_p) override
void calc_y_plus(const DoubleTab &vit, const DoubleTab &nu_visc) override
double u_plus_de_y_plus(double y_p) override
IntTab Faces_a_calculer_
std::map< std::string, DoubleTab > valeurs_loi_paroi_
classe Loi_paroi_adaptative correlation pour une loi de paroi adaptative qui calcule u_tau et du y_pl...
double calc_y_plus_loc(double y_p, double nu, double y, double y_p_0)
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
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
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_tot(int) const override
Definition TRUSTTab.tpp:160
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
int line_size() const
Definition TRUSTVect.tpp:67