TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Convection_Diffusion_Concentration_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_Concentration_Turbulent.h>
17#include <Constituant.h>
18#include <Param.h>
19
20Implemente_instanciable_sans_constructeur(Convection_Diffusion_Concentration_Turbulent, "Convection_Diffusion_Concentration_Turbulent", Convection_Diffusion_Concentration);
21// XD convection_diffusion_concentration_turbulent convection_diffusion_concentration convection_diffusion_concentration_turbulent INHERITS_BRACE Constituent transport equations (concentration diffusion convection) as well as the associated turbulence model equations.
22// XD attr modele_turbulence modele_turbulence_scal_base modele_turbulence OPT Turbulence model to be used in the
23// XD_CONT constituent transport equations. The only model currently available is Schmidt.
24
26
28{
29 //On conserve cette initialisation ici car si on la deplace dans le constructeur
30 //elle est ecrasee par Convection_Diffusion_Concentration::discretiser()
33 return is;
34}
35
37{
39 param.ajouter("constituants", &nb_constituants_);
40 param.ajouter_non_std("modele_turbulence", (this), Param::REQUIRED);
41}
42
44{
45 if (mot == "diffusion")
46 {
47 Cerr << "Reading and typing of the diffusion operator : " << finl;
48 terme_diffusif.associer_diffusivite(diffusivite_pour_transport());
50 // GF pas sur que cela soit boin
51 // le champ pour le dt_stab est le meme que celui de l'operateur
52 terme_diffusif.associer_diffusivite_pour_pas_de_temps(diffusivite_pour_pas_de_temps());
53 return 1;
54 }
55 else if (mot == "modele_turbulence")
56 {
57 lire_modele(is, *this);
58 RefObjU le_modele;
59 le_modele = le_modele_turbulence.valeur();
60 liste_modeles_.add_if_not(le_modele);
61 return 1;
62 }
63 else
65}
66
67
68/*! @brief for PDI IO: retrieve name, type and dimensions of the fields to save/restore
69 *
70 */
72{
73 std::vector<YAML_data> data = Convection_Diffusion_Concentration::data_a_sauvegarder();
74 std::vector<YAML_data> turb = Convection_Diffusion_Turbulent::data_a_sauvegarder();
75 data.insert(data.end(), turb.begin(), turb.end());
76 return data;
77}
78
79/*! @brief Sauvergarde de l'equation sur un flot de sortie.
80 *
81 * Double appel a:
82 * Convection_Diffusion_Concentration::sauvegarder(Sortie& );
83 * Convection_Diffusion_Turbulent::sauvegarder(Sortie& );
84 *
85 * @param (Sortie& os) un flot de sortie
86 * @return (int) renvoie toujours 1
87 */
95
96/*! @brief Reprise a partir d'un flot d'entree, double appel a: Convection_Diffusion_Concentration::reprendre(Entree& );
97 *
98 * Convection_Diffusion_Turbulent::reprendre(Entree&);
99 *
100 * @param (Entree& is) un flot d'entree
101 * @return (int) renvoie toujours 1
102 */
109
110/*! @brief Double appel a: Convection_Diffusion_Turbulent::completer()
111 *
112 * Convection_Diffusion_Concentration::completer()
113 *
114 */
120
121/*! @brief Mise a jour en temps de l'equation, double appel a: Convection_Diffusion_Concentration::mettre_a_jour(double );
122 *
123 * Convection_Diffusion_Turbulent::mettre_a_jour(double );
124 *
125 * @param (double temps) le temps de mise a jour
126 */
132
134{
136
137 if (le_modele_turbulence)
138 le_modele_turbulence->creer_champ(motlu);
139}
140
141bool Convection_Diffusion_Concentration_Turbulent::has_champ(const Motcle& nom, OBS_PTR(Champ_base)& ref_champ) const
142{
144 return true;
145
146 if (le_modele_turbulence)
147 if (le_modele_turbulence->has_champ(nom, ref_champ))
148 return true;
149
150 return false; /* rien trouve */
151}
152
154{
156 return true;
157
158 if (le_modele_turbulence)
159 if (le_modele_turbulence->has_champ(nom))
160 return true;
161
162 return false; /* rien trouve */
163}
164
166{
167 OBS_PTR(Champ_base) ref_champ;
168
170 return ref_champ;
171
172 if (le_modele_turbulence)
173 if (le_modele_turbulence->has_champ(nom, ref_champ))
174 return ref_champ;
175
176 throw std::runtime_error(std::string("Field ") + nom.getString() + std::string(" not found !"));
177}
178
180{
182 if (le_modele_turbulence)
183 le_modele_turbulence->get_noms_champs_postraitables(nom, opt);
184}
185
186/*! @brief Double appel a: Convection_Diffusion_Turbulent::preparer_calcul()
187 *
188 * Convection_Diffusion_Concentration::preparer_calcul()
189 *
190 * @return (int) renvoie toujours 1
191 */
198
205
207{
208 for (const auto &itr : liste_modeles_)
209 {
210 const RefObjU& mod = itr;
211 if (mod)
212 if ((sub_type(Modele_turbulence_scal_base, mod.valeur())) && (type == TURBULENCE))
213 return mod;
214 }
215 return Equation_base::get_modele(type);
216}
classe Champ_base Cette classe est la base de la hierarchie des champs.
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
classe Convection_Diffusion_Concentration_Turbulent Cette classe represente le cas particulier de
int sauvegarder(Sortie &) const override
Sauvergarde de l'equation sur un flot de sortie.
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
void completer() override
Double appel a: Convection_Diffusion_Turbulent::completer().
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
void mettre_a_jour(double) override
Mise a jour en temps de l'equation, double appel a: Convection_Diffusion_Concentration::mettre_a_jour...
int reprendre(Entree &) override
Reprise a partir d'un flot d'entree, double appel a: Convection_Diffusion_Concentration::reprendre(En...
std::vector< YAML_data > data_a_sauvegarder() const override
for PDI IO: retrieve name, type and dimensions of the fields to save/restore
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.
int preparer_calcul() override
Double appel a: Convection_Diffusion_Turbulent::preparer_calcul().
const Champ_base & get_champ(const Motcle &nom) const override
classe Convection_Diffusion_Concentration Cas particulier de Convection_Diffusion_std
int preparer_calcul() override
Tout ce qui ne depend pas des autres problemes eventuels.
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.
OBS_PTR(Constituant) le_constituant
const Champ_Don_base & diffusivite_pour_transport() const override
void mettre_a_jour(double) override
La valeur de l'inconnue sur le pas de temps a ete calculee.
void completer()
Complete le modele de turbulence.
Entree & lire_op_diff_turbulent(Entree &, const Equation_base &, Operateur_Diff &)
Entree & lire_modele(Entree &, const Equation_base &)
virtual int sauvegarder(Sortie &) const
Simple appel a Modele_turbulence_scal_base::sauvegarder(Sortie&) sur le membre concerne.
virtual void mettre_a_jour(double)
Mise a jour en temps du modele de turbulence.
virtual int reprendre(Entree &)
Reprise (apres une sauvegarde) a partir d'un flot d'entree.
virtual std::vector< YAML_data > data_a_sauvegarder() const
for PDI IO: retrieve name, type and dimensions of the fields to save/restore
virtual const Champ_base & diffusivite_pour_pas_de_temps() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
int reprendre(Entree &) override
On reprend l'inconnue a partir d'un flot d'entree.
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 completer()
Complete la construction (initialisation) des objets associes a l'equation.
int sauvegarder(Sortie &) const override
On sauvegarde l'inconnue, puis les sources sur un flot de sortie.
virtual bool initTimeStep(double dt)
Allocation et initialisation de l'inconnue et des CLs jusqu'a present+dt.
Classe Modele_turbulence_scal_base Cette classe represente un modele de turbulence pour une equation ...
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
const std::string & getString() const
Definition Nom.h:92
Un tableau de chaine de caracteres (VECT(Nom)).
Definition Noms.h:26
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(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
@ 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
Classe de base des flux de sortie.
Definition Sortie.h:52
const Objet_U & valeur() const
Definition TRUST_Ref.h:134