TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Echange_contact_VDF_FT_Disc_solid.cpp
1/****************************************************************************
2* Copyright (c) 2015 - 2016, 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 <Echange_contact_VDF_FT_Disc_solid.h>
17
18#include <Champ_front_calc.h>
19#include <Probleme_base.h>
20#include <Champ_Uniforme.h>
21#include <Schema_Temps_base.h>
22#include <Milieu_base.h>
23#include <Modele_turbulence_scal_base.h>
24#include <Domaine_VDF.h>
25#include <Equation_base.h>
26#include <Conduction.h>
27#include <Param.h>
28#include <Interprete.h>
29#include <Probleme_FT_Disc_gen.h>
30#include <Triple_Line_Model_FT_Disc.h>
31#include <Domaine_Cl_VDF.h>
32#include <EcrFicPartage.h>
33
34
35Implemente_instanciable( Echange_contact_VDF_FT_Disc_solid, "Echange_contact_VDF_FT_Disc_solid", Echange_contact_VDF_FT_Disc ) ;
36// XD echange_contact_vdf_ft_disc_solid condlim_base echange_contact_vdf_ft_disc_solid BRACE echange_conatct_vdf en
37// XD_CONT prescisant la phase
38
39int meme_point2(const DoubleVect& a,const DoubleVect& b);
40
42{
44 return os;
45}
46
48{
49 if (app_domains.size() == 0) app_domains = { Motcle("Thermique") };
50
51 // Echange_contact_VDF_FT_Disc::readOn( is );
52 Cerr<<"Lecture des parametres du contact (Echange_contact_VDF_FT_Disc_solid::readOn)"<<finl;
53 Param param("Echange_contact_VDF_FT_Disc_solid::readOn");
54 param.ajouter("autre_probleme",&nom_autre_pb_,Param::REQUIRED); // XD_ADD_P chaine
55 // XD_CONT name of other problem
56 param.ajouter("autre_bord",&nom_bord,Param::REQUIRED); // XD_ADD_P chaine
57 // XD_CONT name of other boundary
58 param.ajouter("autre_champ_temperature_indic1",&nom_champ,Param::REQUIRED); // XD_ADD_P chaine
59 // XD_CONT name of temperature indic 1
60 param.ajouter("autre_champ_temperature_indic0",&nom_champ_T2_autre_pb_,Param::REQUIRED); // XD_ADD_P chaine
61 // XD_CONT name of temperature indic 0
62 param.ajouter("autre_champ_indicatrice",&nom_champ_indicatrice_,Param::REQUIRED); // XD_ADD_P chaine
63 // XD_CONT name of indicatrice
64 param.ajouter("dt_impr_Tw",&dt_impr_Tw_); // XD_ADD_P double
65 // XD_CONT not_set
66 param.ajouter("Ri_liq",&Ri_); // XD_ADD_P double
67 // XD_CONT interficial thermal resitence of liquid
68 param.lire_avec_accolades(s);
69
71 h_paroi=1e10;
72 numero_T_=0;
73
74 T_autre_pb_.typer("Champ_front_calc");
75 le_champ_front.typer("Ch_front_var_instationnaire_dep");
77 return s;
78}
80{
81 // update T_autre pb1/2
82 T2_autre_pb_->mettre_a_jour(temps);
83 T_autre_pb_->mettre_a_jour(temps);
84 indicatrice_->mettre_a_jour(temps);
85 int nb_comp;
86 {
88 const Milieu_base& le_milieu=ch.milieu();
89 nb_comp = le_milieu.conductivite().nb_comp();
90 assert(nb_comp==1);
91 }
92 const DoubleTab& I = indicatrice_->valeurs_au_temps(temps);
93
94 int is_pb_fluide=0;
95
96 DoubleTab& hh_imp= h_imp_->valeurs();
97 hh_imp=0;
98 DoubleTab mon_h(hh_imp);
99 DoubleTab& Text=T_ext(). valeurs();
100 DoubleTab& mon_Ti= Ti_wall_-> valeurs();
101
102 DoubleTab Texttmp(Text);
103 DoubleTab Twalltmp(Text);
104 Twalltmp.detach_vect();
105
106 int opt=0;
107 // h of solid
108 calculer_h_mon_pb(mon_h,0.,opt);
109 // need to overwrite mon_h by h_micro in 2-phase cells
110 // 1, compoute Q_micro
111
112 // numero_T = 0 T_autre_pb_
113 // numero_T = 1 T2_autre_pb_
114 for( int n=0; n<2; n++)
115 {
116 numero_T_=n;
117 // h of fluid
119
120 calculer_Teta_paroi(Twalltmp,mon_h,autre_h,is_pb_fluide,temps);
121 // calculer_Teta_equiv(Text,mon_h,autre_h,is_pb_fluide,temps);
122 calculer_Teta_equiv(Texttmp,mon_h,autre_h,is_pb_fluide,temps);
123 // on a calculer Teta paroi, on peut calculer htot dans himp (= mon_h)
124 int taille=mon_h.dimension(0);
125 double I_ref_=1.;
126 if (n==1)
127 I_ref_=0;
128 for (int ii=0; ii<taille; ii++)
129 {
130 if (est_egal(I(ii,0),I_ref_))
131 for (int jj=0; jj<nb_comp; jj++)
132 {
133 hh_imp(ii,jj)=1./(1./autre_h(ii,jj)+1./mon_h(ii,jj));
134
135 Text(ii,jj)=Texttmp(ii,jj);
136 mon_Ti(ii) = Twalltmp(ii, jj);
137 }
138 }
139 }
140 const Domaine_VF& le_dom = ref_cast(
141 Domaine_VF, mon_dom_cl_dis->domaine_dis());
142
143
145 const Probleme_FT_Disc_gen *pbft = dynamic_cast<const Probleme_FT_Disc_gen*> (&pb_gen);
146 if (pbft->tcl ().is_activated ())
147 {
148 DoubleTab& mon_phi = phi_ext_->valeurs ();
149 mon_phi = 0;
150
151 // Numero_T = 0 corresponding I_ref_=1. Liquid side
152 // use T_autre_pb_ for ref_cast
153 numero_T_=0;
154 const Champ_front_calc& ch = ref_cast(Champ_front_calc, T_autre_pb());
155 const Domaine_Cl_dis_base& zcldis = ch.domaine_Cl_dis();
156 const Domaine_Cl_VDF& zclvdf = ref_cast(Domaine_Cl_VDF, zcldis);
157 const Front_VF& front_vf = ref_cast(Front_VF, ch.front_dis ());
158
159
160 const Cond_lim_base& la_cl = zclvdf.condition_limite_de_la_frontiere(front_vf.frontiere().le_nom());
161
162 if (sub_type(Echange_contact_VDF_FT_Disc, la_cl))
163 {
164 const Echange_contact_VDF_FT_Disc& la_cl_typee = ref_cast(
166
167 const DoubleTab& autre_phi = la_cl_typee.phi_ext().valeurs ();
168
169
170
171 // trace_elem_xxx(x, y) is elelmet-based function, X should be is indiced with element number
172 // when several paves are used (progressive mesh), the elem-number is not continued at BC
173 // create an elelmet-based Field phi_filed, filled the value of autre_phi at the boundary
174
175
176 const Equation_base& autre_eqn = ref_cast(Equation_base, ch.domaine_Cl_dis().equation());
177 const DoubleTab& autre_inco =autre_eqn.inconnue().valeurs();
178
179 DoubleTab phi_filed(autre_inco);
180 phi_filed = 0.;
181
182 const Domaine_dis_base& domainedis = ref_cast(Domaine_dis_base, ch.domaine_dis());
183 const IntTab& face_voisins_loc = domainedis.face_voisins();
184
185 for (int ii = 0; ii < autre_phi.dimension (0); ii++)
186 {
187 const int face_loc = ii + front_vf.frontiere().num_premiere_face();
188 int elem = face_voisins_loc(face_loc, 0);
189 if (elem == -1)
190 elem = face_voisins_loc(face_loc, 1);
191 phi_filed(elem) = autre_phi(ii);
192 }
193
194 Nom nom_racc1=frontiere_dis().frontiere().le_nom();
195 if (mon_dom_cl_dis -> domaine().raccord(nom_racc1)->que_suis_je() =="Raccord_distant_homogene")
196 {
197 // front_vf.frontiere ().trace_elem_distant (autre_phi, mon_phi);
198 front_vf.frontiere ().trace_elem_distant (phi_filed, mon_phi);
199 }
200 else // Raccord_local_homogene
201 {
202 // front_vf.frontiere ().trace_elem_local (autre_phi, mon_phi);
203 front_vf.frontiere ().trace_elem_local (phi_filed, mon_phi);
204 }
205 }
206
207 const Equation_base& mon_eqn = domaine_Cl_dis().equation();
208 const DoubleTab& mon_inco = mon_eqn.inconnue().valeurs();
209 const IntTab& face_voisins = le_dom.face_voisins();
210
211 // replace mon_h and mon_Ti;
212 int taille = mon_h.dimension(0);
213 for (int jj = 0; jj < nb_comp; jj++)
214 {
215 for (int ii = 0; ii < taille; ii++)
216 {
217 if (!est_egal(mon_phi(ii, jj), 0.))
218 {
219 mon_phi(ii, jj) = -mon_phi(ii, jj);
220
221 hh_imp(ii, jj) = 0.;
222
223 const int face = ii + frontiere_dis().frontiere().num_premiere_face();
224
225 const int elemi = face_voisins(face, 0) + face_voisins(face, 1) + 1;
226 mon_Ti(ii, jj) = mon_inco(elemi, 0) + mon_phi(ii, jj) / mon_h(ii);
227 }
228 }
229 }
230 }
231
232 numero_T_=0;
233 // put in the end: to make sure to update the *modified* h_imp_, phi_ext_, and Text
235 Ti_wall_->mettre_a_jour(temps);
236
237
238 // print Twall
239
240
241 const Schema_Temps_base& sch = mon_dom_cl_dis->equation().schema_temps();
242 double temps_courant = sch.temps_courant();
243 double temps_prec = sch.temps_precedent();
244 double dt= sch.pas_de_temps() ;
245
246
247 if (dt_impr_Tw_ != DMAXFLOAT)
248 {
249 bool is_imp = sch.temps_final_atteint () || sch.nb_pas_dt_max_atteint ();
250 is_imp = is_imp || (dt_impr_Tw_ <= dt);
251
252 if (!is_imp)
253 {
254 // Voir Schema_Temps_base::limpr pour information sur epsilon et modf
255 double i, j, epsilon = 1.e-8;
256 modf (temps_courant / dt_impr_Tw_ + epsilon, &i);
257 modf (temps_prec / dt_impr_Tw_ + epsilon, &j);
258 is_imp = ( i>j );
259 }
260
261 if (is_imp)
262 {
263
264 int ndeb = frontiere_dis ().frontiere ().num_premiere_face ();
265 int nfin = ndeb + frontiere_dis ().frontiere ().nb_faces ();
266
267
268 EcrFicPartage filTwall;
269 Nom nom_pb=mon_dom_cl_dis->equation().probleme().le_nom();
270 Nom fichier=Objet_U::nom_du_cas()+"_"+nom_pb+"_"+frontiere_dis ().frontiere ().le_nom()+"_"+"twall.face";
271
272 // On cree le fichier au premier pas de temps si il n'y a pas reprise
273 if ( est_egal(temps_prec, 0) && !pb_gen.reprise_effectuee())
274 {
275 filTwall.ouvrir(fichier);
276 }
277 // Sinon on l'ouvre
278 else
279 {
280 filTwall.ouvrir(fichier,ios::app);
281 }
282
283
284
285 if(je_suis_maitre())
286 {
287 filTwall << finl;
288 if (dimension == 2)
289 {
290 filTwall << "--------------------------------------------------------------------------------------------" << finl;
291 filTwall << "Time\t\t| X\t\t\t| Y\t\t\t| Twall" << finl;
292 filTwall << "--------------------------------------------------------------------------------------------" << finl;
293 }
294 }
295
296
297 for (int face = ndeb; face < nfin; face++)
298 {
299 filTwall << temps << "\t| " << le_dom.xv (face, 0) << "\t| " << le_dom.xv (face, 1) << "\t| " << Ti_wall (face - ndeb) << finl;
300 }
301 filTwall.syncfile ();
302 }
303 }
304
305}
306
307
309{
311
312 // configure T2_autre pb_
313 T2_autre_pb_.typer("Champ_front_calc");
314 Champ_front_calc& ch=ref_cast(Champ_front_calc, T2_autre_pb_.valeur());
315
317
319 ch.completer();
321 ch.fixer_nb_valeurs_temporelles(nb_cases);
322}
323
324
325
326/*! @brief Change le i-eme temps futur de la CL.
327 *
328 */
330{
332 T2_autre_pb_->changer_temps_futur(temps,i);
333}
334
335/*! @brief Tourne la roue de la CL
336 *
337 */
339{
341 ok = ok && T2_autre_pb_->avancer(temps);
342 return ok;
343}
344
345/*! @brief Tourne la roue de la CL
346 *
347 */
349{
351 ok = ok && T2_autre_pb_->reculer(temps);
352 return ok;
353}
354
356{
357
359 return 0;
360
361 Champ_front_calc& ch=ref_cast(Champ_front_calc, T2_autre_pb_.valeur());
362 return ch.initialiser(temps,domaine_Cl_dis().equation().inconnue());
363}
364
DoubleTab & valeurs() override
Returns the array of field values at the current time.
virtual void associer_fr_dis_base(const Frontiere_dis_base &)
Associates a discretized boundary with the field.
virtual DoubleTab & valeurs() override
Returns the array of field values.
virtual void completer()
class Champ_front_calc Derived class of Champ_front_var representing
const Frontiere_dis_base & front_dis() const
Returns the discretized boundary corresponding to the domain on which the trace is taken.
void creer(const Nom &, const Nom &, const Motcle &)
Create the Champ_front_calc object representing the trace of an unknown field on a boundary from name...
int initialiser(double, const Champ_Inc_base &) override
Initialization at the beginning of calculation.
const Domaine_Cl_dis_base & domaine_Cl_dis() const
Returns the domain of discretized boundary conditions carried by the equation carrying the unknown fi...
const Domaine_dis_base & domaine_dis() const override
Returns the discretized domain associated with the equation carrying the unknown field whose trace is...
const Milieu_base & milieu() const
Returns the medium associated with the equation carrying the unknown field whose trace is taken.
void fixer_nb_valeurs_temporelles(int nb_cases) override
Overrides Champ_front_base::fixer_nb_valeurs_temporelles.
class Cond_lim_base Base class for the hierarchy of classes that represent the different boundary con...
Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the domain of discretized boundary conditions to which the object belongs.
std::vector< Motcle > app_domains
virtual Frontiere_dis_base & frontiere_dis()
Returns the discretized boundary to which the boundary conditions apply.
class Domaine_Cl_VDF
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
const Cond_lim_base & condition_limite_de_la_frontiere(Nom frontiere) const
Returns the boundary condition associated with a boundary of the given name.
class Domaine_VF
Definition Domaine_VF.h:44
double xv(int num_face, int k) const
Definition Domaine_VF.h:76
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
Definition Domaine_VF.h:418
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
virtual IntTab & face_voisins()
: class Echange_contact_VDF_FT_Disc_solid
int reculer(double temps) override
Tourne la roue de la CL.
void mettre_a_jour(double) override
Performs a time update of the boundary condition.
void completer() override
DOES NOTHING must be overridden in derived classes.
void changer_temps_futur(double temps, int i) override
Change le i-eme temps futur de la CL.
int initialiser(double temps) override
Initialization at the beginning of the calculation.
int avancer(double temps) override
Tourne la roue de la CL.
: class Echange_contact_VDF_FT_Disc
virtual double Ti_wall(int num) const
int avancer(double temps) override
Tourne la roue de la CL.
void changer_temps_futur(double temps, int i) override
Change le i-eme temps futur de la CL.
int reculer(double temps) override
Tourne la roue de la CL.
void completer() override
DOES NOTHING must be overridden in derived classes.
int initialiser(double temps) override
Initialization at the beginning of the calculation.
void calculer_h_autre_pb(DoubleTab &tab, double invhparoi, int opt)
virtual void calculer_Teta_equiv(DoubleTab &Teta_equiv, const DoubleTab &mon_h, const DoubleTab &autre_h, int is_pb_fluide, double temps)
Fills Teta_eq using T_autre_pb at the time passed as parameter.
virtual void calculer_Teta_paroi(DoubleTab &tab_p, const DoubleTab &mon_h, const DoubleTab &autre_h, int is_pb_fluide, double temps)
Fills Teta_p using T_autre_pb at the time passed as parameter.
void calculer_h_mon_pb(DoubleTab &, double, int)
void mettre_a_jour(double temps) override
Performs a time update of the boundary condition.
Champ_front_base & phi_ext()
virtual Champ_front_base & T_ext()
Returns the T_ext field of temperature imposed at the boundary.
int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::out) override
Opens the file with the given mode and prot parameters. These parameters are the parameters of the st...
Sortie & syncfile() override
Triggers writing to disk of the data accumulated on the different processors since the last call to s...
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 Champ_Inc_base & inconnue() const =0
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
virtual void fixer_nb_comp(int i)
Sets the number of components of the field.
virtual int nb_comp() const
Definition Field_base.h:56
class Front_VF
Definition Front_VF.h:36
virtual void trace_elem_distant(const DoubleTab &, DoubleTab &) const
int_t num_premiere_face() const
Definition Frontiere.h:67
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Frontiere.h:49
virtual void trace_elem_local(const DoubleTab &, DoubleTab &) const
int_t nb_faces() const
Returns the number of faces of the boundary.
Definition Frontiere.h:59
const Frontiere & frontiere() const
Returns the associated geometric boundary.
static Objet_U & objet(const Nom &)
See Interprete_bloc::objet_global(). BM: the Interprete class is not the best place for this.
Milieu_base This class is the base of the (physical) medium hierarchy.
Definition Milieu_base.h:50
virtual const Champ_Don_base & conductivite() const
Returns the conductivity of the medium (const version).
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
const Nom & le_nom() const override
Returns *this.
Definition Nom.cpp:555
static int dimension
Definition Objet_U.h:94
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
static const Nom & nom_du_cas()
Returns a constant reference to the case name. This method is static.
Definition Objet_U.cpp:145
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
@ REQUIRED
Definition Param.h:115
const Triple_Line_Model_FT_Disc & tcl() const
class Probleme_base It is a Probleme_U that is not a coupling.
bool & reprise_effectuee()
static int je_suis_maitre()
Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
Definition Process.cpp:82
class Schema_Temps_base
double temps_courant() const
Returns the current time.
int nb_pas_dt_max_atteint() const
Returns 1 if (the number of time steps >= maximum number of time steps).
int temps_final_atteint() const
Returns 1 if the final time has been reached (or exceeded).
double pas_de_temps() const
Returns the current time step (delta_t).
virtual int nb_valeurs_temporelles() const =0
double temps_precedent() const
Returns the previous time.
Base class for output streams.
Definition Sortie.h:52
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
virtual void detach_vect()
Definition TRUSTVect.h:176