TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Modele_turbulence_hyd_K_Eps_Bas_Reynolds.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_hyd_K_Eps_Bas_Reynolds.h>
17#include <Schema_Temps_base.h>
18#include <Fluide_base.h>
19#include <Champ_Uniforme.h>
20#include <Debog.h>
21#include <Perf_counters.h>
22#include <Param.h>
23
24Implemente_instanciable(Modele_turbulence_hyd_K_Eps_Bas_Reynolds, "Modele_turbulence_hyd_K_Epsilon_Bas_Reynolds", Modele_turbulence_hyd_RANS_K_Eps_base);
25
27{
28 return s << que_suis_je() << " " << le_nom();
29}
30
32{
34}
35
41
43{
44 if (mot == "Modele_Fonc_Bas_Reynolds")
45 {
47 mon_modele_fonc_->discretiser();
48 Cerr << "Low Reynolds number model type " << mon_modele_fonc_->que_suis_je() << finl;
49 return 1;
50 }
51 else
53}
54
56{
57
58 const Champ_base& chK_Eps = get_unknown();
59 const Domaine_dis_base& le_dom_dis = get_eq_transport().domaine_dis();
60 const Domaine_Cl_dis_base& le_dom_Cl_dis = get_eq_transport().domaine_Cl_dis();
61 Nom type = chK_Eps.que_suis_je();
62 const DoubleTab& tab_K_Eps = chK_Eps.valeurs();
63 Debog::verifier("Modele_turbulence_hyd_K_Eps_Bas_Reynolds::calculer_viscosite_turbulente K_Eps", tab_K_Eps);
64 DoubleTab& visco_turb = la_viscosite_turbulente_->valeurs();
65 const Fluide_base& le_fluide = ref_cast(Fluide_base, get_eq_transport().milieu());
66 const Champ_Don_base& ch_visco_cin = le_fluide.viscosite_cinematique();
67 int n = tab_K_Eps.dimension(0);
68 DoubleTab Fmu(n);
69
70 mon_modele_fonc_->Calcul_Fmu(Fmu, le_dom_dis, le_dom_Cl_dis, tab_K_Eps, ch_visco_cin);
71
72 Debog::verifier("Modele_turbulence_hyd_K_Eps_Bas_Reynolds::calculer_viscosite_turbulente Fmu", Fmu);
73
74 //
75 // limiteur Durbin
76 //
77 // double T_durbin, T_kolmo, T_ke;
78 // dans le cas d'un domaine nul on doit effectuer le dimensionnement
79 double non_prepare = 1;
80 if (visco_turb.size() == n)
81 non_prepare = 0.;
82 non_prepare = mp_max(non_prepare);
83
84 if (non_prepare == 1)
85 {
86 OWN_PTR(Champ_Inc_base) visco_turb_au_format_K_eps_Bas_Re;
87 visco_turb_au_format_K_eps_Bas_Re.typer(type);
88 DoubleTab& visco_turb_K_eps_Bas_Re = complete_viscosity_field(n, get_eq_transport().domaine_dis(), visco_turb_au_format_K_eps_Bas_Re);
89
90 if (visco_turb_K_eps_Bas_Re.size() != n)
91 {
92 Cerr << "visco_turb_K_eps_Bas_Re size is " << visco_turb_K_eps_Bas_Re.size() << " instead of " << n << finl;
94 }
95
96 fill_turbulent_viscosity_tab(n, tab_K_Eps, Fmu, visco_turb_K_eps_Bas_Re);
97
98 la_viscosite_turbulente_->affecter(visco_turb_au_format_K_eps_Bas_Re.valeur());
99 }
100 else
101 fill_turbulent_viscosity_tab(n, tab_K_Eps, Fmu, visco_turb);
102
103 la_viscosite_turbulente_->changer_temps(temps);
104 return la_viscosite_turbulente_;
105}
106
107void Modele_turbulence_hyd_K_Eps_Bas_Reynolds::fill_turbulent_viscosity_tab(const int n, const DoubleTab& tab_K_Eps, const DoubleTab& Fmu, DoubleTab& turbulent_viscosity)
108{
109 for (int i = 0; i < n; i++)
110 {
111 if (tab_K_Eps(i, 1) <= DMINFLOAT)
112 turbulent_viscosity[i] = 0.;
113 else
114 turbulent_viscosity[i] = LeCmu_ * Fmu(i) * tab_K_Eps(i, 0) * tab_K_Eps(i, 0) / tab_K_Eps(i, 1);
115 }
116}
117
123
125{
130
131 statistics().begin_count(STD_COUNTERS::turbulent_viscosity, statistics().get_last_opened_counter_level()+1);
133 Debog::verifier("Modele_turbulence_hyd_K_Eps_Bas_Reynolds::mettre_a_jour apres calculer_viscosite_turbulente la_viscosite_turbulente", la_viscosite_turbulente_->valeurs());
134 statistics().end_count(STD_COUNTERS::turbulent_viscosity);
135}
136
141
142
143bool Modele_turbulence_hyd_K_Eps_Bas_Reynolds::has_champ(const Motcle& nom, OBS_PTR(Champ_base)& ref_champ) const
144{
146 return true;
147
148 if (mon_modele_fonc_)
149 if (mon_modele_fonc_->has_champ(nom, ref_champ))
150 return true;
151
152 return false; /* rien trouve */
153}
154
156{
158 return true;
159
160 if (mon_modele_fonc_)
161 if (mon_modele_fonc_->has_champ(nom))
162 return true;
163
164 return false; /* rien trouve */
165}
166
168{
169 OBS_PTR(Champ_base) ref_champ;
170
172 return ref_champ;
173
174 if (mon_modele_fonc_)
175 if (mon_modele_fonc_->has_champ(nom, ref_champ))
176 return ref_champ;
177
178 throw std::runtime_error(std::string("Field ") + nom.getString() + std::string(" not found !"));
179}
180
182{
184
185 if (mon_modele_fonc_)
186 mon_modele_fonc_->get_noms_champs_postraitables(nom, opt);
187
188}
189
194
class Champ_Don_base base class of Given Fields (not calculated)
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
Class Champ_Inc_base.
virtual DoubleTab & valeurs()=0
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
static void verifier(const char *const msg, double)
Definition Debog.cpp:21
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
virtual void mettre_a_jour(double temps)
Performs a time update of all boundary conditions.
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
virtual void mettre_a_jour(double temps)
The value of the unknown at the time step has been calculated.
virtual int preparer_calcul()
Everything that does not depend on other possible problems.
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the discretized boundary condition domain associated with the equation.
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
virtual bool initTimeStep(double dt)
Allocation and initialization of the unknown and boundary conditions until present+dt.
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
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
static void typer_lire_Modele_Fonc_Bas_Reynolds(OWN_PTR(Modele_Fonc_Bas_Reynolds_Base)&, const Equation_base &, Entree &is)
class Modele_turbulence_hyd_K_Eps_Bas_Reynolds
const Transport_K_Eps_Bas_Reynolds & get_eq_transport() const override
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
virtual Champ_Fonc_base & calculer_viscosite_turbulente(double temps)
const Champ_base & get_champ(const Motcle &nom) const override
Transport_K_Eps_Bas_Reynolds & get_set_eq_transport() override
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
DoubleTab & complete_viscosity_field(const int, const Domaine_dis_base &, Champ_Inc_base &)
std::enable_if_t<(M_TYPE==MODELE_TYPE::K_EPS||M_TYPE==MODELE_TYPE::K_EPS_REALISABLE||M_TYPE==MODELE_TYPE::K_OMEGA), void > calculate_limit_viscosity(Champ_Inc_base &, double)
Classe Modele_turbulence_hyd_RANS_K_Eps_base Classe de base des modeles de type RANS_keps.
OWN_PTR(Modele_Fonc_Bas_Reynolds_Base) &associe_modele_fonction()
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
OBS_PTR(Equation_base) mon_equation_
A character string (Nom) in uppercase.
Definition Motcle.h:26
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
virtual int lire_motcle_non_standard(const Motcle &motlu, Entree &is)
Reads non-simple-type parameters of an Objet_U from an input stream.
Definition Objet_U.cpp:115
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
@ 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
static double mp_max(double)
Definition Process.cpp:379
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
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
void completer() override
Completes the construction (initialization) of objects associated with the equation.
int controler_K_Eps()
Controle le champ inconnue K-epsilon en forcant a zero les valeurs du champ.