TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Transport_Fluctuation_Temperature.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 <Transport_Fluctuation_Temperature.h>
17#include <Modele_turbulence_scal_Fluctuation_Temperature.h>
18#include <Discret_Thermique.h>
19#include <Les_Pb_Turb.h>
20#include <Param.h>
21#include <Fluide_base.h>
22
23Implemente_instanciable_sans_constructeur(Transport_Fluctuation_Temperature,"Transport_Fluctuation_Temperature",Convection_Diffusion_std);
24
26{
27 /*
28 Noms& nom=champs_compris_.liste_noms_compris();
29 nom.dimensionner(3);
30 nom[0]="variance_temperature";
31 nom[1]="taux_dissipation_temperature";
32 nom[2]="Fluctu_Temperature";
33 */
34}
35
36// printOn et readOn
37
39{
40 return s << que_suis_je() << "\n";
41}
42
43/*! @brief cf Convection_Diffusion_std::readOn(is)
44 *
45 */
47{
49 if (les_sources.est_vide())
50 {
51 // Ajout automatique du terme source
52 Source t;
53 Source& so=les_sources.add(t);
54 const Probleme_base& pb = probleme();
55 Cerr << "Construction and typing for the source term of the Transport_Fluctuation_Temperature transport equation." << finl;
56 if (sub_type(Pb_Thermohydraulique_Turbulent,pb))
57 {
58 Nom typ = "Source_Transport_Fluctuation_Temperature";
59 so.typer(typ,*this);
60 }
61 so->associer_eqn(*this);
62 }
63 return is;
64}
65
70
72{
73 if (mot=="diffusion")
74 {
75 Cerr << "Reading and typing of the diffusion operator : " << finl;
76 is >> terme_diffusif;
77 return 1;
78 }
79 else
81}
82
84{
85 const Discret_Thermique& dis = ref_cast(Discret_Thermique,discretisation());
86 Cerr << "Transport_Fluctuation_Temperature equation discretization" << finl;
87 dis.Fluctu_Temperature(schema_temps(),domaine_dis(),le_champ_Fluctu_Temperature);
88 champs_compris_.ajoute_champ(le_champ_Fluctu_Temperature);
90}
91
93{
94 // Source t;
95 // Source& so=les_sources.add(t);
96 les_sources.completer();
97 inconnue().associer_eqn(*this);
98 for(int i=0; i<nombre_d_operateurs(); i++)
99 {
100 operateur(i).completer();
101 }
102 le_dom_Cl_dis->completer();
103 // Suppression car le completer fait desormais appel au 2eme completer
104 //le_dom_Cl_dis->completer(domaine_dis());
105}
106
107/*! @brief surcharge de la methode d'Equation_base.
108 *
109 * renvoie le nombre d'operateurs.
110 *
111 */
116
117/*! @brief surcharge de la methode d'Equation_base.
118 *
119 * renvoie le ieme operateur.
120 *
121 */
123{
124 assert(i>=0);
125 assert(i<nombre_d_operateurs());
126
127 switch(i)
128 {
129 case 0:
130 {
131 return terme_diffusif;
132 }
133 case 1:
134 {
135 return terme_convectif;
136 }
137 default :
138 {
139 Cerr << "Error for Transport_Fluctuation_Temperature::operateur(int i)" << finl;
140 Cerr << "Transport_Fluctuation_Temperature has " << nombre_d_operateurs() <<" operators "<<finl;
141 Cerr << "and you are trying to access the " << i <<" th one."<< finl;
143 }
144 }
145 return terme_diffusif;
146}
147
148/*! @brief surcharge de la methode d'Equation_base.
149 *
150 * renvoie le ieme operateur.
151 *
152 */
154{
155 assert(i>=0);
156 assert(i<nombre_d_operateurs());
157
158 switch(i)
159 {
160 case 0:
161 {
162 return terme_diffusif;
163 }
164 case 1:
165 {
166 return terme_convectif;
167 }
168 default :
169 {
170 Cerr << "Error for Transport_Fluctuation_Temperature::operateur(int i)" << finl;
171 Cerr << "Transport_Fluctuation_Temperature has " << nombre_d_operateurs() <<" operators "<<finl;
172 Cerr << "and you are trying to access the " << i <<" th one."<< finl;
174 }
175 }
176 return terme_diffusif;
177}
178
179/*! @brief association entre Transport_Fluctuation_Temperature et Milieu_base.
180 *
181 * affecte le_Milieu_base.
182 *
183 */
185{
186 le_fluide = ref_cast(Fluide_base, un_milieu) ;
187}
188
190{
191 if(!le_fluide)
192 {
193 Cerr << "No fluid has been associated to"
194 << "Transport_Fluctuation_Temperature equation." << finl;
196 }
197 return le_fluide.valeur();
198}
199
201{
202 if(!le_fluide)
203 {
204 Cerr << "No fluid has been associated to"
205 << "Transport_Fluctuation_Temperature equation." << finl;
207 }
208 return le_fluide.valeur();
209}
210
211
213{
214 static Motcle domaine = "Thermique";
215 return domaine;
216}
217
228
230{
231 static const double LIM = 1.e-10;
232 DoubleTab& fluctuation = le_champ_Fluctu_Temperature->valeurs();
233 int size=fluctuation.dimension(0);
234 for (int n=0; n<size; n++)
235 {
236 if ( fluctuation(n,0) <= LIM)
237 fluctuation(n,0) = 0.;
238 if ( fluctuation(n,1) <= LIM)
239 fluctuation(n,1)= 0.;
240 }
241 return 1;
242}
virtual void associer_eqn(const Equation_base &)
Associates the field with the equation of which it represents an unknown.
Convection_Diffusion_std This class is the base for equations modelling the transport.
void set_param(Param &titi) const override
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
Class Discret_Thermique: base class representing a spatial discretisation applied to thermal problems...
void Fluctu_Temperature(const Schema_Temps_base &, Domaine_dis_base &, OWN_PTR(Champ_Inc_base)&) const
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 void associer_domaine_dis(const Domaine_dis_base &)
Associates the discretized domain with the equation.
virtual void associer_pb_base(const Probleme_base &)
Associates with the Problem passed as parameter.
const Discretisation_base & discretisation() const
Returns the discretization associated with the equation.
Sources les_sources
Probleme_base & probleme()
Returns the problem associated with the equation.
virtual void associer_sch_tps_base(const Schema_Temps_base &)
Associates the time scheme with the equation.
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
virtual void discretiser()
Discretizes the equation.
Champs_compris champs_compris_
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
Milieu_base This class is the base of the (physical) medium hierarchy.
Definition Milieu_base.h:50
Convection_Diffusion_std & equation()
A character string (Nom) in uppercase.
Definition Motcle.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 Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
class Operateur Generic class of the operator hierarchy.
Definition Operateur.h:39
virtual void completer()
Updates the references of the objects associated with the operator.
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52
void typer(const Nom &, const Equation_base &)
Types the source by computing the required type name from the provided parameters.
Definition Source.cpp:52
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
void discretiser() override
Discretizes the equation.
void associer_modele_turbulence(const Modele_turbulence_scal_Fluctuation_Temperature &)
void associer_milieu_base(const Milieu_base &) override
association entre Transport_Fluctuation_Temperature et Milieu_base.
const Operateur & operateur(int) const override
surcharge de la methode d'Equation_base.
int nombre_d_operateurs() const override
surcharge de la methode d'Equation_base.
const Champ_Inc_base & inconnue() const override
renvoie le champ inconnue.
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 construction (initialization) of objects associated with the equation.
const Motcle & domaine_application() const override
Returns "indeterminate" Navier_Stokes_standard for example overrides this method.