TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Convection_Diffusion_Chaleur_Turbulent_QC.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 <Convection_Diffusion_Chaleur_Turbulent_QC.h>
17#include <Probleme_base.h>
18#include <Milieu_base.h>
19#include <Param.h>
20
21Implemente_instanciable(Convection_Diffusion_Chaleur_Turbulent_QC, "Convection_Diffusion_Chaleur_Turbulent_QC", Convection_Diffusion_Chaleur_QC);
22// XD convection_diffusion_chaleur_turbulent_qc convection_diffusion_chaleur_QC convection_diffusion_chaleur_turbulent_qc INHERITS_BRACE Temperature equation for a quasi-compressible fluid as well as the associated turbulence model equations.
23// XD attr modele_turbulence modele_turbulence_scal_base modele_turbulence OPT Turbulence model for the temperature
24// XD_CONT (energy) conservation equation.
25
27{
28 return Equation_base::printOn(is);
29}
30
32{
34}
35
41
43{
44 if (mot == "diffusion")
45 {
46 Cerr << "Reading and typing of the diffusion operator : " << finl;
47 terme_diffusif.associer_diffusivite(diffusivite_pour_transport());
49 terme_diffusif.associer_diffusivite_pour_pas_de_temps(diffusivite_pour_pas_de_temps());
50 return 1;
51 }
52 else if (mot == "modele_turbulence")
53 {
54 lire_modele(is, *this);
55 RefObjU le_modele;
56 le_modele = le_modele_turbulence.valeur();
57 liste_modeles_.add_if_not(le_modele);
58 return 1;
59 }
60 else
62}
63
64/*! @brief for PDI IO: retrieve name, type and dimensions of the fields to save/restore
65 *
66 */
68{
69 std::vector<YAML_data> data = Convection_Diffusion_Chaleur_QC::data_a_sauvegarder();
70 std::vector<YAML_data> turb = Convection_Diffusion_Turbulent::data_a_sauvegarder();
71 data.insert(data.end(), turb.begin(), turb.end());
72 return data;
73}
74
75/*! @brief Saves to an output stream via a double call to: Convection_Diffusion_Chaleur_QC::sauvegarder(Sortie&);
76 *
77 * and Convection_Diffusion_Turbulent::sauvegarder(Sortie&);
78 *
79 * @param os Output stream.
80 * @return Always returns 1.
81 */
89
90/*! @brief Restores from an input stream via a double call to: Convection_Diffusion_Chaleur_QC::reprendre(Entree&);
91 *
92 * and Convection_Diffusion_Turbulent::reprendre(Entree&);
93 *
94 * @param is Input stream.
95 * @return Always returns 1.
96 */
103
104/*! @brief Double call to: Convection_Diffusion_Turbulent::completer()
105 *
106 * and Convection_Diffusion_Chaleur_QC::completer()
107 *
108 */
114
115/*! @brief Time update of the equation: calls Convection_Diffusion_Chaleur_QC::mettre_a_jour(double).
116 *
117 * The turbulence model update is called separately via mettre_a_jour_modele().
118 *
119 * @param temps Current time.
120 */
130
132{
134
135 if (le_modele_turbulence)
136 le_modele_turbulence->creer_champ(motlu);
137}
138
139bool Convection_Diffusion_Chaleur_Turbulent_QC::has_champ(const Motcle& nom, OBS_PTR(Champ_base)& ref_champ) const
140{
142 return true;
143
144 if (le_modele_turbulence)
145 if (le_modele_turbulence->has_champ(nom, ref_champ))
146 return true;
147
148 return false; /* nothing found */
149}
150
152{
154 return true;
155
156 if (le_modele_turbulence)
157 if (le_modele_turbulence->has_champ(nom))
158 return true;
159
160 return false; /* nothing found */
161}
162
164{
165 OBS_PTR(Champ_base) ref_champ;
166
168 return ref_champ;
169
170 if (le_modele_turbulence)
171 if (le_modele_turbulence->has_champ(nom, ref_champ))
172 return ref_champ;
173
174 throw std::runtime_error(std::string("Field ") + nom.getString() + std::string(" not found !"));
175}
176
178{
180
181 if (le_modele_turbulence)
182 le_modele_turbulence->get_noms_champs_postraitables(nom, opt);
183}
184
185/*! @brief Double call to: Convection_Diffusion_Turbulent::preparer_calcul()
186 *
187 * and Convection_Diffusion_Chaleur_QC::preparer_calcul()
188 *
189 * @return Always returns 1.
190 */
199{
201 le_modele_turbulence->imprimer(os);
202}
203
210
211const RefObjU& Convection_Diffusion_Chaleur_Turbulent_QC::get_modele(Type_modele type) const
212{
213 for (const auto &itr : liste_modeles_)
214 {
215 const RefObjU& mod = itr;
216 if (mod)
217 if ((sub_type(Modele_turbulence_scal_base, mod.valeur())) && (type == TURBULENCE))
218 return mod;
219 }
220 return Equation_base::get_modele(type);
221}
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
virtual void creer_champ(const Motcle &motlu)=0
virtual void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const =0
virtual bool has_champ(const Motcle &nom, OBS_PTR(Champ_base)&ref_champ) const =0
Particular case of Convection_Diffusion_Chaleur_Fluide_Dilatable_base for a quasi-compressible fluid,...
int preparer_calcul() override
Everything that does not depend on other possible problems.
void mettre_a_jour(double) override
The value of the unknown at the time step has been calculated.
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
Turbulent convection-diffusion of heat for a quasi-compressible fluid.
const RefObjU & get_modele(Type_modele type) const override
void mettre_a_jour(double) override
Time update of the equation: calls Convection_Diffusion_Chaleur_QC::mettre_a_jour(double).
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
int sauvegarder(Sortie &) const override
Saves to an output stream via a double call to: Convection_Diffusion_Chaleur_QC::sauvegarder(Sortie&)...
void imprimer(Sortie &os) const override
Prints the equation operators if the time scheme indicates it is necessary.
const Champ_base & get_champ(const Motcle &nom) const override
int reprendre(Entree &) override
Restores from an input stream via a double call to: Convection_Diffusion_Chaleur_QC::reprendre(Entree...
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
int preparer_calcul() override
Double call to: Convection_Diffusion_Turbulent::preparer_calcul().
void completer() override
Double call to: Convection_Diffusion_Turbulent::completer().
std::vector< YAML_data > data_a_sauvegarder() const override
for PDI IO: retrieve name, type and dimensions of the fields to save/restore
OBS_PTR(Fluide_Dilatable_base) le_fluide
int preparer_calcul()
Prepares the computation.
void completer()
Completes the turbulence model.
Entree & lire_op_diff_turbulent(Entree &, const Equation_base &, Operateur_Diff &)
Entree & lire_modele(Entree &, const Equation_base &)
virtual int sauvegarder(Sortie &) const
Simple call to Modele_turbulence_scal_base::sauvegarder(Sortie&) on the turbulence member.
virtual void mettre_a_jour(double)
Time update of the turbulence model.
virtual int reprendre(Entree &)
Restores from a checkpoint via an input stream.
virtual std::vector< YAML_data > data_a_sauvegarder() const
for PDI IO: retrieve name, type and dimensions of the fields to save/restore
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
int reprendre(Entree &) override
We resume the unknown from an input stream.
virtual const RefObjU & get_modele(Type_modele type) const
virtual std::vector< YAML_data > data_a_sauvegarder() const
for PDI IO: retrieve name, type and dimensions of the data to save/restore. This has to be overrode f...
virtual void imprimer(Sortie &os) const
Prints the equation operators if the time scheme indicates it is necessary.
virtual void completer()
Completes the construction (initialization) of objects associated with the equation.
int sauvegarder(Sortie &) const override
We save the unknown, then the source terms to an output stream.
virtual bool initTimeStep(double dt)
Allocation and initialization of the unknown and boundary conditions until present+dt.
Base class for scalar turbulence models coupled to a Navier-Stokes convection-diffusion equation.
A character string (Nom) in uppercase.
Definition Motcle.h:26
const std::string & getString() const
Definition Nom.h:92
An array of character strings (VECT(Nom)).
Definition Noms.h:26
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
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
@ REQUIRED
Definition Param.h:115
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
Base class for output streams.
Definition Sortie.h:52
const Objet_U & valeur() const
Definition TRUST_Ref.h:134