TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Loi_paroi_base.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 <Echange_global_impose_turbulent.h>
17#include <Frottement_impose_base.h>
18#include <Dirichlet_loi_paroi.h>
19#include <Discretisation_base.h>
20#include <Loi_paroi_base.h>
21#include <Cond_lim_base.h>
22#include <Pb_Multiphase.h>
23#include <Domaine_VF.h>
24#include <TRUSTTrav.h>
25#include <math.h>
26
27Implemente_base(Loi_paroi_base, "Loi_paroi_base", Correlation_base);
28
29Sortie& Loi_paroi_base::printOn(Sortie& os) const { return os; }
30
32{
33 Param param(que_suis_je());
34 param.ajouter("eps_y_p", &eps_y_p_);
35 param.lire_avec_accolades_depuis(is);
36 return is;
37}
38
40{
41 Domaine_VF& domaine = ref_cast(Domaine_VF, pb_->domaine_dis());
42 int nf_tot = domaine.nb_faces_tot();
43
44 // We create the table that enables us to know for which BC we must calculate the boundary law
45 Faces_a_calculer_.resize(nf_tot, 1);
46 domaine.creer_tableau_faces(Faces_a_calculer_);
47
48 for (int i = 0; i < pb_->nombre_d_equations(); i++)
49 for (int j = 0; j < pb_->equation(i).domaine_Cl_dis().nb_cond_lim(); j++)
50 {
51 Cond_lim& cond_lim_loc = pb_->equation(i).domaine_Cl_dis().les_conditions_limites(j);
52 if (sub_type(Dirichlet_loi_paroi, cond_lim_loc.valeur()))
53 ref_cast(Dirichlet_loi_paroi, cond_lim_loc.valeur()).liste_faces_loi_paroi(Faces_a_calculer_); // met des 1 si doit remplir la table
54 else if (sub_type(Frottement_impose_base, cond_lim_loc.valeur()))
55 ref_cast(Frottement_impose_base, cond_lim_loc.valeur()).liste_faces_loi_paroi(Faces_a_calculer_); // met des 1 si doit remplir la table
56 else if (sub_type(Echange_global_impose_turbulent, cond_lim_loc.valeur()))
57 ref_cast(Echange_global_impose_turbulent, cond_lim_loc.valeur()).liste_faces_loi_paroi(Faces_a_calculer_); // met des 1 si doit remplir la table
58 }
59 Faces_a_calculer_.echange_espace_virtuel();
60
61 valeurs_loi_paroi_["y_plus"] = DoubleTab(nf_tot, 1); // pour l'instant, turbulence dans seulement une phase
62 valeurs_loi_paroi_["u_tau"] = DoubleTab(nf_tot, 1);
63 valeurs_loi_paroi_["y"] = DoubleTab(nf_tot, 1); // Attention : pour un meme maillage, depuis PolyMAC_MPFA_vec le y n'est pas le meme en vdf et en PolyMAC_CDO pour le meme maillage a cause de l'histoire de la vitesse non nulle a la face de bord.
64
65 DoubleTab& tab_y_p = valeurs_loi_paroi_["y_plus"];
66 for (int i = 0; i < tab_y_p.dimension_tot(0); i++)
67 for (int n = 0; n < tab_y_p.dimension_tot(1); n++)
68 tab_y_p(i, n) = ((i < nf_tot) && (Faces_a_calculer_(i, 0))) ? 1 : -1.;
69
70 const IntTab& f_e = domaine.face_voisins();
71
72 const bool is_PolyMAC_MPFA = pb_->discretisation().is_PolyMAC_MPFA(), is_vdf = pb_->discretisation().is_vdf();
73 DoubleTab& tab_y = valeurs_loi_paroi_["y"];
74 for (int f = 0; f < tab_y.dimension_tot(0); f++)
75 for (int n = 0; n < tab_y.dimension_tot(1); n++)
76 {
77 if ((is_vdf) || (is_PolyMAC_MPFA))
78 tab_y(f, n) = (Faces_a_calculer_(f, 0)) ? (f_e(f, 0) >= 0 ? domaine.dist_face_elem0(f, f_e(f, 0)) : domaine.dist_face_elem1(f, f_e(f, 1))) : -1;
79 else
80 Process::exit(que_suis_je() + " : you cannot have a wall law with this discretization yet ! But you are welcome to add it in the code if you so choose");
81 }
82}
83
85{
86 if (temps > tps_loc)
87 {
88 const DoubleTab& vit = pb_->get_champ("vitesse").passe();
89 const DoubleTab& nu = ref_cast(Fluide_base, pb_->milieu()).viscosite_cinematique().valeurs();
90 calc_y_plus(vit, nu);
91
92 if (sub_type(Navier_Stokes_std, pb_->equation(0)) && pb_->has_champ("y_plus"))
93 {
94 Domaine_VF& domaine = ref_cast(Domaine_VF, pb_->domaine_dis());
95 const IntTab& f_e = domaine.face_voisins();
96 int nf_tot = domaine.nb_faces_tot(), ne_tot = domaine.nb_elem_tot();
97 DoubleTab& y_p = valeurs_loi_paroi_["y_plus"];
98 DoubleTrav y_p_e(ne_tot, 1);
99 for (int f = 0; f < nf_tot; f++)
100 if (Faces_a_calculer_(f, 0) == 1)
101 {
102 int c = (f_e(f, 0) >= 0) ? 0 : 1;
103 if (f_e(f, (c == 0) ? 1 : 0) >= 0)
104 Process::exit("Error in the definition of the boundary conditions for wall laws");
105 int e = f_e(f, c);
106 y_p_e(e, 0) = y_p(f, 0);
107 }
108 ref_cast(Navier_Stokes_std, pb_->equation(0)).update_y_plus(y_p_e);
109 }
110 tps_loc = temps;
111 }
112}
113
classe Cond_lim Classe generique servant a representer n'importe quelle classe
Definition Cond_lim.h:31
Classe Dirichlet_loi_paroi Classe de base pour les valeurs impose pour une condition aux limites des ...
class Domaine_VF
Definition Domaine_VF.h:44
Classe Echange_global_impose_turbulent.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Fluide_base Cette classe represente un d'un fluide incompressible ainsi que
Definition Fluide_base.h:38
Classe Frottement_impose_base Classe de base pour des conditions aux limites de type Navier (v.
classe Loi_paroi_base Classe de base pour les lois de paroi dans pb_mulitphase
IntTab Faces_a_calculer_
void completer() override
std::map< std::string, DoubleTab > valeurs_loi_paroi_
void mettre_a_jour(double temps) override
virtual void calc_y_plus(const DoubleTab &vit, const DoubleTab &nu_visc)=0
classe Navier_Stokes_std Cette classe porte les termes de l'equation de la dynamique
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
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