TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Modele_turbulence_scal_Fluctuation_Temperature_W_Bas_Re.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_Bas_Re.h>
17#include <Modele_turbulence_hyd_K_Eps_Bas_Reynolds.h>
18#include <Probleme_base.h>
19#include <Champ_Uniforme.h>
20#include <Param.h>
21
22Implemente_instanciable(Modele_turbulence_scal_Fluctuation_Temperature_W_Bas_Re,"Modele_turbulence_scal_Fluctuation_Temperature_W_Bas_Re",Modele_turbulence_scal_Fluctuation_Temperature_W);
23
25{
26 return s << que_suis_je() << " " << le_nom();
27}
28
30{
31 dt_impr_nusselt_=DMAXFLOAT;
32
33 eqn.typer("Transport_Fluctuation_Temperature_W_Bas_Re");
34 eqn_transport_Fluctu_Temp = ref_cast(Transport_Fluctuation_Temperature_W_Bas_Re, eqn.valeur());
36}
38{
40 param.ajouter_non_std("Transport_Fluctuation_Temperature_W_Bas_Re",this);
41 param.ajouter_non_std("Modele_Fonc_Bas_Reynolds_Thermique",this);
42 // on ajoute pas les params de la classe mere car ce n'etait pas fait avt
43}
45{
46
47 Cerr << "Lecture des parametres du modele de fluctuation thermique." << finl;
48 //Motcle accouverte = "{" , accfermee = "}" ;
49 Motcles les_mots(2);
50 {
51 les_mots[0] = "Transport_Fluctuation_Temperature_W_Bas_Re";
52 les_mots[1] = "Modele_Fonc_Bas_Reynolds_Thermique";
53 }
54 int rang=les_mots.search(mot);
55 switch(rang)
56 {
57 case 0:
58 {
59 Cerr << "Lecture de l'equation Transport_Fluctuation_Temperature_W_Bas_Re" << finl;
60 eqn_transport_Fluctu_Temp->associer_modele_turbulence(*this);
61 s >> eqn_transport_Fluctu_Temp.valeur();
62 break;
63 }
64 case 1:
65 {
66 Cerr << "Lecture du modele bas reynolds associe " << finl;
67 Modele_Fonc_Bas_Reynolds_Thermique_Base::typer_lire_Modele_Fonc_Bas_Reynolds_Thermique(mon_modele_fonc, eqn_transport_Fluctu_Temp.valeur(), s);
68 mon_modele_fonc->discretiser();
69 Cerr << "mon_modele_fonc.que_suis_je() " << mon_modele_fonc->que_suis_je() << finl;
70 break;
71 }
72
73 default :
74 {
76 }
77 }
78 return 1;
79}
80
82{
83 eqn_transport_Fluctu_Temp->preparer_calcul();
86 diffusivite_turbulente_->valeurs().echange_espace_virtuel();
87 return 1;
88}
89
91{
92
93 DoubleTab& alpha_t = diffusivite_turbulente_->valeurs();
94 const DoubleTab& nu_t = la_viscosite_turbulente->valeurs();
95 double temps = la_viscosite_turbulente->temps();
96 const DoubleTab& chFluctuTemp = eqn_transport_Fluctu_Temp->inconnue().valeurs();
97 const Domaine_dis_base& le_dom_dis = eqn_transport_Fluctu_Temp->domaine_dis();
98
99 const Probleme_base& mon_pb = mon_equation_->probleme();
100 const Equation_base& eqn_hydr = mon_pb.equation(0);
101 const RefObjU& modele_turbulence = eqn_hydr.get_modele(TURBULENCE);
102 const Modele_turbulence_hyd_K_Eps_Bas_Reynolds& mod_turb_hydr = ref_cast(Modele_turbulence_hyd_K_Eps_Bas_Reynolds,modele_turbulence.valeur());
103 const Transport_K_Eps_base& eqBasRe = mod_turb_hydr.get_eq_transport();
104 const DoubleTab& K_eps_Bas_Re = eqBasRe.inconnue().valeurs();
105
106 //on recupere les proprietes physiques du fluide : viscosite cinematique et diffusivite
107 const Fluide_base& fluide = ref_cast(Fluide_base,eqn_hydr.milieu());
108 const Champ_Don_base& ch_visco_cin = fluide.viscosite_cinematique();
109 const Champ_Don_base& ch_diffu = fluide.diffusivite();
110 const DoubleTab& tab_visco = ch_visco_cin.valeurs();
111 const DoubleTab& tab_diffu = ch_diffu.valeurs();
112 double visco,diffu;
113
114 if (sub_type(Champ_Uniforme,ch_visco_cin))
115 {
116 visco = std::max(tab_visco(0,0),DMINFLOAT);
117 }
118 else
119 {
120 visco=-1;
121 Cerr << "La viscosite doit etre uniforme !!!!" << finl;
123 }
124
125 if (sub_type(Champ_Uniforme,ch_diffu))
126 {
127 diffu = std::max(tab_diffu(0,0),DMINFLOAT);
128 }
129 else
130 {
131 diffu=-1;
132 Cerr << "La diffusivite doit etre uniforme !!!!" << finl;
134 }
135
136 int nb_elem = K_eps_Bas_Re.dimension(0);
137 DoubleTab Flambda(nb_elem);
138 mon_modele_fonc->Calcul_Flambda( Flambda,le_dom_dis,K_eps_Bas_Re,chFluctuTemp,visco,diffu);
139
140 if (temps != diffusivite_turbulente_->temps())
141 {
142 static const double C_Lambda = 0.11;
143 int n= alpha_t.size();
144 if (nu_t.size() != n)
145 {
146 Cerr << "Les DoubleTab des champs diffusivite_turbulente et viscosite_turbulente" << finl;
147 Cerr << "doivent avoir le meme nombre de valeurs nodales" << finl;
149 }
150
151 for (int i=0; i<n; i++)
152 {
153 if ( (K_eps_Bas_Re(i,1) > 1.e-10 ) && (chFluctuTemp(i,1) > 1.e-10) && (K_eps_Bas_Re(i,0) > 1.e-10 ) && (chFluctuTemp(i,0) > 1.e-10))
154 alpha_t[i] =C_Lambda*Flambda(i)*K_eps_Bas_Re(i,0)*sqrt((K_eps_Bas_Re(i,0)/K_eps_Bas_Re(i,1))*(chFluctuTemp(i,0)/(2*chFluctuTemp(i,1))));
155 else
156 {
157 alpha_t[i] = 0.0000001;
158 }
159 }
160 diffusivite_turbulente_->changer_temps(temps);
161 }
162
164}
165
166
167
169{
170 eqn_transport_Fluctu_Temp->completer();
171 const Probleme_base& mon_pb = mon_equation_->probleme();
172 const RefObjU& modele_turbulence = mon_pb.equation(0).get_modele(TURBULENCE);
173 const Modele_turbulence_hyd_base& mod_turb_hydr = ref_cast(Modele_turbulence_hyd_base,modele_turbulence.valeur());
174 const Champ_Fonc_base& visc_turb = mod_turb_hydr.viscosite_turbulente();
176}
177
179{
180 Schema_Temps_base& sch1 = eqn_transport_Fluctu_Temp->schema_temps();
181 // Voir Schema_Temps_base::faire_un_pas_de_temps_pb_base
182 eqn_transport_Fluctu_Temp->domaine_Cl_dis().mettre_a_jour(temps);
183 sch1.faire_un_pas_de_temps_eqn_base(eqn_transport_Fluctu_Temp.valeur());
184 eqn_transport_Fluctu_Temp->mettre_a_jour(temps);
185 eqn_transport_Fluctu_Temp->controler_grandeur();
187 diffusivite_turbulente_->valeurs().echange_espace_virtuel();
188}
189
191{
193 return true;
194
195 if (mon_modele_fonc)
196 if (mon_modele_fonc->has_champ(nom, ref_champ))
197 return true;
198
199 return false; /* rien trouve */
200}
201
203{
205 return true;
206
207 if (mon_modele_fonc)
208 if (mon_modele_fonc->has_champ(nom))
209 return true;
210
211 return false; /* rien trouve */
212}
213
215{
216 OBS_PTR(Champ_base) ref_champ;
217
219 return ref_champ;
220
221 if (mon_modele_fonc)
222 if (mon_modele_fonc->has_champ(nom, ref_champ))
223 return ref_champ;
224
225 throw std::runtime_error(std::string("Field ") + nom.getString() + std::string(" not found !"));
226}
227
229{
231
232 if (mon_modele_fonc)
233 mon_modele_fonc->get_noms_champs_postraitables(nom,opt);
234}
class Champ_Don_base base class of Given Fields (not calculated)
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
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.
Champ_Uniforme Represents a field that is constant in space and time.
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Equation_base The role of an equation is the calculation of one or more fields....
virtual const Milieu_base & milieu() const =0
virtual const RefObjU & get_modele(Type_modele type) const
Base class for an incompressible fluid and its properties:
Definition Fluide_base.h:36
const Champ_Don_base & viscosite_cinematique() const
Definition Fluide_base.h:56
virtual const Champ_Don_base & diffusivite() const
Returns the diffusivity of the medium (const version).
static void typer_lire_Modele_Fonc_Bas_Reynolds_Thermique(OWN_PTR(Modele_Fonc_Bas_Reynolds_Thermique_Base)&, const Equation_base &, Entree &)
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
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
Completes the turbulence model: updates object references.
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
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.
virtual void set_param(Param &) const override
virtual int preparer_calcul()
Does nothing.
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
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
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
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
_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.