TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Transport_2eq_base.cpp
1/****************************************************************************
2* Copyright (c) 2025, 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#include <Transport_2eq_base.h>
16#include <Schema_Temps_base.h>
17#include <Champ_Inc_P0_base.h>
18#include <communications.h>
19#include <Probleme_base.h>
20#include <Discret_Thyd.h>
21#include <Domaine_VF.h>
22#include <Param.h>
23#include <Debog.h>
24
25Implemente_base(Transport_2eq_base, "Transport_2eq_base", Equation_base);
26
27
28// XD Transport_2eq_base eqn_base Transport_2eq_base BRACE Base class of the RANS transport equations in triocfd
29
30/*! @brief
31 *
32 * @param (Sortie& is) un flot de sortie
33 * @return (Sortie&) le flot de sortie modifie
34 */
36{
37 return is << que_suis_je() << "\n";
38}
39
40/*! @brief Simple appel a Equation_base::readOn(Entree&)
41 *
42 * @param (Entree& is) un flot d'entree
43 * @return (Entree&) le flot d'entree modifie
44 */
46{
48 return is;
49}
50
52{
54 param.ajouter_non_std("diffusion", (this));
55 param.ajouter_non_std("convection", (this));
56 param.ajouter_condition("is_read_diffusion", "The diffusion operator must be read, select negligeable type if you want to neglect it.");
57 param.ajouter_condition("is_read_convection", "The convection operator must be read, select negligeable type if you want to neglect it.");
58 param.ajouter_flag("disable_VEF_mean_value_corrections", &disable_VEF_mean_value_corrections_); // X_D_ADD_P flag Flag to prevent usage of mean value of neighbors for corrections applied to k-eps and k-omega models. This only applies to VEF (mean values not used in VDF). See methods 'Transport_K_Eps_base::controler_K_Eps' and 'Transport_K_Omega_base::controler_K_Omega' for more details.
59}
60
61// Lecture et typage de l'operateur diffusion turbulente.
62// Attention : il faut avoir fait "terme_diffusif.associer_diffusivite" avant d'enter ici.
64{
65 Motcle accouverte = "{", accfermee = "}";
66 Nom type = "Op_Diff_K_";
67
68 Nom eps_or_omega = que_suis_je();
69 if (eps_or_omega.contient("Omega")) type += "Omega_";
70 else type += "Eps_";
71
73 Cerr << ">>>>>>> Nom eq = " << qc << finl;
74 if (qc=="Navier_Stokes_QC" || qc == "Navier_Stokes_Turbulent_QC")
75 {
76 type+="QC_";
77 }
78
79 Nom discr = discretisation().que_suis_je();
80 // les operateurs de diffusion sont communs aux discretisations VEF et VEFP1B
81 if (discr == "VEFPreP1B") discr = "VEF";
82
83 type += discr;
84
85 Nom nb_inc;
86 if (terme_diffusif.diffusivite().nb_comp() == 1)
87 nb_inc = "_";
88 else
89 nb_inc = "_Multi_inco_";
90 type += nb_inc;
91
92 Nom type_inco = inconnue().que_suis_je();
93 if (type_inco == "Champ_Q1_EF") type += "Q1";
94 else type += (type_inco.suffix("Champ_"));
95
96 if (axi) type += "_Axi";
97
98 Motcle motbidon;
99 is >> motbidon;
100 if (motbidon != accouverte)
101 {
102 Cerr << "A { was expected while reading the turbulent diffusive term" << finl;
104 }
105 is >> motbidon;
106 if (motbidon == "negligeable")
107 {
108 type = "Op_Dift_negligeable";
109 terme_diffusif.typer(type);
110 terme_diffusif.l_op_base().associer_eqn(*this);
111 terme_diffusif->associer_diffusivite(terme_diffusif.diffusivite());
112 is >> motbidon;
113 //on lit la fin de diffusion { }
114 if (motbidon != accfermee)
115 Cerr << " On ne peut plus entrer d option apres negligeable " << finl;
116 }
117 else if (motbidon == accfermee)
118 {
119 terme_diffusif.typer(type);
120 terme_diffusif.l_op_base().associer_eqn(*this);
121 Cerr << terme_diffusif->que_suis_je() << finl;
122 terme_diffusif->associer_diffusivite(terme_diffusif.diffusivite());
123 }
124 else
125 {
126 type += motbidon;
127 is >> motbidon;
128 if (motbidon != accfermee)
129 Cerr << " No option are now readable for the turbulent diffusive term" << finl;
130
131 if (discr == "VEF")
132 type += "_P1NC";
133 terme_diffusif.typer(type);
134 terme_diffusif.l_op_base().associer_eqn(*this);
135 Cerr << terme_diffusif->que_suis_je() << finl;
136 terme_diffusif->associer_diffusivite(terme_diffusif.diffusivite());
137 }
138 return is;
139}
140
141//For VEF-like scheme
143{
144 const Domaine_VF& domaine_vf = ref_cast(Domaine_VF, domaine_dis());
145
146 position = "x=";
147 position += (Nom)domaine_vf.xv(n, 0);
148 position += " y=";
149 position += (Nom)domaine_vf.xv(n, 1);
150 if (dimension == 3)
151 {
152 position += " z=";
153 position += (Nom)domaine_vf.xv(n, 2);
154 }
155}
156
157// For VDF-like scheme
159{
160 const Domaine_VF& domaine_vf = ref_cast(Domaine_VF, domaine_dis());
161
162 position = "x=";
163 position += (Nom)domaine_vf.xp(n, 0);
164 position += " y=";
165 position += (Nom)domaine_vf.xp(n, 1);
166 if (dimension == 3)
167 {
168 position += " z=";
169 position += (Nom)domaine_vf.xp(n, 2);
170 }
171}
172
173/*! @brief Associe un milieu physique a l'equation.
174 *
175 * @param (Milieu_base& un_milieu) le milieu physique a associer a l'equation
176 */
178{
179 le_fluide = un_milieu;
180}
181
182/*! @brief Renvoie le milieu (fluide) associe a l'equation.
183 *
184 * @return (Milieu_base&) le milieu (fluide) associe a l'equation
185 */
187{
188 if(!le_fluide)
189 {
190 Cerr << "No fluid has been associated to the two equations Transport"
191 << que_suis_je() << " equation." << finl;
193 }
194 return le_fluide.valeur();
195}
196
197/*! @brief Renvoie le milieu (fluide) associe a l'equation.
198 *
199 * (version const)
200 *
201 * @return (Milieu_base&) le milieu (fluide) associe a l'equation
202 */
204{
205 if(!le_fluide)
206 {
207 Cerr << "No fluid has been associated to the Transport K_Epsilon"
208 << que_suis_je() << " equation." << finl;
210 }
211 return le_fluide.valeur();
212}
213
220
222{
223 // on prend le pas de temps de l'eq de NS.
225}
class Domaine_VF
Definition Domaine_VF.h:44
double xv(int num_face, int k) const
Definition Domaine_VF.h:76
double xp(int num_elem, int k) const
Definition Domaine_VF.h:77
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
virtual void set_param(Param &titi) const override
virtual void associer_domaine_dis(const Domaine_dis_base &)
Associe le domaine discretise a l'equation.
virtual void associer_pb_base(const Probleme_base &)
S'associe au Probleme passe en parametre.
const Discretisation_base & discretisation() const
Renvoie la discretisation associee a l'equation.
virtual const Champ_Inc_base & inconnue() const =0
Probleme_base & probleme()
Renvoie le probleme associe a l'equation.
virtual void associer_sch_tps_base(const Schema_Temps_base &)
S'associe au schema_en_temps.
Schema_Temps_base & schema_temps()
Renvoie le schema en temps associe a l'equation.
Domaine_dis_base & domaine_dis()
Renvoie le domaine discretise associe a l'equation.
virtual double calculer_pas_de_temps() const
Calcul du prochain pas de temps.
classe Milieu_base Cette classe est la base de la hierarchie des milieux (physiques)
Definition Milieu_base.h:50
Equation_base & equation()
Renvoie l'equation associee au modele de turbulence.
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
bool contient(const Nom &nom) const
Definition Nom.h:86
Nom & suffix(const char *const)
Extraction de suffixe : Nom x("azerty");.
Definition Nom.cpp:271
friend class Entree
Definition Objet_U.h:76
static int dimension
Definition Objet_U.h:99
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
static int axi
Definition Objet_U.h:101
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter_flag(const char *keyword, const bool *value)
Register a boolean flag whose mere presence switches it to true.
Definition Param.cpp:474
void ajouter_condition(const char *condition, const char *message, const char *name=0)
Declare a post-read logical condition that must hold on the parameter values.
Definition Param.cpp:496
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
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
Classe de base des flux de sortie.
Definition Sortie.h:52
Classe Transport_2eq_base Classe de base pour les equations.
void set_param(Param &) const override
Milieu_base & milieu() override
Renvoie le milieu (fluide) associe a l'equation.
const Modele_turbulence_hyd_2_eq_base & modele_turbulence() const
Renvoie le modele de turbulence associe a l'equation.
Operateur_Diff terme_diffusif
void associer(const Equation_base &)
void get_position_cells(Nom &, int &)
void associer_milieu_base(const Milieu_base &) override
Associe un milieu physique a l'equation.
void get_position_faces(Nom &, int &)
double calculer_pas_de_temps() const override
Calcul du prochain pas de temps.
Entree & lire_op_diff_turbulent(Entree &is)