TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Convection_Diffusion_Espece_Multi_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_Espece_Multi_Turbulent_QC.h>
17#include <Probleme_base.h>
18#include <TRUSTTrav.h>
19#include <Debog.h>
20#include <Param.h>
21
22Implemente_instanciable(Convection_Diffusion_Espece_Multi_Turbulent_QC, "Convection_Diffusion_Espece_Multi_Turbulent_QC", Convection_Diffusion_Espece_Multi_QC);
23// XD convection_diffusion_espece_multi_turbulent_qc eqn_base convection_diffusion_espece_multi_turbulent_qc INHERITS_BRACE not_set
24// XD attr modele_turbulence modele_turbulence_scal_base modele_turbulence OPT Turbulence model to be used.
25// XD attr espece espece espece REQ not_set
26
28
30
36
38{
39 if (mot == "diffusion")
40 {
41 Cerr << "Reading and typing of the diffusion operator : " << finl;
42 terme_diffusif.associer_diffusivite(diffusivite_pour_transport());
43 ref_cast_non_const(Champ_base,terme_diffusif.diffusivite()).nommer("mu_sur_Schmidt");
45 //We need to call associer_diffusivite_pour_pas_de_temps and currently pass
46 //mu_sur_Schmidt which must be replaced by nu_sur_Schmidt
47 terme_diffusif.associer_diffusivite_pour_pas_de_temps(diffusivite_pour_pas_de_temps());
48 return 1;
49 }
50 else if (mot == "modele_turbulence")
51 {
52 lire_modele(is, *this);
53 RefObjU le_modele;
54 le_modele = le_modele_turbulence.valeur();
55 liste_modeles_.add_if_not(le_modele);
56 return 1;
57 }
58 else
60}
61
62/*! @brief Double call to: Convection_Diffusion_Turbulent::completer()
63 *
64 * and Convection_Diffusion_Espece_Multi_QC::completer()
65 *
66 */
68{
71}
72
74{
76
77 if (le_modele_turbulence)
78 le_modele_turbulence->creer_champ(motlu);
79}
80
81bool Convection_Diffusion_Espece_Multi_Turbulent_QC::has_champ(const Motcle& nom, OBS_PTR(Champ_base)& ref_champ) const
82{
84 return true;
85
86 if (le_modele_turbulence)
87 if (le_modele_turbulence->has_champ(nom, ref_champ))
88 return true;
89
90 return false; /* nothing found */
91}
92
94{
96 return true;
97
98 if (le_modele_turbulence)
99 if (le_modele_turbulence->has_champ(nom))
100 return true;
101
102 return false; /* nothing found */
103}
104
106{
107 OBS_PTR(Champ_base) ref_champ;
108
110 return ref_champ;
111
112 if (le_modele_turbulence)
113 if (le_modele_turbulence->has_champ(nom, ref_champ))
114 return ref_champ;
115
116 throw std::runtime_error(std::string("Field ") + nom.getString() + std::string(" not found !"));
117}
118
120{
122
123 if (le_modele_turbulence)
124 le_modele_turbulence->get_noms_champs_postraitables(nom, opt);
125}
126/*! @brief Time update of the equation via a double call to: Convection_Diffusion_Espece_Multi_QC::mettre_a_jour(double)
127 *
128 * and Convection_Diffusion_Turbulent::mettre_a_jour(double).
129 *
130 * @param temps Current time.
131 */
132void Convection_Diffusion_Espece_Multi_Turbulent_QC::mettre_a_jour(double temps)
133{
136}
137/*! @brief Double call to: Convection_Diffusion_Turbulent::preparer_calcul()
138 *
139 * and Convection_Diffusion_Espece_Multi_QC::preparer_calcul()
140 *
141 * @return Always returns 1.
142 */
144{
147 return 1;
148}
149
150/*! @brief for PDI IO: retrieve name, type and dimensions of the fields to save/restore
151 *
152 */
154{
155 std::vector<YAML_data> data = Convection_Diffusion_Espece_Multi_QC::data_a_sauvegarder();
156 std::vector<YAML_data> turb = Convection_Diffusion_Turbulent::data_a_sauvegarder();
157 data.insert(data.end(), turb.begin(), turb.end());
158 return data;
159}
160
161/*! @brief Saves to an output stream via a double call to: Convection_Diffusion_Espece_Multi_QC::sauvegarder(Sortie&)
162 *
163 * and Convection_Diffusion_Turbulent::sauvegarder(Sortie&).
164 *
165 * @param os Output stream.
166 * @return Always returns 1.
167 */
168int Convection_Diffusion_Espece_Multi_Turbulent_QC::sauvegarder(Sortie& os) const
169{
170 int bytes = 0;
173 return bytes;
174}
175
176/*! @brief Restores from an input stream via a double call to: Convection_Diffusion_Espece_Multi_QC::reprendre(Entree&)
177 *
178 * and Convection_Diffusion_Turbulent::reprendre(Entree&).
179 *
180 * @param is Input stream.
181 * @return Always returns 1.
182 */
183int Convection_Diffusion_Espece_Multi_Turbulent_QC::reprendre(Entree& is)
184{
187 return 1;
188}
189
191{
192 for (const auto &itr : liste_modeles_)
193 {
194 const RefObjU& mod = itr;
195 if (mod)
196 if ((sub_type(Modele_turbulence_scal_base, mod.valeur())) && (type == TURBULENCE))
197 return mod;
198 }
199 return Equation_base::get_modele(type);
200}
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_Espece_Multi_base for a quasi-compressible fluid when the tra...
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
void completer() override
Associe l inconnue de l equation a la loi d etat,.
const Champ_base & diffusivite_pour_pas_de_temps() const override
Turbulent convection-diffusion of multiple species for a quasi-compressible fluid.
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
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 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 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.
virtual int preparer_calcul()
Everything that does not depend on other possible problems.
int sauvegarder(Sortie &) const override
We save the unknown, then the source terms to an output stream.
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