TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Convection_Diffusion_Turbulent.cpp
1/****************************************************************************
2* Copyright (c) 2025, 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_Turbulent.h>
17#include <Modele_turbulence_scal_base.h>
18#include <Operateur_Diff_base.h>
19#include <Discretisation_base.h>
20#include <Schema_Temps_base.h>
21#include <Champ_Uniforme.h>
22#include <Operateur_Diff.h>
23#include <Probleme_base.h>
24
25#include <Domaine.h>
26#include <Avanc.h>
27
29{
30 Cerr << "Reading and typing of the turbulence model : ";
31
32 Motcle typ;
33 is >> typ;
34
35 Motcle nom1("Modele_turbulence_scal_");
36 nom1 += typ;
37
38 if (typ == "sous_maille_dyn")
39 {
40 nom1 += "_";
41 Nom disc = eqn.discretisation().que_suis_je();
42 if (disc == "VEFPreP1B") disc = "VEF";
43 nom1 += disc;
44 }
45 Cerr << nom1 << finl;
46
47 le_modele_turbulence.typer(nom1);
48 le_modele_turbulence->associer_eqn(eqn);
49 le_modele_turbulence->associer(eqn.domaine_dis(), eqn.domaine_Cl_dis());
50
51 is >> le_modele_turbulence.valeur(); // On lit :-)
52
53 le_modele_turbulence->discretiser();
54
55 return is;
56}
57
59{
60 Motcle accfermee = "}";
61 Nom type = "Op_Dift_";
62
63 Motcle motbidon;
64 is >> motbidon;
65 assert(motbidon == "{");
66 is >> motbidon;
67 if (motbidon == "negligeable")
68 {
69 type += motbidon;
70 is >> motbidon;
71
72 terme_diffusif.typer(type);
73 terme_diffusif.l_op_base().associer_eqn(eqn);
74 Cerr << terme_diffusif->que_suis_je() << finl;
75 terme_diffusif->associer_diffusivite(terme_diffusif.diffusivite());
76
77 assert(motbidon == accfermee);
78 }
79 else if (motbidon == "stab")
80 {
81 Nom disc = eqn.discretisation().que_suis_je();
82 if (disc == "VEFPreP1B")
83 disc = "VEF";
84
85 Nom nb_inc;
86 nb_inc = "_";
87 if ((terme_diffusif.diffusivite().nb_comp() != 1) && ((disc == "VDF")))
88 nb_inc = "_Multi_inco_";
89
90 Nom type_inco = eqn.inconnue().que_suis_je();
91
92 type += disc;
93 type += nb_inc;
94 type += (type_inco.suffix("Champ_"));
95 if (Objet_U::axi)
96 type += "_Axi";
97 type += "_stab";
98
99 terme_diffusif.typer(type);
100 terme_diffusif.l_op_base().associer_eqn(eqn);
101 terme_diffusif->associer_diffusivite(terme_diffusif.diffusivite());
102 is >> terme_diffusif.valeur();
103 }
104 else
105 {
106 Nom disc = eqn.discretisation().que_suis_je();
107 // les operateurs C_D_Turb_T sont communs aux discretisations VEF et VEFP1B
108 if (disc == "VEFPreP1B")
109 disc = "VEF";
110 type += disc;
111
112 Nom nb_inc;
113 nb_inc = "_";
114 if ((terme_diffusif.diffusivite().nb_comp() != 1) && ((disc == "VDF")))
115 nb_inc = "_Multi_inco_";
116
117 type += nb_inc;
118
119 Nom type_inco = eqn.inconnue().que_suis_je();
120 if (type_inco == "Champ_Q1_EF")
121 type += "Q1";
122 else
123 type += (type_inco.suffix("Champ_"));
124
125 if (Objet_U::axi)
126 type += "_Axi";
127
128 if (motbidon != accfermee)
129 type += Nom("_") + motbidon, is >> motbidon;
130 assert(motbidon == accfermee);
131
132 terme_diffusif.typer(type);
133 terme_diffusif.l_op_base().associer_eqn(eqn);
134 Cerr << terme_diffusif->que_suis_je() << finl;
135 terme_diffusif->associer_diffusivite(terme_diffusif.diffusivite());
136 }
137 return is;
138}
139
140/*! @brief Complete le modele de turbulence.
141 *
142 */
144{
145 le_modele_turbulence->completer();
146 le_modele_turbulence->loi_paroi().completer();
147}
148
150{
151 return le_modele_turbulence->initTimeStep(dt);
152}
153
154/*! @brief Prepare le calcul.
155 *
156 * @return (int) renvoie toujours 1
157 */
159{
160 le_modele_turbulence->preparer_calcul();
161 return 1;
162}
163
164/*! @brief for PDI IO: retrieve name, type and dimensions of the fields to save/restore
165 *
166 */
168{
169 std::vector<YAML_data> data = le_modele_turbulence->data_a_sauvegarder();
170 return data;
171}
172
173/*! @brief Simple appel a Modele_turbulence_scal_base::sauvegarder(Sortie&) sur le membre concerne.
174 *
175 * Sauvegarde le modele de turbulence sur un flot
176 * de sortie.
177 *
178 * @param (Sortie& os) un flot de sortie
179 * @return (int) code de retour propage
180 */
182{
183 return le_modele_turbulence->sauvegarder(os);
184}
185
186/*! @brief Reprise (apres une sauvegarde) a partir d'un flot d'entree.
187 *
188 * @param (Entree& is) un flot d'entree
189 * @return (int) renvoie toujours 1
190 * @throws fin de fichier atteinte pendant la reprise
191 */
193{
194 le_modele_turbulence->reprendre(is);
195 return 1;
196}
197
198/*! @brief Mise a jour en temps du modele de turbulence.
199 *
200 * @param (double temps) le temps de mise a jour
201 */
203{
204 le_modele_turbulence->mettre_a_jour(temps);
205}
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
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....
const Discretisation_base & discretisation() const
Renvoie la discretisation associee a l'equation.
virtual const Champ_Inc_base & inconnue() const =0
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Renvoie le domaine des conditions aux limite discretisee associee a l'equation.
Domaine_dis_base & domaine_dis()
Renvoie le domaine discretise associe a l'equation.
virtual int nb_comp() const
Definition Field_base.h:56
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
Nom & suffix(const char *const)
Extraction de suffixe : Nom x("azerty");.
Definition Nom.cpp:271
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
static int axi
Definition Objet_U.h:101
classe Operateur_Diff Classe generique de la hierarchie des operateurs representant un terme
const Champ_base & diffusivite() const
Renvoie le champ representant la diffusivite.
void associer_diffusivite(const Champ_base &)
Associe la diffusivite a l'operateur.
void typer() override
Type l'operateur: se type "Op_Diff_"+discretisation() + ("_"ou"_Multi_inco_") + inconnue()....
Operateur_base & l_op_base() override
Renvoie l'objet sous-jacent upcaste en Operateur_base.
void associer_eqn(const Equation_base &)
Associe une equation a l'operateur.
Classe de base des flux de sortie.
Definition Sortie.h:52