TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Transport_K_KEps.cpp
1/****************************************************************************
2* Copyright (c) 2015 - 2016, 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_KEps.h>
17#include <Modele_turbulence_hyd_K_Eps_2_Couches.h>
18#include <Les_Pb_Turb.h>
19#include <Param.h>
20#include <Fluide_base.h>
21
22Implemente_instanciable(Transport_K_KEps, "Transport_K_KEps", Transport_K_Eps_non_std);
23// XD Transport_K_KEps Transport_K_Eps_non_std Transport_K_KEps BRACE Transport equation for the k-epsilon model using
24// XD_CONT the two-layer wall function.
25
26/*! @brief Imprime le type de l'equation sur un flot de sortie.
27 *
28 * @param (Sortie& s) un flot de sortie
29 * @return (Sortie&) le flot de sortie modifie
30 */
32{
33 return s << que_suis_je() << "\n";
34}
35
36/*! @brief Lit les specifications d'une equation de transport K-epsilon a partir d'un flot d'entree.
37 *
38 * Controle dynamique du type du terme source.
39 *
40 * @param (Entree& s) un flot d'entree
41 * @return (Entree&) le flot d'entree modifie
42 */
44{
45 // Lecture des attributs de l'equation
46 loi_2couches.typer("2couches_conv_nat");
48
49 // Ajout automatique du terme source si pas instancie dans le jeu ed donnees
50 if (les_sources.est_vide())
51 {
52 Source t;
53 Source& so = les_sources.add(t);
54 const Probleme_base& pb = probleme();
55 Cerr << "Construction and typing for the source term of the Transport_K_KEps equation." << finl;
56 Nom type = "";
57 if (sub_type(Pb_Hydraulique_Turbulent, pb))
58 type = "Source_Transport_K_KEps";
59 else if (sub_type(Pb_Thermohydraulique_Turbulent, pb))
60 type = "Source_Transport_K_KEps_anisotherme";
61 else
62 Process::exit("Problem must be (thermo)hydraulique_turbulent.\n");
63
64 so.typer(type, *this);
65
66 so->associer_eqn(*this);
67 }
68 return s;
69}
70
72{
74 param.ajouter("nb_couches", &nb_couches); // XD_ADD_P int
75 // XD_CONT Number of cells layer where the model is applied
76 param.ajouter("ystar_switch", &ystar_switch); // XD_ADD_P int
77 // XD_CONT Value of y* to delimit the two layers
78 param.ajouter_non_std("conv_forcee", (this)); // XD_ADD_P chaine
79 // XD_CONT Activate the forced convection model
80 param.ajouter_non_std("conv_nat", (this)); // XD_ADD_P chaine
81 // XD_CONT Activate the natural convection model
82 param.ajouter_non_std("nut_switch", (this)); // XD_ADD_P int
83 // XD_CONT Value of nut/nu which delimites the two layers
84 param.ajouter_flag("impr", &impr); // XD_ADD_P rien
85 // XD_CONT To print or not the 2 layers zone in the out file (default = false)
86 param.ajouter("loi_2couches", (this));
87}
88
90{
91 if (mot == "conv_forcee")
92 {
93 loi_2couches.typer("2couches_conv_forcee");
94 return 1;
95 }
96 else if (mot == "conv_nat")
97 {
98 loi_2couches.typer("2couches_conv_nat");
99 return 1;
100 }
101 else if (mot == "nut_switch")
102 {
103 type_switch = 1;
104 is >> nut_switch;
105 return 1;
106 }
107 else if (mot == "loi_2couches")
108 {
109 Motcle motbis, accolade_fermee="}", accolade_ouverte="{";
110 is >> motbis;
111 if (motbis != accolade_ouverte)
112 {
113 Cerr << "A { was expected while reading loi_2couches" << finl;
114 Cerr << "instead of : " << motbis << finl;
116 }
117 is >> motbis;
118 loi_2couches.typer(motbis);
119 is >> motbis;
120 if(motbis != accolade_fermee)
121 {
122 Cerr << "A } was expected when ending to read loi_2couches" << finl;
123 Cerr << "instead of : " << motbis << finl;
125 }
126 return 1;
127 }
128 else
130}
131
132/*! @brief Associe un modele de turbulence K-epsilon deux couches a l'equation.
133 *
134 * @param (Modele_turbulence_hyd_K_Eps_2_Couches& modele) le modele de turbulence K-epsilon deux couches a associer a l'equation
135 */
137{
138 const Equation_base& eqn_hydr = modele.equation();
139 associer(eqn_hydr);
140 associer_milieu_base(eqn_hydr.milieu());
141 associer_vitesse(eqn_hydr.inconnue());
142 mon_modele = ref_cast(Modele_turbulence_hyd_K_Eps_2_Couches, modele);
143 RefObjU le_modele;
144 le_modele = mon_modele.valeur();
145 liste_modeles_.add_if_not(le_modele);
146 discretiser();
147}
148
149
150/*! @brief Associe un milieu physique a l'equation.
151 *
152 * Le Milieu_base passe en parametre est caste en Fluide_Incompressible.
153 *
154 * @param (Milieu_base& un_milieu) le milieu physique a associer a l'equation
155 */
157{
158 le_fluide = ref_cast(Fluide_base, un_milieu);
159}
160
161
162/*! @brief Renvoie le nom du domaine d'application de l'equation.
163 *
164 * Ici "Transport_Keps".
165 *
166 * @return (Motcle&) le nom du domaine d'application de l'equation
167 */
169{
170 static Motcle domaine = "Transport_Keps";
171 return domaine;
172}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
virtual const Milieu_base & milieu() const =0
virtual const Champ_Inc_base & inconnue() const =0
Sources les_sources
Probleme_base & probleme()
Renvoie le probleme associe a l'equation.
classe Fluide_base Cette classe represente un d'un fluide incompressible ainsi que
Definition Fluide_base.h:38
classe Milieu_base Cette classe est la base de la hierarchie des milieux (physiques)
Definition Milieu_base.h:50
Classe Modele_turbulence_hyd_2_eq_base Classe de base des modeles de type RANS a deux equations.
Classe Modele_turbulence_hyd_K_Eps_2_Couches Cette classe represente le modele de turbulence (k,...
Equation_base & equation()
Renvoie l'equation associee au modele de turbulence.
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
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
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter_flag(const char *keyword, const bool *value)
Register a boolean flag whose mere presence switches it to true.
Definition Param.cpp:474
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
void ajouter_non_std(const char *keyword, const Objet_U *value, Param::Nature nat=Param::OPTIONAL)
Register a keyword handled by Objet_U::lire_motcle_non_standard.
Definition Param.cpp:489
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
void typer(const Nom &, const Equation_base &)
Type la source en calculant le nom du type necessaire grace aux parametres fournis.
Definition Source.cpp:52
const Objet_U & valeur() const
Definition TRUST_Ref.h:134
void associer_vitesse(const Champ_base &)
void associer(const Equation_base &)
void discretiser() override
Discretise l'equation.
Classe Transport_K_Eps_non_std Classe de base pour les equations de transport.
int lire_motcle_non_standard(const Motcle &, Entree &) override
Lecture des parametres de type non simple d'un objet_U a partir d'un flot d'entree.
void set_param(Param &titi) const override
classe Transport_K_KEps Cette classe represente l'equation de transport de l'energie cinetique
void set_param(Param &titi) const override
int lire_motcle_non_standard(const Motcle &, Entree &) override
Lecture des parametres de type non simple d'un objet_U a partir d'un flot d'entree.
const Motcle & domaine_application() const override
Renvoie le nom du domaine d'application de l'equation.
void associer_modele_turbulence(const Modele_turbulence_hyd_2_eq_base &) override
Associe un modele de turbulence K-epsilon deux couches a l'equation.
void associer_milieu_base(const Milieu_base &) override
Associe un milieu physique a l'equation.