TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Modele_turbulence_scal_Fluctuation_Temperature.cpp
1/****************************************************************************
2* Copyright (c) 2019, 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 <Modele_turbulence_scal_Fluctuation_Temperature.h>
17#include <Probleme_base.h>
18#include <Modele_turbulence_hyd_base.h>
19#include <TRUSTTrav.h>
20#include <Param.h>
21
22Implemente_instanciable(Modele_turbulence_scal_Fluctuation_Temperature,"Modele_turbulence_scal_Fluctuation_Temperature",Modele_turbulence_scal_base);
23
24//// printOn
25//
26
28{
29 return s << que_suis_je() << " " << le_nom();
30}
31
32
33//// readOn
34//
35
37{
38
40}
41
43{
44 param.ajouter_non_std("Transport_Fluctuation_Temperature",this);
45 param.ajouter_non_std("Transport_Flux_Chaleur_Turbulente",this);
46 // on ajoute pas les params de la classe mere car ce n'etait pas fait avt
47}
49{
50 Cerr << "Lecture des parametres du modele de fluctuation thermique. Il doit y avoir deux types d'equation." << finl;
51 //Motcle accouverte = "{" , accfermee = "}" ;
52 Motcles les_mots(2);
53 {
54 les_mots[0] = "Transport_Fluctuation_Temperature";
55 les_mots[1] = "Transport_Flux_Chaleur_Turbulente";
56 }
57 int rang=les_mots.search(mot);
58 switch(rang)
59 {
60 case 0:
61 {
62 Cerr << "Lecture de l'equation Transport_Fluctuation_Temperature" << finl;
63 eqn_transport_Fluctu_Temp.associer_modele_turbulence(*this);
64 s >> eqn_transport_Fluctu_Temp;
65 break;
66 }
67 case 1:
68 {
69 Cerr << "Lecture de l'equation Transport_Flux_Chaleur_Turbulente" << finl;
70 eqn_transport_Flux_Chaleur_Turb.associer_modele_turbulence(*this);
71 s >> eqn_transport_Flux_Chaleur_Turb;
72 break;
73 }
74 default :
75 {
77 }
78 }
79 return 1;
80}
81
83{
84 la_viscosite_turbulente = visc_turb;
85}
86
87
88
90{
91 eqn_transport_Fluctu_Temp.preparer_calcul();
92 eqn_transport_Flux_Chaleur_Turb.preparer_calcul();
94 mettre_a_jour(eqn_transport_Fluctu_Temp.schema_temps().temps_courant());
95 return 1;
96}
97
99{
100 bool ok=eqn_transport_Fluctu_Temp.initTimeStep(dt);
101 ok = ok && eqn_transport_Flux_Chaleur_Turb.initTimeStep(dt);
102 return ok;
103}
104
106{
107 DoubleTab& alpha_t = diffusivite_turbulente_->valeurs();
108 const DoubleTab& nu_t = la_viscosite_turbulente->valeurs();
109 double temps = la_viscosite_turbulente->temps();
110
111 if (temps != diffusivite_turbulente_->temps())
112 {
113 constexpr double Prdt_turbulent = 0.9;
114
115 assert(alpha_t.size()==nu_t.size() && "Les DoubleTab des champs diffusivite_turbulente et viscosite_turbulente doivent avoir le meme nombre de valeurs nodales");
116
117 int n = alpha_t.size();
118 for (int i=0; i<n; i++)
119 alpha_t[i] = nu_t[i]/Prdt_turbulent;
120
121 diffusivite_turbulente_->changer_temps(temps);
122 }
124}
125
127{
128 // Champ_Inc_base& ch_Fluctu_Temp = Fluctu_Temperature();
129 Schema_Temps_base& sch1 = eqn_transport_Fluctu_Temp.schema_temps();
130 // Voir Schema_Temps_base::faire_un_pas_de_temps_pb_base
131 eqn_transport_Fluctu_Temp.domaine_Cl_dis().mettre_a_jour(temps);
132 sch1.faire_un_pas_de_temps_eqn_base(eqn_transport_Fluctu_Temp);
133 //eqn_transport_Fluctu_Temp.inconnue().mettre_a_jour(temps);
134 eqn_transport_Fluctu_Temp.mettre_a_jour(temps);
135 eqn_transport_Fluctu_Temp.controler_grandeur();
136 // Champ_Inc_base& ch_Flux_Chaleur_Turb = Flux_Chaleur_Turb();
137 Schema_Temps_base& sch2 = eqn_transport_Flux_Chaleur_Turb.schema_temps();
138 // Voir Schema_Temps_base::faire_un_pas_de_temps_pb_base
139 eqn_transport_Flux_Chaleur_Turb.domaine_Cl_dis().mettre_a_jour(temps);
140 sch2.faire_un_pas_de_temps_eqn_base(eqn_transport_Flux_Chaleur_Turb);
141 //eqn_transport_Flux_Chaleur_Turb.inconnue().mettre_a_jour(temps);
142 eqn_transport_Flux_Chaleur_Turb.mettre_a_jour(temps);
143 eqn_transport_Flux_Chaleur_Turb.controler_grandeur();
145}
146
148{
149 eqn_transport_Fluctu_Temp.completer();
150 eqn_transport_Flux_Chaleur_Turb.completer();
151 const Probleme_base& mon_pb = mon_equation_->probleme();
152 const RefObjU& modele_turbulence = mon_pb.equation(0).get_modele(TURBULENCE);
153 const Modele_turbulence_hyd_base& mod_turb_hydr = ref_cast(Modele_turbulence_hyd_base,modele_turbulence.valeur());
154 const Champ_Fonc_base& visc_turb = mod_turb_hydr.viscosite_turbulente();
156}
157
159{
161 int bytes=0;
162 bytes += eqn_transport_Fluctu_Temp.sauvegarder(os);
163 bytes += eqn_transport_Flux_Chaleur_Turb.sauvegarder(os);
164 return bytes;
165
166}
167
169{
171 if (mon_equation_)
172 {
173 eqn_transport_Fluctu_Temp.reprendre(is);
174 eqn_transport_Flux_Chaleur_Turb.reprendre(is);
175 return 1;
176 }
177 else
178 {
179 double dbidon;
180 Nom bidon;
181 DoubleTrav tab_bidon;
182 is >> bidon >> bidon;
183 is >> dbidon;
184 tab_bidon.jump(is);
185 return 1;
186 }
187}
191
192bool Modele_turbulence_scal_Fluctuation_Temperature::has_champ(const Motcle& nom, OBS_PTR(Champ_base)& ref_champ) const
193{
194 if (Modele_turbulence_scal_base::has_champ(nom, ref_champ))
195 return true;
196
197 if (eqn_transport_Fluctu_Temp.has_champ(nom, ref_champ))
198 return true;
199
200 if (eqn_transport_Flux_Chaleur_Turb.has_champ(nom, ref_champ))
201 return true;
202
203 return false; /* rien trouve */
204}
205
207{
209 return true;
210
211 if (eqn_transport_Fluctu_Temp.has_champ(nom))
212 return true;
213
214 if (eqn_transport_Flux_Chaleur_Turb.has_champ(nom))
215 return true;
216
217 return false; /* rien trouve */
218}
219
221{
222 OBS_PTR(Champ_base) ref_champ;
223
224 if (Modele_turbulence_scal_base::has_champ(nom, ref_champ))
225 return ref_champ;
226
227 if (eqn_transport_Fluctu_Temp.has_champ(nom, ref_champ))
228 return ref_champ;
229
230 if (eqn_transport_Flux_Chaleur_Turb.has_champ(nom, ref_champ))
231 return ref_champ;
232
233 throw std::runtime_error(std::string("Field ") + nom.getString() + std::string(" not found !"));
234}
235
237{
239
240 eqn_transport_Fluctu_Temp.get_noms_champs_postraitables(nom,opt);
241
242 eqn_transport_Flux_Chaleur_Turb.get_noms_champs_postraitables(nom,opt);
243
244}
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual const RefObjU & get_modele(Type_modele type) const
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
Base class for the turbulence model hierarchy for Navier-Stokes equations.
const Champ_Fonc_base & viscosite_turbulente() const
OBS_PTR(Champ_Fonc_base) la_viscosite_turbulente
bool initTimeStep(double dt) override
To be overridden in derived classes that own one or more equations. Calls preparer_pas_de_temps on th...
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 completer() override
Completes the turbulence model: updates object references.
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
void imprimer(Sortie &) const override
Performs printing if necessary.
Base class for scalar turbulence models coupled to a Navier-Stokes convection-diffusion equation.
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
int reprendre(Entree &) override
Does nothing.
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
virtual int preparer_calcul()
Does nothing.
void a_faire(Sortie &) const
Writes an identity string to the output stream if necessary.
A character string (Nom) in uppercase.
Definition Motcle.h:26
An array of Motcle objects.
Definition Motcle.h:63
int search(const Motcle &t) const
Definition Motcle.cpp:319
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
const std::string & getString() const
Definition Nom.h:92
An array of character strings (VECT(Nom)).
Definition Noms.h:26
friend class Entree
Definition Objet_U.h:71
friend class Sortie
Definition Objet_U.h:70
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual const Nom & le_nom() const
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Objet_U.cpp:317
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
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
class Probleme_base It is a Probleme_U that is not a coupling.
virtual const Equation_base & equation(int) const =0
class Schema_Temps_base
virtual int faire_un_pas_de_temps_eqn_base(Equation_base &)=0
virtual int mettre_a_jour()
Updates the current time (t+=dt) and the number of time steps performed (nb_pas_dt_++).
Base class for output streams.
Definition Sortie.h:52
void jump(Entree &) override
Definition TRUSTTab.tpp:701
_SIZE_ size() const
Definition TRUSTVect.tpp:45
const Objet_U & valeur() const
Definition TRUST_Ref.h:134