TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Transport_K_Eps_Realisable.cpp
1/****************************************************************************
2* Copyright (c) 2019, 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 <Transport_K_Eps_Realisable.h>
17#include <Modele_turbulence_hyd_K_Eps_Realisable.h>
18#include <Les_Pb_Turb.h>
19#include <Param.h>
20#include <Fluide_base.h>
21
22Implemente_instanciable(Transport_K_Eps_Realisable,"Transport_K_Epsilon_Realisable",Transport_K_Eps_base);
23
24// XD Transport_K_Epsilon_Realisable transport_equation_deriv Transport_K_Epsilon_Realisable INHERITS_BRACE Realizable
25// XD_CONT K-Epsilon Turbulence Model Transport Equations for K and Epsilon.
26
27// printOn et readOn
28
30{
31 return s << que_suis_je() << "\n";
32}
33
35{
36 // Lecture des attributs de l'equation
38 return is;
39}
40
41
43{
44 // [2026-01-23 ven.] TODO: convert with_nu_ into a boolean, delete the dictionnary, update all data files
46 param.ajouter("with_nu",&with_nu_); // XD_ADD_P int
47 // XD_CONT Add the kinematic viscosity in the diffusion operator
48 param.dictionnaire("no",0);
49 param.dictionnaire("yes",1);
50}
51
53{
54 if (mot=="diffusion")
55 {
56 Cerr << "Reading and typing of the diffusion operator : " << finl;
57 terme_diffusif.associer_diffusivite(diffusivite_pour_transport());
59 return 1;
60 }
61 else if (mot=="convection")
62 {
63 Cerr << "Reading and typing of the convection operator : " << finl;
64 const Champ_base& vit_transp = vitesse_pour_transport();
65 associer_vitesse(vit_transp);
66 terme_convectif.associer_vitesse(vit_transp);
67 is >> terme_convectif;
68 return 1;
69 }
70 else
72}
73
74// Retour: int
75// Signification: le nombre d'operateurs de l'equation
76// Contraintes: toujours egal a 2
78{
79 return 2;
80}
81
82/*! @brief renvoie terme_diffusif si i=0 renvoie terme_convectif si i=1
83 *
84 * exit si i>1
85 *
86 */
88{
89 switch(i)
90 {
91 case 0:
92 return terme_diffusif;
93 case 1:
94 return terme_convectif;
95 default :
96 Cerr << "Error for "<<que_suis_je()<<"::operateur("<<i<<") !! " << finl;
97 Cerr << que_suis_je()<<" has " << nombre_d_operateurs() <<" operators "<<finl;
98 Cerr << "and you are trying to access the " << i <<" th one."<< finl;
100 }
101 // Pour les compilos!!
102 return terme_diffusif;
103}
104
105/*! @brief renvoie terme_diffusif si i=0 renvoie terme_convectif si i=1
106 *
107 * exit si i>1
108 *
109 */
111{
112 switch(i)
113 {
114 case 0:
115 return terme_diffusif;
116 case 1:
117 return terme_convectif;
118 default :
119 Cerr << "Error for "<<que_suis_je()<<"::operateur("<<i<<") !! " << finl;
120 Cerr << que_suis_je()<<" has " << nombre_d_operateurs() <<" operators "<<finl;
121 Cerr << "and you are trying to access the " << i <<" th one."<< finl;
123 }
124 // Pour les compilos!!
125 return terme_diffusif;
126}
127
129{
130 const Fluide_base& fluide_inc = ref_cast(Fluide_base,le_fluide.valeur());
131 return fluide_inc.viscosite_cinematique();
132}
133
135{
136 const Champ_base& vitesse_transportante = probleme().equation(0).inconnue();
137 return vitesse_transportante;
138}
139
140
142{
143 // Ajout automatique du terme source
144 if (les_sources.est_vide())
145 {
146 Source t;
147 Source& so=les_sources.add(t);
148 const Probleme_base& pb = probleme();
149 Cerr << "Construction and typing for the source term of the Transport_K_Eps_Realisable equation." << finl;
150 if (sub_type(Pb_Hydraulique_Turbulent,pb) || milieu().que_suis_je()=="Fluide_Quasi_Compressible")
151 {
152 Nom typ = "Source_Transport_K_Eps_Realisable";
153 so.typer(typ,*this);
154 }
155 else if (sub_type(Pb_Thermohydraulique_Turbulent,pb))
156 {
157 Nom typ = "Source_Transport_K_Eps_Realisable_anisotherme";
158 so.typer(typ,*this);
159 }
160 else if (sub_type(Pb_Hydraulique_Concentration_Turbulent,pb))
161 {
162 Nom typ = "Source_Transport_K_Eps_Realisable_aniso_concen";
163 so.typer(typ,*this);
164 }
166 {
167 Nom typ = "Source_Transport_K_Eps_Realisable_aniso_therm_concen";
168 so.typer(typ,*this);
169 }
170 else
171 {
172 Cerr<<"The equation "<<que_suis_je()<<" cannot be associated to a problem "<<pb.que_suis_je()<<finl;
173 abort();
174 }
175 so->associer_eqn(*this);
176 }
178}
179
181{
182 const Equation_base& eqn_hydr = modele.equation();
183 associer(eqn_hydr);
184 associer_milieu_base(eqn_hydr.milieu());
185 associer_vitesse(eqn_hydr.inconnue());
186 mon_modele = ref_cast(Modele_turbulence_hyd_K_Eps_Realisable,modele);
187 RefObjU le_modele;
188 le_modele = mon_modele.valeur();
189 liste_modeles_.add_if_not(le_modele);
190 discretiser();
191}
192
194{
195 le_fluide = ref_cast(Fluide_base, un_milieu);
196}
197
199{
200 static Motcle domaine = "Transport_Keps_Rea";
201 return domaine;
202}
class Champ_Don_base base class of Given Fields (not calculated)
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Equation_base The role of an equation is the calculation of one or more fields....
virtual const Milieu_base & milieu() const =0
virtual const Champ_Inc_base & inconnue() const =0
virtual void completer()
Completes the construction (initialization) of objects associated with the equation.
Sources les_sources
Probleme_base & probleme()
Returns the problem associated with the equation.
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
Base class for an incompressible fluid and its properties:
Definition Fluide_base.h:36
const Champ_Don_base & viscosite_cinematique() const
Definition Fluide_base.h:56
Milieu_base This class is the base of the (physical) medium hierarchy.
Definition Milieu_base.h:50
Classe Modele_turbulence_hyd_2_eq_base Classe de base des modeles de type RANS a deux equations.
class Modele_turbulence_hyd_K_Eps_Realisable
Equation_base & equation()
Returns the equation associated with the turbulence model.
A character string (Nom) in uppercase.
Definition Motcle.h:26
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
class Operateur Generic class of the operator hierarchy.
Definition Operateur.h:39
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void dictionnaire(const char *option_name, int value)
Add an (option name, integer value) entry to the dictionary attached to a previously registered integ...
Definition Param.cpp:293
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
Turbulent hydraulics problem with species transport (one or more concentrations).
Turbulent hydraulics problem.
Turbulent thermohydraulics problem with species transport (one or more concentrations).
Turbulent thermohydraulics problem.
class Probleme_base It is a Probleme_U that is not a coupling.
virtual const Equation_base & equation(int) const =0
static void abort()
Abort routine for TRUST on a fatal error.
Definition Process.cpp:573
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52
Source Generic class of the source term hierarchy. A Source object can.
Definition Source.h:33
void typer(const Nom &, const Equation_base &)
Types the source by computing the required type name from the provided parameters.
Definition Source.cpp:52
const Objet_U & valeur() const
Definition TRUST_Ref.h:134
Operateur_Conv terme_convectif
void associer_vitesse(const Champ_base &)
Milieu_base & milieu() override
Renvoie le milieu (fluide) associe a l'equation.
Operateur_Diff terme_diffusif
void associer(const Equation_base &)
Entree & lire_op_diff_turbulent(Entree &is)
void set_param(Param &titi) const override
const Motcle & domaine_application() const override
Returns "indeterminate" Navier_Stokes_standard for example overrides this method.
virtual const Champ_Don_base & diffusivite_pour_transport() const
void associer_milieu_base(const Milieu_base &) override
Associe un milieu physique a l'equation.
void completer() override
Completes the construction (initialization) of objects associated with the equation.
virtual const Champ_base & vitesse_pour_transport() const
void associer_modele_turbulence(const Modele_turbulence_hyd_2_eq_base &) override
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
const Operateur & operateur(int) const override
renvoie terme_diffusif si i=0 renvoie terme_convectif si i=1
Classe Transport_K_Eps_base Classe de base pour les equations.
void discretiser() override
Discretizes the equation.
virtual void set_param(Param &) const override