TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Modele_turbulence_hyd_LES_Smago_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_LES_Smago_VDF.h>
17#include <Schema_Temps_base.h>
18#include <Champ_Face_VDF.h>
19#include <Domaine_Cl_VDF.h>
20#include <Equation_base.h>
21#include <Domaine_VDF.h>
22#include <Param.h>
23#include <Debog.h>
24
25Implemente_instanciable(Modele_turbulence_hyd_LES_Smago_VDF, "Modele_turbulence_hyd_sous_maille_Smago_VDF", Modele_turbulence_hyd_LES_VDF_base);
26
27// XD sous_maille_smago mod_turb_hyd_ss_maille sous_maille_smago INHERITS_BRACE Smagorinsky sub-grid turbulence model.
28// XD_CONT NL2 Nut=Cs1*Cs1*l*l*sqrt(2*S*S) NL2 K=Cs2*Cs2*l*l*2*S
29
30Sortie& Modele_turbulence_hyd_LES_Smago_VDF::printOn(Sortie& s) const { return s << que_suis_je() << " " << le_nom(); }
31
33
35{
37 param.ajouter("cs", &cs_); // XD_ADD_P floattant
38 // XD_CONT This is an optional keyword and the value is used to set the constant used in the Smagorinsky model (This
39 // XD_CONT is currently only valid for Smagorinsky models and it is set to 0.18 by default) .
40
41 param.ajouter_condition("value_of_cs_ge_0", "sous_maille_smago model constant must be positive.");
42}
43
45{
46 const Domaine_VDF& domaine_VDF = ref_cast(Domaine_VDF, le_dom_VF_.valeur());
47 double temps = mon_equation_->inconnue().temps();
48 DoubleTab& visco_turb = la_viscosite_turbulente_->valeurs();
49 int nb_elem = domaine_VDF.domaine().nb_elem();
50 const int nb_elem_tot = domaine_VDF.nb_elem_tot();
51
52 SMA_barre_.resize(nb_elem_tot);
54 if (visco_turb.size() != nb_elem)
55 {
56 Cerr << "Size error for the array containing the values of the turbulent viscosity." << finl;
57 exit();
58 }
59
60 Debog::verifier("Modele_turbulence_hyd_LES_Smago_VDF::calculer_viscosite_turbulente visco_turb 0", visco_turb);
61
62 for (int elem = 0; elem < nb_elem; elem++)
63 visco_turb[elem] = cs_ * cs_ * l_(elem) * l_(elem) * sqrt(SMA_barre_(elem));
64
65 Debog::verifier("Modele_turbulence_hyd_LES_Smago_VDF::calculer_viscosite_turbulente visco_turb 1", visco_turb);
66
67 la_viscosite_turbulente_->changer_temps(temps);
68 return la_viscosite_turbulente_;
69}
70
72{
73 Champ_Face_VDF& vit = ref_cast(Champ_Face_VDF, mon_equation_->inconnue());
74 const DoubleTab& vitesse = mon_equation_->inconnue().valeurs();
75 const Domaine_Cl_VDF& domaine_Cl_VDF = ref_cast(Domaine_Cl_VDF, le_dom_Cl_.valeur());
76 const Domaine_VDF& domaine_VDF = ref_cast(Domaine_VDF, le_dom_VF_.valeur());
77 const int nb_elem_tot = domaine_VDF.nb_elem_tot();
78
79 int i, j;
80 int elem;
81 //DoubleTab psc(dimension,dimension);
82
83 assert(vitesse.line_size() == 1);
84 DoubleTab duidxj(nb_elem_tot, dimension, dimension, vitesse.line_size());
85
86 vit.calcul_duidxj(vitesse, duidxj, domaine_Cl_VDF);
87
88 double Sij, temp;
89 for (elem = 0; elem < nb_elem_tot; elem++)
90 {
91 temp = 0.;
92 for (i = 0; i < dimension; i++)
93 for (j = 0; j < dimension; j++)
94 //Deplacement du calcul de Sij
95 {
96 Sij = 0.5 * (duidxj(elem, i, j, 0) + duidxj(elem, j, i, 0));
97 temp += Sij * Sij;
98 }
99 SMA_barre_(elem) = 2. * temp;
100 }
101}
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
int_t nb_elem() const
Definition Domaine.h:131
class Domaine_Cl_VDF
class Domaine_VDF
Definition Domaine_VDF.h:64
int nb_elem_tot() const
const Domaine & domaine() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Modele_turbulence_hyd_LES_Smago_VDF Cette classe correspond a la mise en oeuvre du modele sous
classe Modele_turbulence_hyd_LES_VDF_base Cette classe correspond a la mise en oeuvre des modeles sou...
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_condition(const char *condition, const char *message, const char *name=0)
Declare a post-read logical condition that must hold on the parameter values.
Definition Param.cpp:496
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