TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Convection_Diffusion_Temperature_Turbulent.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_Temperature_Turbulent.h>
17#include <Fluide_Incompressible.h>
18#include <Param.h>
19
20Implemente_instanciable(Convection_Diffusion_Temperature_Turbulent, "Convection_Diffusion_Temperature_Turbulent", Convection_Diffusion_Temperature);
21// XD convection_diffusion_temperature_turbulent eqn_base convection_diffusion_temperature_turbulent INHERITS_BRACE
22// XD_CONT Energy equation (temperature diffusion convection) as well as the associated turbulence model equations.
23// XD attr modele_turbulence modele_turbulence_scal_base modele_turbulence OPT Turbulence model for the energy equation.
24
26
28
34
36{
37 if (mot == "diffusion")
38 {
39 Cerr << "Reading and typing of the diffusion operator : " << finl;
40 terme_diffusif.associer_diffusivite(diffusivite_pour_transport());
42 // the field for dt_stab is the same as that of the operator
43 terme_diffusif.associer_diffusivite_pour_pas_de_temps(diffusivite_pour_pas_de_temps());
44 return 1;
45 }
46 else if (mot == "modele_turbulence")
47 {
48 lire_modele(is, *this);
49 RefObjU le_modele;
50 le_modele = le_modele_turbulence.valeur();
51 liste_modeles_.add_if_not(le_modele);
52 return 1;
53 }
54 else
56}
57
58/*! @brief for PDI IO: retrieve name, type and dimensions of the fields to save/restore
59 *
60 */
62{
63 std::vector<YAML_data> data = Convection_Diffusion_Temperature::data_a_sauvegarder();
64 std::vector<YAML_data> turb = Convection_Diffusion_Turbulent::data_a_sauvegarder();
65 data.insert(data.end(), turb.begin(), turb.end());
66 return data;
67}
68
69/*! @brief Saves to an output stream via a double call to: Convection_Diffusion_Temperature::sauvegarder(Sortie&);
70 *
71 * Convection_Diffusion_Turbulent::sauvegarder(Sortie&);
72 *
73 * @param os Output stream.
74 * @return Always returns 1.
75 */
83
84/*! @brief Restores from an input stream via a double call to: Convection_Diffusion_Temperature::reprendre(Entree&);
85 *
86 * Convection_Diffusion_Turbulent::reprendre(Entree&);
87 *
88 * @param is Input stream.
89 * @return Always returns 1.
90 */
97
98/*! @brief Double call to: Convection_Diffusion_Turbulent::completer()
99 *
100 * and Convection_Diffusion_Temperature::completer()
101 *
102 */
108
109/*! @brief Time update of the equation via a double call to: Convection_Diffusion_Temperature::mettre_a_jour(double);
110 *
111 * and Convection_Diffusion_Turbulent::mettre_a_jour(double);
112 *
113 * @param temps Current time.
114 */
120
122{
124
125 if (le_modele_turbulence)
126 le_modele_turbulence->creer_champ(motlu);
127}
128
129bool Convection_Diffusion_Temperature_Turbulent::has_champ(const Motcle& nom, OBS_PTR(Champ_base)& ref_champ) const
130{
132 return true;
133
134 if (le_modele_turbulence)
135 if (le_modele_turbulence->has_champ(nom, ref_champ))
136 return true;
137
138 return false; /* nothing found */
139}
140
142{
144 return true;
145
146 if (le_modele_turbulence)
147 if (le_modele_turbulence->has_champ(nom))
148 return true;
149
150 return false; /* nothing found */
151}
152
154{
155 OBS_PTR(Champ_base) ref_champ;
156
158 return ref_champ;
159
160 if (le_modele_turbulence)
161 if (le_modele_turbulence->has_champ(nom, ref_champ))
162 return ref_champ;
163
164 throw std::runtime_error(std::string("Field ") + nom.getString() + std::string(" not found !"));
165}
166
168{
170 if (le_modele_turbulence)
171 le_modele_turbulence->get_noms_champs_postraitables(nom, opt);
172}
173
174/*! @brief Double call to: Convection_Diffusion_Turbulent::preparer_calcul()
175 *
176 * and Convection_Diffusion_Temperature::preparer_calcul()
177 *
178 * @return Always returns 1.
179 */
186
193
195{
197 le_modele_turbulence->imprimer(os);
198}
199
200const RefObjU& Convection_Diffusion_Temperature_Turbulent::get_modele(Type_modele type) const
201{
202 for (const auto &itr : liste_modeles_)
203 {
204 const RefObjU& mod = itr;
205 if (mod)
206 if ((sub_type(Modele_turbulence_scal_base, mod.valeur())) && (type == TURBULENCE))
207 return mod;
208 }
209 return Equation_base::get_modele(type);
210}
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
Turbulent convection-diffusion equation when the unknown is temperature.
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
std::vector< YAML_data > data_a_sauvegarder() const override
for PDI IO: retrieve name, type and dimensions of the fields to save/restore
int sauvegarder(Sortie &) const override
Saves to an output stream via a double call to: Convection_Diffusion_Temperature::sauvegarder(Sortie&...
void mettre_a_jour(double) override
Time update of the equation via a double call to: Convection_Diffusion_Temperature::mettre_a_jour(dou...
void completer() override
Double call to: Convection_Diffusion_Turbulent::completer().
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
int reprendre(Entree &) override
Restores from an input stream via a double call to: Convection_Diffusion_Temperature::reprendre(Entre...
void imprimer(Sortie &os) const override
Prints the equation operators if the time scheme indicates it is necessary.
int preparer_calcul() override
Double call to: Convection_Diffusion_Turbulent::preparer_calcul().
const Champ_base & get_champ(const Motcle &nom) const override
const RefObjU & get_modele(Type_modele type) const override
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
const Champ_Don_base & diffusivite_pour_transport() const override
const Champ_base & diffusivite_pour_pas_de_temps() const override
Convection_Diffusion_Temperature Special case of Convection_Diffusion_std.
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
void creer_champ(const Motcle &motlu) override
int preparer_calcul() override
Everything that does not depend on other possible problems.
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 mettre_a_jour(double temps)
The value of the unknown at the time step has been calculated.
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