TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Modele_turbulence_scal_Fluctuation_Temperature_W.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_W.h>
17#include <Modele_turbulence_hyd_K_Eps_Bas_Reynolds.h>
18#include <Probleme_base.h>
19#include <TRUSTTrav.h>
20#include <Param.h>
21
22Implemente_instanciable(Modele_turbulence_scal_Fluctuation_Temperature_W,"Modele_turbulence_scal_Fluctuation_Temperature_W",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 eqn.typer("Transport_Fluctuation_Temperature_W");
39 eqn_transport_Fluctu_Temp = ref_cast(Transport_Fluctuation_Temperature_W, eqn.valeur());
40
42}
44{
45 param.ajouter_non_std("Transport_Fluctuation_Temperature_W",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(1);
53 {
54 les_mots[0] = "Transport_Fluctuation_Temperature_W";
55 }
56 int rang=les_mots.search(mot);
57 switch(rang)
58 {
59 case 0:
60 {
61 Cerr << "Lecture de l'equation Transport_Fluctuation_Temperature_W" << finl;
62 eqn_transport_Fluctu_Temp->associer_modele_turbulence(*this);
63 s >> eqn_transport_Fluctu_Temp.valeur();
64 break;
65 }
66 default :
67 {
68 Cerr << "Erreur a la lecture des donnees du modele de fluctuation thermique" << finl;
69 Cerr << "On attendait les motcles Transport_Fluctuation_Temperature_W au lieu de " << mot << finl;
71 break;
72 }
73 }
74 return 1;
75}
76
78{
79 la_viscosite_turbulente = visc_turb;
80}
81
83{
84 eqn_transport_Fluctu_Temp->preparer_calcul();
87 diffusivite_turbulente_->valeurs().echange_espace_virtuel();
88 return 1;
89}
90
92{
93 return eqn->initTimeStep(dt);
94}
95
97{
98 DoubleTab& alpha_t = diffusivite_turbulente_->valeurs();
99 const DoubleTab& mu_t = la_viscosite_turbulente->valeurs();
100 double temps = la_viscosite_turbulente->temps();
101 const Champ_base& chFluctuTemp = eqn_transport_Fluctu_Temp->inconnue();
102
103 const Probleme_base& mon_pb = mon_equation_->probleme();
104 const RefObjU& modele_turbulence = mon_pb.equation(0).get_modele(TURBULENCE);
105 const Modele_turbulence_hyd_K_Eps_Bas_Reynolds& mod_turb_hydr = ref_cast(Modele_turbulence_hyd_K_Eps_Bas_Reynolds,modele_turbulence.valeur());
106 const Transport_K_Eps_base& eqBasRe = mod_turb_hydr.get_eq_transport();
107 const DoubleTab& K_eps_Bas_Re = eqBasRe.inconnue().valeurs();
108
109 if (temps != diffusivite_turbulente_->temps())
110 {
111 static const double C_Lambda = 0.11;
112 int n= alpha_t.size();
113 if (mu_t.size() != n)
114 {
115 Cerr << "Les DoubleTab des champs diffusivite_turbulente et viscosite_turbulente" << finl;
116 Cerr << "doivent avoir le meme nombre de valeurs nodales" << finl;
118 }
119
120 for (int i=0; i<n; i++)
121 if ( (K_eps_Bas_Re(i,1) > 1.e-3 ) && (chFluctuTemp.valeurs()(i,1) > 1.e-3) && (K_eps_Bas_Re(i,0) > 1.e-3 ) && (chFluctuTemp.valeurs()(i,0) > 1.e-3))
122 alpha_t[i] =C_Lambda*K_eps_Bas_Re(i,0)*sqrt((K_eps_Bas_Re(i,0)/K_eps_Bas_Re(i,1))*(chFluctuTemp.valeurs()(i,0)/(2*chFluctuTemp.valeurs()(i,1))));
123 else
124 {
125 Cerr << " !!!! Eps ou EpsTeta est nul !!!! " << finl;
126 Cerr << " K = " << K_eps_Bas_Re(i,0) << finl;
127 alpha_t[i] = 0.0000001;
128 }
129
130 diffusivite_turbulente_->changer_temps(temps);
131 }
132
134}
135
137{
138 Schema_Temps_base& sch1 = eqn_transport_Fluctu_Temp->schema_temps();
139 // Voir Schema_Temps_base::faire_un_pas_de_temps_pb_base
140 eqn_transport_Fluctu_Temp->domaine_Cl_dis().mettre_a_jour(temps);
141 sch1.faire_un_pas_de_temps_eqn_base(eqn_transport_Fluctu_Temp.valeur());
142 //eqn_transport_Fluctu_Temp->inconnue().mettre_a_jour(temps);
143 eqn_transport_Fluctu_Temp->mettre_a_jour(temps);
144 eqn_transport_Fluctu_Temp->controler_grandeur();
146 diffusivite_turbulente_->valeurs().echange_espace_virtuel();
147}
148
150{
151 Cerr << "Dans Modele_turbulence_scal_Fluctuation_Temperature_W::completer()" << finl;
152 eqn_transport_Fluctu_Temp->completer();
153 const Probleme_base& mon_pb = mon_equation_->probleme();
154 const RefObjU& modele_turbulence = mon_pb.equation(0).get_modele(TURBULENCE);
155 const Modele_turbulence_hyd_base& mod_turb_hydr = ref_cast(Modele_turbulence_hyd_base,modele_turbulence.valeur());
156 const Champ_Fonc_base& visc_turb = mod_turb_hydr.viscosite_turbulente();
158 Cerr << "Fin de Modele_turbulence_scal_Fluctuation_Temperature_W::completer()" << finl;
159
160}
161
168
170{
172 if (mon_equation_)
173 {
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_W::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->has_champ(nom, ref_champ))
198 return true;
199
200 return false; /* rien trouve */
201}
202
204{
206 return true;
207
208 if (eqn->has_champ(nom))
209 return true;
210
211 return false; /* rien trouve */
212}
213
215{
216 OBS_PTR(Champ_base) ref_champ;
217
218 if (Modele_turbulence_scal_base::has_champ(nom, ref_champ))
219 return ref_champ;
220
221 if (eqn->has_champ(nom, ref_champ))
222 return ref_champ;
223
224 throw std::runtime_error(std::string("Field ") + nom.getString() + std::string(" not found !"));
225}
226
228{
230
231 eqn->get_noms_champs_postraitables(nom,opt);
232}
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
DoubleTab & valeurs() override
Returns the array of field values at the current time.
virtual DoubleTab & valeurs()=0
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
int reprendre(Entree &) override
We resume the unknown from an input stream.
virtual const RefObjU & get_modele(Type_modele type) const
int sauvegarder(Sortie &) const override
We save the unknown, then the source terms to an output stream.
class Modele_turbulence_hyd_K_Eps_Bas_Reynolds
const Transport_K_Eps_Bas_Reynolds & get_eq_transport() const override
Base class for the turbulence model hierarchy for Navier-Stokes equations.
const Champ_Fonc_base & viscosite_turbulente() const
bool initTimeStep(double dt) override
To be overridden in derived classes that own one or more equations. Calls preparer_pas_de_temps on th...
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) 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 imprimer(Sortie &) const override
Performs printing if necessary.
void completer() override
Completes the turbulence model: updates object references.
Base class for scalar turbulence models coupled to a Navier-Stokes convection-diffusion equation.
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
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
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
Classe Transport_K_Eps_base Classe de base pour les equations.
const Champ_Inc_base & inconnue() const override
Renvoie le champ inconnue de l'equation.