TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Source_Transport_proto.cpp
1/****************************************************************************
2* Copyright (c) 2022, 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 <Pb_Thermohydraulique_Concentration_Turbulent.h>
17#include <Pb_Hydraulique_Concentration_Turbulent.h>
18#include <Pb_Thermohydraulique_Turbulent_QC.h>
19#include <Pb_Thermohydraulique_Turbulent.h>
20#include <Pb_Hydraulique_Turbulent.h>
21#include <Source_Transport_proto.h>
22#include <Fluide_Dilatable_base.h>
23#include <Param.h>
24
25// Source-transport keyword blocks. They are declared here, next to the readOn_*
26// helpers that actually read their parameters, rather than in TRAD2_turbulence.xd.
27// Each block uses the param fragment matching the readOn_* variant it calls.
28// XD source_transport_eps source_base source_transport_eps INHERITS_BRACE Keyword to alter the source term constants
29// XD_CONT for eps in the bicephale k-eps model epsilon transport equation. By default, these constants are set to:
30// XD_CONT C1_eps=1.44 C2_eps=1.92
31// XD_USE_PARAM_FRAGMENT source_transport_proto
32// XD source_transport_k source_base source_transport_k INHERITS_BRACE Keyword to alter the source term constants for k
33// XD_CONT in the bicephale k-eps model epsilon transport equation.
34// XD source_transport_k_eps source_base source_transport_k_eps INHERITS_BRACE Keyword to alter the source term
35// XD_CONT constants in the standard k-eps model epsilon transport equation. By default, these constants are set to:
36// XD_CONT C1_eps=1.44 C2_eps=1.92
37// XD_USE_PARAM_FRAGMENT source_transport_proto
38// XD source_transport_k_eps_realisable source_base source_transport_k_eps_realisable INHERITS_BRACE Keyword to alter
39// XD_CONT the source term constants in the standard k-eps model epsilon transport equation. By default, these constants
40// XD_CONT are set to: C1_eps=1.44 C2_eps=1.92
41// XD_USE_PARAM_FRAGMENT source_transport_realisable
42// XD Source_Transport_K_Eps_anisotherme source_transport_k_eps Source_Transport_K_Eps_anisotherme INHERITS_BRACE
43// XD_CONT Keywords to modify the source term constants in the anisotherm standard k-eps model epsilon transport
44// XD_CONT equation. By default, these constants are set to: C1_eps=1.44 C2_eps=1.92 C3_eps=1.0
45// XD_USE_PARAM_FRAGMENT source_transport_anisotherme
46// XD source_transport_k_eps_aniso_concen source_transport_k_eps source_transport_k_eps_aniso_concen INHERITS_BRACE
47// XD_CONT Keywords to modify the source term constants in the anisotherm standard k-eps model epsilon transport
48// XD_CONT equation. By default, these constants are set to: C1_eps=1.44 C2_eps=1.92 C3_eps=1.0
49// XD_USE_PARAM_FRAGMENT source_transport_anisotherme
50// XD source_transport_k_eps_aniso_therm_concen source_transport_k_eps source_transport_k_eps_aniso_therm_concen INHERITS_BRACE Keywords to modify the source term constants in the anisotherm standard k-eps model epsilon transport equation. By default, these constants are set to: C1_eps=1.44 C2_eps=1.92 C3_eps=1.0
51// XD_USE_PARAM_FRAGMENT source_transport_anisotherme
52
53// XD_DECLARE_PARAM_FRAGMENT source_transport_proto Source term constants for the standard k-eps model epsilon equation.
55{
56 Param param(nom);
57 param.ajouter("C1_eps", &C1); // XD_ADD_P double
58 // XD_CONT Constant for the epsilon equation (default = 1.44)
59 param.ajouter("C2_eps", &C2); // XD_ADD_P double
60 // XD_CONT Constant for the epsilon equation (default = 1.92)
61 param.lire_avec_accolades(is);
62 Cerr << "C1_eps = " << C1 << finl;
63 Cerr << "C2_eps = " << C2 << finl;
64 return is;
65}
66
68{
69 Param param(nom);
70 param.lire_avec_accolades(is);
71 return is ;
72}
73
74// XD_DECLARE_PARAM_FRAGMENT source_transport_anisotherme Additional source term constant for the anisothermal model.
76{
77 Param param(nom);
78 param.ajouter("C1_eps", &C1); // provided by the source_transport_proto fragment (inherited)
79 param.ajouter("C2_eps", &C2); // provided by the source_transport_proto fragment (inherited)
80 param.ajouter("C3_eps", &C3); // XD_ADD_P double
81 // XD_CONT Constant for the epsilon equation (default = 1.0)
82 param.lire_avec_accolades(is);
83 Cerr << "C1_eps = " << C1 << finl;
84 Cerr << "C2_eps = " << C2 << finl;
85 Cerr << "C3_eps = " << C3 << finl;
86 return is ;
87}
88
90
92
93// XD_DECLARE_PARAM_FRAGMENT source_transport_realisable Source term constants for the realisable k-eps model.
95{
96 Param param(nom);
97 param.ajouter("C2_eps", &C2); // XD_ADD_P double
98 // XD_CONT Constant for the epsilon equation (default = 1.92)
99 param.ajouter("interpolation_viscosite_turbulente", &_interpolation_viscosite_turbulente); // XD_ADD_P entier
100 // XD_CONT Method to interpolation the turbulent viscosity (0 for arithmetic, 1 for harmonic, 2 for volume-weighted
101 // XD_CONT harmonic, 3 for size-weighted harmonic)
102 param.ajouter("coefficient_limiteur", &_coefficient_limiteur); // XD_ADD_P double
103 // XD_CONT Clipping coefficient, never used (default = 1)
104 param.lire_avec_accolades(is);
105 Cerr << "C2_eps = " << C2 << finl;
106
107 // Checking of the value given in the data deck for "interpolation_viscosite_turbulente"
109 Cerr << "Interpolation arithmetique de la viscosite turbulente aux faces (si VEF) = " << finl;
111 Cerr << "Interpolation harmonique de la viscosite turbulente aux faces (si VEF) = " << finl;
113 Cerr << "Interpolation harmonique ponderee par les volumes de maille de la viscosite turbulente aux faces (si VEF) = " << finl;
115 Cerr << "Interpolation harmonique ponderee par les tailles de maille de la viscosite turbulente aux faces (si VEF) = " << finl;
116 else
117 {
118 Cerr << "Error in 'interpolation_viscosite_turbulente' input value :" << _interpolation_viscosite_turbulente << finl;
120 }
121
122 return is;
123}
124
126{
127 Param param(nom);
128 param.ajouter("C2_eps", &C2); // documented via the source_transport_* fragments
129 param.ajouter("C3_eps", &C3); // documented via the source_transport_anisotherme fragment
130 param.lire_avec_accolades(is);
131 Cerr << "C2_eps = " << C2 << finl;
132 Cerr << "C3_eps = " << C3 << finl;
133 return is;
134}
135
137
139
141{
142 if (!sub_type(Pb_Hydraulique_Turbulent, pb) && !sub_type(Pb_Thermohydraulique_Turbulent_QC, pb))
143 error_model(nom, pb.que_suis_je());
144}
145
147{
148 if (!sub_type(Pb_Thermohydraulique_Turbulent, pb))
149 error_model(nom, pb.que_suis_je());
150}
151
153{
155 error_model(nom, pb.que_suis_je());
156}
157
159{
161 error_model(nom, pb.que_suis_je());
162}
163
165{
166 if (sub_type(Pb_Thermohydraulique_Turbulent_QC, pb))
167 Cerr << "You are using the k-omega model in quasi-compressible. It might not be well validated. Use with caution." << finl;
168}
169
171{
172 const Milieu_base& milieu = pb.equation(1).milieu(); // eq thermique
173 if (pb.nombre_d_equations() < 2)
174 error_model(nom, pb.que_suis_je());
175
176 if (sub_type(Fluide_Dilatable_base, ref_cast(Fluide_base, milieu)))
177 error_model(nom, milieu.que_suis_je());
178}
179
181{
182 const Milieu_base& milieu = pb.equation(0).milieu(); // XXX : Attention pas eq 1 car Constituant derive pas de Fluide_base ! donc eq hydro
183 if (pb.nombre_d_equations() < 2)
184 error_model(nom, pb.que_suis_je());
185
186 if (sub_type(Fluide_Dilatable_base, ref_cast(Fluide_base, milieu)))
187 error_model(nom, milieu.que_suis_je());
188}
189
191{
192 const Milieu_base& milieu = pb.equation(1).milieu(); // eq thermique
193 if (pb.nombre_d_equations() < 3)
194 error_model(nom, pb.que_suis_je());
195
196 if (sub_type(Fluide_Dilatable_base, ref_cast(Fluide_base, milieu)))
197 error_model(nom, milieu.que_suis_je());
198}
199
201{
202 if (!fluide.has_beta_c())
203 {
204 Cerr << "You forgot to define beta_co field in the fluid. It is mandatory when using the K-Eps model (buoyancy effects)." << finl;
205 Cerr << "If you don't want buoyancy effects, then specify: beta_co champ_uniforme 1 0." << finl;
207 }
208}
209
211{
212 eq_hydraulique = pb.equation(0);
213}
214
216{
217 const Fluide_base& fluide = ref_cast(Fluide_base, pb.equation(1).milieu());
218 beta_t = fluide.beta_t();
219 gravite = fluide.gravite();
220 eq_thermique = ref_cast(Convection_Diffusion_Temperature, pb.equation(1));
221}
222
224{
225 const Fluide_base& fluide = ref_cast(Fluide_base, pb.equation(0).milieu()); // XXX : Attention pas eq 1 car Constituant derive pas de Fluide_base !
226 verifier_beta_concen(fluide);
227 beta_c = fluide.beta_c();
228 gravite = fluide.gravite();
229 eq_concentration = ref_cast(Convection_Diffusion_Concentration, pb.equation(1));
230}
231
233{
234 const Fluide_base& fluide = ref_cast(Fluide_base,pb.equation(1).milieu()); // a partir de l'eq thermique
235 verifier_beta_concen(fluide);
236 beta_t = fluide.beta_t();
237 beta_c = fluide.beta_c();
238 gravite = fluide.gravite();
239 eq_thermique = ref_cast(Convection_Diffusion_Temperature, pb.equation(1));
240 eq_concentration = ref_cast(Convection_Diffusion_Concentration, pb.equation(2));
241}
classe Convection_Diffusion_Concentration Cas particulier de Convection_Diffusion_std
classe Convection_Diffusion_Temperature Cas particulier de Convection_Diffusion_std
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual const Milieu_base & milieu() const =0
classe Fluide_Dilatable_base Cette classe represente un d'un fluide dilatable,
classe Fluide_base Cette classe represente un d'un fluide incompressible ainsi que
Definition Fluide_base.h:38
bool has_beta_c() const
Definition Fluide_base.h:67
const Champ_Don_base & beta_c() const
Definition Fluide_base.h:65
classe Milieu_base Cette classe est la base de la hierarchie des milieux (physiques)
Definition Milieu_base.h:50
virtual const Champ_Don_base & beta_t() const
Renvoie beta_t du milieu.
virtual const Champ_Don_base & gravite() const
Renvoie la gravite du milieu si elle a ete associe provoque une erreur sinon.
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
int lire_avec_accolades(Entree &is)
Alias of lire_avec_accolades_depuis.
Definition Param.h:577
classe Pb_Hydraulique_Concentration_Turbulent Cette classe represente un probleme d'hydraulique avec ...
classe Pb_Hydraulique_Turbulent Cette classe represente un probleme d'hydraulique turbulent dans
Classe Pb_Thermohydraulique_Concentration_Turbulent Cette classe represente un probleme de thermohydr...
classe Pb_Thermohydraulique_Turbulent Cette classe represente un probleme de thermohydraulique en flu...
classe Pb_Thermohydraulique_Turbulent Cette classe represente un probleme de thermohydraulique
classe Probleme_base C'est un Probleme_U qui n'est pas un couplage.
virtual int nombre_d_equations() const =0
virtual const Equation_base & equation(int) const =0
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Entree & readOn_anisotherme(Entree &, const Nom &)
Entree & readOn_anisotherme_concen_real(Entree &, const Nom &)
Entree & readOn_concen(Entree &, const Nom &)
Entree & readOn_anisotherme_real(Entree &, const Nom &)
Entree & readOn_concen_real(Entree &, const Nom &)
Entree & readOn_nothing(Entree &, const Nom &)
void associer_pb_concen(const Probleme_base &)
void associer_pb_anisotherme(const Probleme_base &)
void verifier_milieu_concen(const Probleme_base &, const Nom &)
void verifier_pb_keps_anisotherme(const Probleme_base &, const Nom &)
void associer_pb_proto(const Probleme_base &)
void verifier_pb_keps(const Probleme_base &, const Nom &)
Entree & readOn_real(Entree &, const Nom &)
Entree & readOn_anisotherme_concen(Entree &, const Nom &)
void verifier_milieu_anisotherme(const Probleme_base &, const Nom &)
Entree & readOn_proto(Entree &, const Nom &)
void verifier_pb_komega(const Probleme_base &, const Nom &)
void verifier_milieu_anisotherme_concen(const Probleme_base &, const Nom &)
void associer_pb_anisotherme_concen(const Probleme_base &)
void verifier_pb_keps_concen(const Probleme_base &, const Nom &)
void verifier_beta_concen(const Fluide_base &)
void verifier_pb_keps_anisotherme_concen(const Probleme_base &, const Nom &)