TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Viscosite_turbulente_multiple.cpp
1/****************************************************************************
2* Copyright (c) 2024, 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_multiple.h>
17#include <Param.h>
18#include <Probleme_base.h>
19#include <Champ_base.h>
20#include <TRUSTTab_parts.h>
21#include <TRUSTTab.h>
22#include <TRUSTTrav.h>
23#include <MD_Vector_tools.h>
24
25
26Implemente_instanciable(Viscosite_turbulente_multiple, "Viscosite_turbulente_multiple", Viscosite_turbulente_base);
27
29{
30 return os;
31}
32
34{
35 Motcle mot;
36 is >> mot;
37 if (mot != "{")
38 {
39 Cerr << "Multiple turbulent viscosities : { expected instead of " << mot << finl;
41 }
42
43 for (is >> mot; mot != "}"; is >> mot)
44 if (viscs_turbs.count(mot.getString()))
45 Process::exit(que_suis_je() + " : a correlation already exists for " + mot + " !");
46 else
47 Correlation_base::typer_lire_correlation(viscs_turbs[mot.getString()], pb_.valeur(), "viscosite_turbulente", is);
48 return is;
49}
50
52{
53 //On fait appel aux correlations d'en_dessous
54 nu_t = 0;
55 DoubleTrav nu_loc = DoubleTrav(nu_t);
56 for (auto &&corr : viscs_turbs)
57 {
58 nu_loc = 0;
59 ref_cast(Viscosite_turbulente_base, corr.second.valeur()).eddy_viscosity(nu_loc);
60 for (int i = 0; i < nu_t.dimension_tot(0); i++)
61 for (int n = 0; n < nu_t.dimension(1); n++)
62 nu_t(i, n) += nu_loc(i,n);
63 }
64}
65
66void Viscosite_turbulente_multiple::reynolds_stress(DoubleTab& R_ij) const // Renvoie <u_i'u_j'>
67{
68 int D = dimension;
69 R_ij = 0;
70 DoubleTrav R_ij_loc = DoubleTrav(R_ij);
71 for (auto &&corr : viscs_turbs)
72 {
73 R_ij_loc = 0;
74 ref_cast(Viscosite_turbulente_base, corr.second.valeur()).reynolds_stress(R_ij_loc);
75 for (int i = 0; i < R_ij.dimension(0); i++)
76 for (int n = 0; n < R_ij.dimension(1); n++)
77 for (int d = 0; d < D; d++)
78 for (int db = 0; db < D; db++)
79 R_ij(i, n, d, db) += R_ij_loc(i, n, d, db);
80 }
81}
82
83void Viscosite_turbulente_multiple::reynolds_stress_BIF(DoubleTab& R_ij) const // Renvoie <u_i'u_j'>
84{
85 int D = dimension;
86 R_ij = 0;
87 DoubleTrav R_ij_loc = DoubleTrav(R_ij);
88 for (auto &&corr : viscs_turbs)
89 if ((corr.first == "BIF") || (corr.first == "WIF") || (corr.first == "WIT") || (corr.first == "SATO"))
90 {
91 R_ij_loc = 0;
92 ref_cast(Viscosite_turbulente_base, corr.second.valeur()).reynolds_stress(R_ij_loc);
93 for (int i = 0; i < R_ij.dimension(0); i++)
94 for (int n = 0; n < R_ij.dimension(1); n++)
95 for (int d = 0; d < D; d++)
96 for (int db = 0; db < D; db++)
97 R_ij(i, n, d, db) += R_ij_loc(i, n, d, db);
98 }
99}
100
101void Viscosite_turbulente_multiple::k_over_eps(DoubleTab& k_sur_eps) const
102{
103 k_sur_eps = 0;
104 DoubleTrav k_sur_eps_loc = DoubleTrav(k_sur_eps);
105 for (auto &&corr : viscs_turbs)
106 {
107 k_sur_eps_loc = 0;
108 ref_cast(Viscosite_turbulente_base, corr.second.valeur()).k_over_eps(k_sur_eps_loc);
109 for (int i = 0; i < k_sur_eps.dimension_tot(0); i++)
110 for (int n = 0; n < k_sur_eps.dimension(1); n++)
111 k_sur_eps(i, n) += k_sur_eps_loc(i,n);
112 }
113
114}
115
116void Viscosite_turbulente_multiple::eps(DoubleTab& eps_) const
117{
118 eps_ = 0;
119 DoubleTrav eps_loc = DoubleTrav(eps_);
120 for (auto &&corr : viscs_turbs)
121 {
122 eps_loc = 0;
123 ref_cast(Viscosite_turbulente_base, corr.second.valeur()).eps(eps_loc);
124 for (int i = 0; i < eps_.dimension_tot(0); i++)
125 for (int n = 0; n < eps_.dimension(1); n++)
126 eps_(i, n) += eps_loc(i,n);
127 }
128}
static void typer_lire_correlation(OWN_PTR(Correlation_base)&, const Probleme_base &, const Nom &, Entree &)
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const std::string & getString() const
Definition Nom.h:92
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
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
classe Viscosite_turbulente_base correlations de viscosite turbulente decrivant le tenseur de Reynold...
classe Viscosite_turbulente_multiple Classe qui peut contenir plusieurs viscosites turbulentes pour f...
void eddy_viscosity(DoubleTab &nu_t) const override
void eps(DoubleTab &eps) const override
void k_over_eps(DoubleTab &k_sur_eps) const override
void reynolds_stress(DoubleTab &R_ij) const override
void reynolds_stress_BIF(DoubleTab &R_ij) const