TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Modele_turbulence_hyd_Longueur_Melange_VDF.cpp
1/****************************************************************************
2* Copyright (c) 2026, 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 <Modele_turbulence_hyd_Longueur_Melange_VDF.h>
17
18#include <Domaine_Cl_VDF.h>
19#include <Champ_Face_VDF.h>
20#include <Equation_base.h>
21#include <Probleme_base.h>
22#include <Domaine_VDF.h>
23#include <TRUSTTrav.h>
24#include <Debog.h>
25#include <Param.h>
26
27Implemente_instanciable(Modele_turbulence_hyd_Longueur_Melange_VDF, "Modele_turbulence_hyd_Longueur_Melange_VDF", Modele_turbulence_hyd_Longueur_Melange_base);
28
30{
31 return s << que_suis_je() << " " << le_nom();
32}
33
35{
37}
38
40{
42 param.ajouter("canal_hmin", &alt_min_);
43 param.ajouter("canal_hmax", &alt_max_);
44 param.ajouter("direction_normale_canal", &direction_);
45}
46
53
55{
56 double hauteur = std::fabs(alt_max_ - alt_min_); // test alt_max>alt_min a faire, plutot que de prendre fabs ??
57 //Attention, ici "hauteur" est la hauteur reelle du canal (pas la demi-hauteur)
58 const double Kappa = 0.415;
59 double Cmu = CMU;
60
61 double temps = mon_equation_->inconnue().temps();
62 const Domaine_VDF& domaine_VDF = ref_cast(Domaine_VDF, le_dom_VF_.valeur());
63 DoubleTab& visco_turb = la_viscosite_turbulente_->valeurs();
64 DoubleVect& k = energie_cinetique_turb_->valeurs();
65 const int nb_elem = domaine_VDF.nb_elem();
66 const int nb_elem_tot = domaine_VDF.nb_elem_tot();
67 const DoubleTab& xp = domaine_VDF.xp();
68
69 Sij2_.resize(nb_elem_tot);
70
72
73 if (visco_turb.size() != nb_elem)
74 {
75 Cerr << "Size error for the array containing the values of the turbulent viscosity." << finl;
76 exit();
77 }
78
79 Debog::verifier("Modele_turbulence_hyd_Longueur_Melange_VDF::calculer_viscosite_turbulente visco_turb 0", visco_turb);
80
81 if (k.size() != nb_elem)
82 {
83 Cerr << "Size error for the array containing the values of the turbulent kinetic energy." << finl;
84 exit();
85 }
86
87 // CANAL PLAN suivant (Ox - h=2) **********************************
88
89 for (int elem = 0; elem < nb_elem; elem++)
90 {
91 double y = xp(elem, direction_);
92 y = std::fabs(y - alt_min_);
93 if (y > (hauteur / 2.))
94 y = std::fabs(alt_max_ - y);
95
96 visco_turb(elem) = Kappa * Kappa * y * y * (1. - 2 * y / hauteur) * sqrt(2. * Sij2_(elem));
97 k(elem) = pow(visco_turb(elem) / (Cmu * y), 2);
98 }
99
100 Debog::verifier("Modele_turbulence_hyd_Longueur_Melange_VDF::calculer_viscosite_turbulente visco_turb 1", visco_turb);
101
102 la_viscosite_turbulente_->changer_temps(temps);
103 return la_viscosite_turbulente_;
104}
105
107{
108 const DoubleTab& vitesse = mon_equation_->inconnue().valeurs();
109 Champ_Face_VDF& ch = ref_cast(Champ_Face_VDF, mon_equation_->inconnue());
110 const Domaine_Cl_VDF& domaine_Cl_VDF = ref_cast(Domaine_Cl_VDF, le_dom_Cl_.valeur());
111 const Domaine_VDF& domaine_VDF = ref_cast(Domaine_VDF, le_dom_VF_.valeur());
112 const int nb_elem = domaine_VDF.nb_elem_tot();
113
114 assert(vitesse.line_size() == 1);
115 DoubleTab duidxj(nb_elem, dimension, dimension, vitesse.line_size());
116 int i, j;
117 double Sij;
118
119 Sij2_ = 0.;
120
121 ch.calcul_duidxj(vitesse, duidxj, domaine_Cl_VDF);
122
123 for (int elem = 0; elem < nb_elem; elem++)
124 {
125 for (i = 0; i < dimension; i++)
126 for (j = 0; j < dimension; j++)
127 {
128 //Deplacement du calcul de Sij
129 Sij = 0.5 * (duidxj(elem, i, j, 0) + duidxj(elem, j, i, 0));
130 Sij2_(elem) += Sij * Sij;
131 }
132 }
133}
class Champ_Face_VDF Cette classe sert a representer un champ vectoriel dont on ne calcule
DoubleTab & calcul_duidxj(const DoubleTab &, DoubleTab &) const
Methode qui renvoie gij aux elements a partir de la vitesse aux elements (gij represente la derivee p...
classe Champ_Fonc_base Classe de base des champs qui sont fonction d'une grandeur calculee
static void verifier(const char *const msg, double)
Definition Debog.cpp:21
class Domaine_Cl_VDF
class Domaine_VDF
Definition Domaine_VDF.h:64
double xp(int num_elem, int k) const
Definition Domaine_VF.h:77
int nb_elem_tot() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Classe Modele_turbulence_hyd_Longueur_Melange_VDF Cette classe represente le modele de turbulence de ...
Classe Modele_turbulence_hyd_Longueur_Melange_base Classe representant le modele de turbulence Longue...
virtual int preparer_calcul()
Prepare le calcul.
virtual void set_param(Param &) const
Definition Objet_U.h:135
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 const Nom & le_nom() const
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
Definition Objet_U.cpp:319
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
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_ size() const
Definition TRUSTVect.tpp:45
int line_size() const
Definition TRUSTVect.tpp:67