TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
VDF_discretisation.cpp
1/****************************************************************************
2* Copyright (c) 2026, 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 <VDF_discretisation.h>
17#include <Rotationnel_Champ_Face.h>
18#include <grad_U_Champ_Face.h>
19#include <Correlation_Vec_Sca_VDF.h>
20#include <Champ_Fonc_Tabule.h>
21#include <Champ_Fonc_Tabule_P0_VDF.h>
22#include <Critere_Q_Champ_Face.h>
23#include <Fluide_Ostwald.h>
24#include <Champ_Ostwald_VDF.h>
25#include <Champ_Uniforme.h>
26#include <Y_plus_Champ_Face.h>
27#include <Reynolds_maille_Champ_Face.h>
28#include <Courant_maille_Champ_Face.h>
29#include <Taux_cisaillement_P0_VDF.h>
30#include <Postraitement_base.h>
31#include <Schema_Temps_base.h>
32#include <Domaine_Cl_VDF.h>
33#include <Navier_Stokes_std.h>
34#include <Domaine_VDF.h>
35#include <Probleme_base.h>
36#include <Champ_P0_VDF.h>
37#include <T_paroi_Champ_P0_VDF.h>
38
39Implemente_instanciable(VDF_discretisation, "VDF", Discret_Thyd);
40// XD vdf discretisation_base vdf INHERITS_BRACE Finite difference volume discretization.
41
43{
44 return Discret_Thyd::readOn(s);
45}
46
47Sortie& VDF_discretisation::printOn(Sortie& s) const { return s; }
48
49/*! @brief Discretisation d'un OWN_PTR(Champ_Inc_base) pour le VDF en fonction d'une directive de discretisation.
50 *
51 * La directive est un Motcle comme "vitesse", "pression",
52 * "temperature", "champ_elem" (cree un champ de type P0 ...), ...
53 * Cette methode determine le type du champ a creer en fonction du type d'element
54 * et de la directive de discretisation. Elle determine ensuite le nombre de ddl
55 * et fixe l'ensemble des parametres du champ (type, nb_compo, nb_ddl, nb_pas_dt,
56 * nom(s), unite(s), nature du champ et attribue un temps) et associe le Domaine_dis au champ.
57 * Voir le code pour avoir la correspondance entre les directives et
58 * le type de champ cree.
59 *
60 */
61void VDF_discretisation::discretiser_champ(const Motcle& directive, const Domaine_dis_base& z, Nature_du_champ nature, const Noms& noms, const Noms& unites, int nb_comp, int nb_pas_dt, double temps,
62 OWN_PTR(Champ_Inc_base) &champ, const Nom& sous_type) const
63{
64 const Domaine_VDF& domaine_vdf = ref_cast(Domaine_VDF, z);
65
66 Motcles motcles(7);
67 motcles[0] = "vitesse"; // Choix standard pour la vitesse
68 motcles[1] = "pression"; // Choix standard pour la pression
69 motcles[2] = "temperature"; // Choix standard pour la temperature
70 motcles[3] = "divergence_vitesse"; // Le type de champ obtenu en calculant div v
71 motcles[4] = "gradient_pression"; // Le type de champ obtenu en calculant grad P
72 motcles[5] = "champ_face"; // Creer un champ aux faces
73 motcles[6] = "champ_elem"; // Creer un champ aux elements (de type P0)
74
75 Nom type;
76 int default_nb_comp = -1;
77 int rang = motcles.search(directive);
78 switch(rang)
79 {
80 case 0:
81 type = "Champ_Face_VDF";
82 default_nb_comp = dimension;
83 break;
84 case 1:
85 type = "Champ_P0_VDF";
86 default_nb_comp = 1;
87 break;
88 case 2:
89 type = "Champ_P0_VDF";
90 default_nb_comp = 1;
91 break;
92 case 3:
93 type = "Champ_P0_VDF";
94 default_nb_comp = 1;
95 break;
96 case 4:
97 type = "Champ_Face_VDF";
98 default_nb_comp = dimension;
99 break;
100 case 5:
101 type = "Champ_Face_VDF";
102 default_nb_comp = 1;
103 break;
104 case 6:
105 type = "Champ_P0_VDF";
106 default_nb_comp = 1;
107 break;
108 default:
109 assert(rang < 0);
110 break;
111 }
112
113 if (directive == DEMANDE_DESCRIPTION)
114 Cerr << "VDF_discretisation : " << motcles;
115
116 if (sous_type != NOM_VIDE)
117 rang = verifie_sous_type(type, sous_type, directive);
118
119 // Si on n'a pas compris la directive (ou si c'est une demande_description)
120 // alors on appelle l'ancetre :
121 if (rang < 0)
122 {
123 Discret_Thyd::discretiser_champ(directive, z, nature, noms, unites, nb_comp, nb_pas_dt, temps, champ);
124 return;
125 }
126
127 // Calcul du nombre de ddl
128 int nb_ddl = 0;
129 if (type.debute_par("Champ_P0_VDF"))
130 nb_ddl = z.nb_elem();
131 else if (type.debute_par("Champ_Face"))
132 nb_ddl = domaine_vdf.nb_faces();
133 else
134 assert(0);
135
136 if (nb_comp < 0)
137 nb_comp = default_nb_comp;
138 assert(nb_comp > 0);
139 creer_champ(champ, z, type, noms[0], unites[0], nb_comp, nb_ddl, nb_pas_dt, temps, directive, que_suis_je());
140
141 if (nature == multi_scalaire)
142 {
143 champ->fixer_nature_du_champ(nature);
144 champ->fixer_unites(unites);
145 champ->fixer_noms_compo(noms);
146 }
147
148}
149
150/*! @brief Idem que VDF_discretisation::discretiser_champ(.
151 *
152 * .. , Champ_Inc) pour un Champ_Fonc.
153 *
154 */
155void VDF_discretisation::discretiser_champ(const Motcle& directive, const Domaine_dis_base& z, Nature_du_champ nature, const Noms& noms, const Noms& unites, int nb_comp, double temps,
156 OWN_PTR(Champ_Fonc_base) &champ) const
157{
158 discretiser_champ_fonc_don(directive, z, nature, noms, unites, nb_comp, temps, champ);
159}
160
161/*! @brief Idem que VDF_discretisation::discretiser_champ(.
162 *
163 * .. , Champ_Inc) pour un Champ_Don.
164 *
165 */
166void VDF_discretisation::discretiser_champ(const Motcle& directive, const Domaine_dis_base& z, Nature_du_champ nature, const Noms& noms, const Noms& unites, int nb_comp, double temps,
167 OWN_PTR(Champ_Don_base)& champ) const
168{
169 discretiser_champ_fonc_don(directive, z, nature, noms, unites, nb_comp, temps, champ);
170}
171
172/*! @brief Idem que VEF_discretisation::discretiser_champ(.
173 *
174 * .. , Champ_Inc) Traitement commun aux champ_fonc et champ_don.
175 * Cette methode est privee (passage d'un Objet_U pas propre vu
176 * de l'exterieur ...)
177 *
178 */
179void VDF_discretisation::discretiser_champ_fonc_don(const Motcle& directive, const Domaine_dis_base& z, Nature_du_champ nature, const Noms& noms, const Noms& unites, int nb_comp, double temps,
180 Objet_U& champ) const
181{
182 // Deux pointeurs pour acceder facilement au champ_don ou au champ_fonc, suivant le type de l'objet champ.
183 OWN_PTR(Champ_Fonc_base) *champ_fonc = dynamic_cast<OWN_PTR(Champ_Fonc_base)*>(&champ);
184 OWN_PTR(Champ_Don_base) *champ_don = dynamic_cast<OWN_PTR(Champ_Don_base)*>(&champ);
185
186 Motcles motcles(8);
187 motcles[0] = "pression";
188 motcles[1] = "temperature";
189 motcles[2] = "divergence_vitesse"; // Le type de champ obtenu en calculant div v
190 motcles[3] = "champ_elem"; // Creer un champ aux elements (de type P0)
191 motcles[4] = "vitesse"; // Creer un champ comme la vitesse
192 motcles[5] = "gradient_pression"; // Le type de champ obtenu en calculant grad P
193 motcles[6] = "champ_face"; // Creer un champ aux faces
194 motcles[7] = "champ_sommets"; // Creer un champ aux sommets
195
196 Nom type;
197 int rang = motcles.search(directive);
198 int default_nb_comp = 1;
199 switch(rang)
200 {
201 case 0:
202 type = "Champ_Fonc_P0_VDF";
203 break;
204 case 1:
205 type = "Champ_Fonc_P0_VDF";
206 break;
207 case 2:
208 type = "Champ_Fonc_P0_VDF";
209 break;
210 case 3:
211 type = "Champ_Fonc_P0_VDF";
212 break;
213 case 4:
214 type = "Champ_Fonc_Face_VDF";
215 default_nb_comp = dimension;
216 break;
217 case 5:
218 type = "Champ_Fonc_Face_VDF";
219 default_nb_comp = dimension;
220 break;
221 case 6:
222 type = "Champ_Fonc_Face_VDF";
223 default_nb_comp = 1;
224 break;
225 case 7:
226 type = "Champ_Fonc_Q1_VDF";
227 default_nb_comp = 1;
228 break;
229
230 default:
231 assert(rang < 0);
232 break;
233 }
234
235 if (directive == DEMANDE_DESCRIPTION)
236 Cerr << "VDF_discretisation : " << motcles;
237
238 // Si on n'a pas compris la directive (ou si c'est une demande_description)
239 // alors on appelle l'ancetre :
240 if (rang < 0)
241 {
242 if (champ_fonc)
243 Discret_Thyd::discretiser_champ(directive, z, nature, noms, unites, nb_comp, temps, *champ_fonc);
244 else
245 Discret_Thyd::discretiser_champ(directive, z, nature, noms, unites, nb_comp, temps, *champ_don);
246 return;
247 }
248
249 // Calcul du nombre de ddl
250 int nb_ddl = 0;
251 const Domaine_VDF& domaine_vdf = ref_cast(Domaine_VDF, z);
252 if (type == "Champ_Fonc_P0_VDF")
253 nb_ddl = z.nb_elem();
254 else if (type == "Champ_Fonc_Face_VDF")
255 nb_ddl = domaine_vdf.nb_faces();
256 else if (type == "Champ_Fonc_Q1_VDF")
257 nb_ddl = domaine_vdf.nb_som();
258 else
259 assert(0);
260
261 if (nb_comp < 0)
262 nb_comp = default_nb_comp; // Nombre de composantes par defaut
263 if (champ_fonc)
264 creer_champ(*champ_fonc, z, type, noms[0], unites[0], nb_comp, nb_ddl, temps, directive, que_suis_je());
265 else
266 creer_champ(*champ_don, z, type, noms[0], unites[0], nb_comp, nb_ddl, temps, directive, que_suis_je());
267
268 if ((nature == multi_scalaire) && (champ_fonc))
269 {
270 champ_fonc->valeur().fixer_nature_du_champ(nature);
271 champ_fonc->valeur().fixer_unites(unites);
272 champ_fonc->valeur().fixer_noms_compo(noms);
273 }
274 else if ((nature == multi_scalaire) && (champ_don))
275 {
276 Cerr << "There is no field of type OWN_PTR(Champ_Don_base) with a multi_scalaire nature." << finl;
277 exit();
278 }
279}
280
282 OWN_PTR(Champ_Fonc_base) &ch) const
283{
284 const Champ_Face_VDF& vit = ref_cast(Champ_Face_VDF, ch_vitesse);
285 const Domaine_VDF& domaine_vdf = ref_cast(Domaine_VDF, z);
286 ch.typer("Rotationnel_Champ_Face");
287 Rotationnel_Champ_Face& ch_W = ref_cast(Rotationnel_Champ_Face, ch.valeur());
288 ch_W.associer_domaine_dis_base(domaine_vdf);
289 ch_W.associer_champ(vit);
290 ch_W.nommer("vorticite");
291 if (dimension == 2)
292 ch_W.fixer_nb_comp(1);
293 else
294 {
296 ch_W.fixer_nom_compo(0, "vorticiteX");
297 ch_W.fixer_nom_compo(1, "vorticiteY");
298 ch_W.fixer_nom_compo(2, "vorticiteZ");
299 }
300 ch_W.fixer_nb_valeurs_nodales(domaine_vdf.nb_elem());
301 ch_W.fixer_unite("s-1");
302 ch_W.changer_temps(ch_vitesse.temps());
303}
304
305void VDF_discretisation::critere_Q(const Domaine_dis_base& z, const Domaine_Cl_dis_base& zcl, const Champ_Inc_base& ch_vitesse, OWN_PTR(Champ_Fonc_base) &ch) const
306{
307 const Champ_Face_VDF& vit = ref_cast(Champ_Face_VDF, ch_vitesse);
308 const Domaine_VDF& domaine_vdf = ref_cast(Domaine_VDF, z);
309 const Domaine_Cl_VDF& domaine_cl_vdf = ref_cast(Domaine_Cl_VDF, zcl);
310 ch.typer("Critere_Q_Champ_Face");
311 Critere_Q_Champ_Face& ch_Criter_Q = ref_cast(Critere_Q_Champ_Face, ch.valeur());
312 ch_Criter_Q.associer_domaine_dis_base(domaine_vdf);
313 ch_Criter_Q.associer_domaine_Cl_dis_base(domaine_cl_vdf);
314 ch_Criter_Q.associer_champ(vit);
315 ch_Criter_Q.nommer("Critere_Q");
316 ch_Criter_Q.fixer_nb_comp(1);
317 ch_Criter_Q.fixer_nb_valeurs_nodales(domaine_vdf.nb_elem());
318 ch_Criter_Q.fixer_unite("s-2");
319 ch_Criter_Q.changer_temps(ch_vitesse.temps());
320}
321
322void VDF_discretisation::grad_u(const Domaine_dis_base& z, const Domaine_Cl_dis_base& zcl, const Champ_Inc_base& ch_vitesse, OWN_PTR(Champ_Fonc_base) &ch) const
323{
324 const Champ_Face_VDF& vit = ref_cast(Champ_Face_VDF, ch_vitesse);
325 const Domaine_VDF& domaine_vdf = ref_cast(Domaine_VDF, z);
326 const Domaine_Cl_VDF& domaine_cl_vdf = ref_cast(Domaine_Cl_VDF, zcl);
327 const int N = ch_vitesse.valeurs().line_size();
328 ch.typer("grad_U_Champ_Face");
329 grad_U_Champ_Face& ch_grad_u = ref_cast(grad_U_Champ_Face, ch.valeur());
330 ch_grad_u.associer_domaine_dis_base(domaine_vdf);
331 ch_grad_u.associer_domaine_Cl_dis_base(domaine_cl_vdf);
332 ch_grad_u.associer_champ(vit);
333 ch_grad_u.nommer("gradient_vitesse");
334 ch_grad_u.fixer_nb_comp(dimension * dimension * N);
335
336 for (int n = 0; n < N; n++)
337 if (dimension == 2)
338 {
339 ch_grad_u.fixer_nom_compo(N * 0 + n, "dUdX"); // du/dx
340 ch_grad_u.fixer_nom_compo(N * 1 + n, "dUdY"); // du/dy
341 ch_grad_u.fixer_nom_compo(N * 2 + n, "dVdX"); // dv/dx
342 ch_grad_u.fixer_nom_compo(N * 3 + n, "dVdY"); // dv/dy
343 }
344 else
345 {
346 ch_grad_u.fixer_nom_compo(N * 0 + n, "dUdX"); // du/dx
347 ch_grad_u.fixer_nom_compo(N * 1 + n, "dUdY"); // du/dy
348 ch_grad_u.fixer_nom_compo(N * 2 + n, "dUdZ"); // du/dz
349 ch_grad_u.fixer_nom_compo(N * 3 + n, "dVdX"); // dv/dx
350 ch_grad_u.fixer_nom_compo(N * 4 + n, "dVdY"); // dv/dy
351 ch_grad_u.fixer_nom_compo(N * 5 + n, "dVdZ"); // dv/dz
352 ch_grad_u.fixer_nom_compo(N * 6 + n, "dWdX"); // dw/dx
353 ch_grad_u.fixer_nom_compo(N * 7 + n, "dWdY"); // dw/dy
354 ch_grad_u.fixer_nom_compo(N * 8 + n, "dWdZ"); // dw/dz
355 }
356 ch_grad_u.fixer_nature_du_champ(vectoriel);
357 ch_grad_u.fixer_nb_valeurs_nodales(domaine_vdf.nb_elem());
358 ch_grad_u.fixer_unite("s-1");
359 ch_grad_u.changer_temps(ch_vitesse.temps());
360}
361
362void VDF_discretisation::reynolds_maille(const Domaine_dis_base& z, const Fluide_base& le_fluide, const Champ_Inc_base& ch_vitesse, OWN_PTR(Champ_Fonc_base) &champ) const
363{
364 const Domaine_VDF& domaine_vdf = ref_cast(Domaine_VDF, z);
365 champ.typer("Reynolds_maille_Champ_Face");
366 Reynolds_maille_Champ_Face& ch = ref_cast(Reynolds_maille_Champ_Face, champ.valeur());
367 ch.associer_domaine_dis_base(domaine_vdf);
368 const Champ_Face_VDF& vit = ref_cast(Champ_Face_VDF, ch_vitesse);
369 const Champ_Don_base& nu = le_fluide.viscosite_cinematique();
370 ch.associer_champ(vit, nu);
371 ch.nommer("Reynolds_maille");
373 ch.fixer_nom_compo(0, "Reynolds_maille_X");
374 ch.fixer_nom_compo(1, "Reynolds_maille_Y");
375 if (dimension == 3)
376 ch.fixer_nom_compo(2, "Reynolds_maille_Z");
377 ch.fixer_nb_valeurs_nodales(domaine_vdf.nb_faces());
378 ch.fixer_unite("adimensionnel");
379 ch.changer_temps(ch_vitesse.temps());
380}
381
382void VDF_discretisation::courant_maille(const Domaine_dis_base& z, const Schema_Temps_base& sch, const Champ_Inc_base& ch_vitesse, OWN_PTR(Champ_Fonc_base) &champ) const
383{
384 const Domaine_VDF& domaine_vdf = ref_cast(Domaine_VDF, z);
385 champ.typer("Courant_maille_Champ_Face");
386 Courant_maille_Champ_Face& ch = ref_cast(Courant_maille_Champ_Face, champ.valeur());
387 ch.associer_domaine_dis_base(domaine_vdf);
388 const Champ_Face_VDF& vit = ref_cast(Champ_Face_VDF, ch_vitesse);
389 ch.associer_champ(vit, sch);
390 ch.nommer("Courant_maille");
392 ch.fixer_nom_compo(0, "Courant_maille_X");
393 ch.fixer_nom_compo(1, "Courant_maille_Y");
394 if (dimension == 3)
395 ch.fixer_nom_compo(2, "Courant_maille_Z");
396 ch.fixer_nb_valeurs_nodales(domaine_vdf.nb_faces());
397 ch.fixer_unite("adimensionnel");
398 ch.changer_temps(ch_vitesse.temps());
399}
400
401void VDF_discretisation::taux_cisaillement(const Domaine_dis_base& z, const Domaine_Cl_dis_base& zcl, const Champ_Inc_base& ch_vitesse, OWN_PTR(Champ_Fonc_base) &champ) const
402{
403 const Domaine_VDF& domaine_vdf = ref_cast(Domaine_VDF, z);
404 const Domaine_Cl_VDF& domaine_cl_vdf = ref_cast(Domaine_Cl_VDF, zcl);
405 champ.typer("Taux_cisaillement_P0_VDF");
406 Taux_cisaillement_P0_VDF& ch = ref_cast(Taux_cisaillement_P0_VDF, champ.valeur());
407 ch.associer_domaine_dis_base(domaine_vdf);
408 const Champ_Face_VDF& vit = ref_cast(Champ_Face_VDF, ch_vitesse);
409 ch.associer_champ(vit, domaine_cl_vdf);
410 ch.nommer("Taux_cisaillement");
411 int N = vit.valeurs().line_size();
412 ch.fixer_nb_comp(N);
413 for (int n = 0; n < N; n++)
414 {
415 Nom phase = Nom(n);
416 ch.fixer_nom_compo(n, Nom("Taux_cisaillement_") + phase);
417 }
418 ch.fixer_nb_valeurs_nodales(domaine_vdf.nb_elem());
419 ch.fixer_unite("s-1");
420 ch.changer_temps(ch_vitesse.temps());
421}
422
423void VDF_discretisation::y_plus(const Domaine_dis_base& z, const Domaine_Cl_dis_base& zcl, const Champ_Inc_base& ch_vitesse, OWN_PTR(Champ_Fonc_base) &ch) const
424{
425 const Champ_Face_VDF& vit = ref_cast(Champ_Face_VDF, ch_vitesse);
426 const Domaine_VDF& domaine_vdf = ref_cast(Domaine_VDF, z);
427 const Domaine_Cl_VDF& domaine_cl_vdf = ref_cast(Domaine_Cl_VDF, zcl);
428 if (domaine_cl_vdf.equation().probleme().que_suis_je().debute_par("Pb_Multiphase"))
429 {
430 Cerr << "Discretisation de y plus" << finl; // Utilise comme modele distance paroi globale
431 Noms noms(1), unites(1);
432 noms[0] = Nom("Y_plus");
433 unites[0] = Nom("adimensionnel");
434 discretiser_champ(Motcle("champ_elem"), z, scalaire, noms, unites, 1, 0, ch);
435 DoubleTab& tab_y_p = ch->valeurs();
436 for (int i = 0; i < tab_y_p.dimension_tot(0); i++)
437 for (int n = 0; n < tab_y_p.dimension_tot(1); n++)
438 tab_y_p(i, n) = -1.;
439 }
440 else
441 {
442 ch.typer("Y_plus_Champ_Face");
443 Y_plus_Champ_Face& ch_y_plus = ref_cast(Y_plus_Champ_Face, ch.valeur());
444 ch_y_plus.associer_domaine_dis_base(domaine_vdf);
445 ch_y_plus.associer_domaine_Cl_dis_base(domaine_cl_vdf);
446 ch_y_plus.associer_champ(vit);
447 ch_y_plus.nommer("Y_plus");
448 ch_y_plus.fixer_nb_comp(1);
449 ch_y_plus.fixer_nb_valeurs_nodales(domaine_vdf.nb_elem());
450 ch_y_plus.fixer_unite("adimensionnel");
451 ch_y_plus.changer_temps(ch_vitesse.temps());
452 }
453}
454
455void VDF_discretisation::t_paroi(const Domaine_dis_base& z,const Domaine_Cl_dis_base& zcl, const Champ_Inc_base& ch_temp, OWN_PTR(Champ_Fonc_base)& ch) const
456{
457 Cerr << "Discretisation de temperature_paroi" << finl;
458 const Champ_P0_VDF& temp = ref_cast(Champ_P0_VDF, ch_temp);
459 const Domaine_VDF& domaine_vdf = ref_cast(Domaine_VDF, z);
460 const Domaine_Cl_VDF& domaine_cl_vdf = ref_cast(Domaine_Cl_VDF, zcl);
461 ch.typer("T_paroi_Champ_P0_VDF");
462 T_paroi_Champ_P0_VDF& ch_tp = ref_cast(T_paroi_Champ_P0_VDF, ch.valeur());
463 ch_tp.associer_domaine_dis_base(domaine_vdf);
464 ch_tp.associer_domaine_Cl_dis_base(domaine_cl_vdf);
465 ch_tp.associer_champ(temp);
466 ch_tp.nommer("temperature_paroi");
467 ch_tp.add_synonymous("wall_temperature");
468 ch_tp.fixer_nb_comp(ch_temp.valeurs().line_size()); // pour multiphase ...
469 ch_tp.fixer_nb_valeurs_nodales(domaine_vdf.nb_elem());
470 ch_tp.fixer_unite("K-C");
471 ch_tp.changer_temps(ch_temp.temps());
472}
473
474void VDF_discretisation::modifier_champ_tabule(const Domaine_dis_base& domaine_dis, Champ_Fonc_Tabule& le_champ_tabule, const VECT(OBS_PTR(Champ_base)) &ch_inc) const
475{
476 le_champ_tabule.typer_champ_tabule_discretise("Champ_Fonc_Tabule_P0_VDF");
477 Champ_Fonc_Tabule_P0_VDF& le_champ_tabule_dis = ref_cast(Champ_Fonc_Tabule_P0_VDF, le_champ_tabule.le_champ_tabule_discretise());
478 le_champ_tabule_dis.associer_domaine_dis_base(domaine_dis);
479 le_champ_tabule_dis.associer_param(ch_inc, le_champ_tabule.table());
480 le_champ_tabule_dis.nommer(le_champ_tabule.le_nom()); // We give a name to this field, help for debug
481 le_champ_tabule_dis.fixer_nb_comp(le_champ_tabule.nb_comp());
482 le_champ_tabule_dis.fixer_nb_valeurs_nodales(domaine_dis.nb_elem());
483 le_champ_tabule_dis.changer_temps(ch_inc[0]->temps());
484}
485
486/*! @brief discretise en VDF le fluide incompressible, donc K e N
487 *
488 * @param (Domaine_dis_base&) domaine a discretiser
489 * @param (Fluide_Ostwald&) fluide a discretiser
490 * @param (Champ_Inc_base&) vitesse
491 * @param (Champ_Inc_base&) temperature
492 */
494{
495 Cerr << "Discretisation du fluide_Ostwald" << finl;
496 const Domaine_VDF& domaine_vdf = ref_cast(Domaine_VDF, z);
497 const Champ_Inc_base& ch_vitesse = eqn_hydr.inconnue();
498 const Champ_Face_VDF& vit = ref_cast(Champ_Face_VDF, ch_vitesse);
499
500 Champ_Don_base& mu = le_fluide.viscosite_dynamique();
501 // mu est toujours un champ_Ostwald_VDF , il faut toujours faire ce qui suit
502 Champ_Ostwald_VDF& ch_mu = ref_cast(Champ_Ostwald_VDF, mu);
503 Cerr << "associe domainedisbase" << finl;
504 ch_mu.associer_domaine_dis_base(domaine_vdf);
505 ch_mu.associer_fluide(le_fluide);
506 ch_mu.associer_champ(vit);
507 Cerr << "associations finies" << finl;
508 ch_mu.fixer_nb_comp(1);
509
510 Cerr << "fait fixer_nb_valeurs_nodales" << finl;
511 Cerr << "nb_valeurs_nodales = " << domaine_vdf.nb_elem() << finl;
512 ch_mu.fixer_nb_valeurs_nodales(domaine_vdf.nb_elem());
513
514 Cerr << "fait changer_temps" << finl;
515 ch_mu.changer_temps(vit.temps());
516
517 Cerr << "mu est discretise " << finl;
518}
519
521 OWN_PTR(Champ_Fonc_base) &ch) const
522{
523 if (sub_type(Champ_Face_VDF, ch_vitesse))
524 {
525 const Champ_Face_VDF& vit = ref_cast(Champ_Face_VDF, ch_vitesse);
526 const Domaine_VDF& domaine_VDF = ref_cast(Domaine_VDF, vit.domaine_dis_base());
527 int N = ch_vitesse.valeurs().line_size();
528 ch.typer("Rotationnel_Champ_Face");
529 Rotationnel_Champ_Face& ch_W = ref_cast(Rotationnel_Champ_Face, ch.valeur());
530 ch_W.associer_domaine_dis_base(domaine_VDF);
531 ch_W.associer_champ(vit);
532 ch_W.nommer("vorticite");
533 if (dimension == 2)
534 ch_W.fixer_nb_comp(N);
535 else
536 for (int n = 0; n < N; n++)
537 {
538 ch_W.fixer_nb_comp(dimension * N);
539 ch_W.fixer_nom_compo(N * 0 + n, "vorticiteX");
540 ch_W.fixer_nom_compo(N * 1 + n, "vorticiteY");
541 ch_W.fixer_nom_compo(N * 2 + n, "vorticiteZ");
542 }
543 ch_W.fixer_nb_valeurs_nodales(domaine_VDF.nb_elem());
544 ch_W.fixer_unite("s-1");
545 ch_W.changer_temps(sch.temps_courant());
546 }
547}
548
549void VDF_discretisation::residu(const Domaine_dis_base& z, const Champ_Inc_base& ch_inco, OWN_PTR(Champ_Fonc_base) &champ) const
550{
551 Nom ch_name(ch_inco.le_nom());
552 ch_name += "_residu";
553 Cerr << "Discretization of " << ch_name << finl;
554
555 const Domaine_VDF& domaine_vdf = ref_cast(Domaine_VDF, z);
556
557 Motcle loc;
558 int nb_comp;
559 Nom type_ch = ch_inco.que_suis_je();
560 if (type_ch.debute_par("Champ_Face"))
561 {
562 loc = "champ_face";
563 nb_comp = dimension * ch_inco.valeurs().line_size();
564 }
565 else
566 {
567 loc = "champ_elem";
568 nb_comp = ch_inco.valeurs().line_size();
569 }
570
571 Discretisation_base::discretiser_champ(loc, domaine_vdf, ch_name, "units_not_defined", nb_comp, ch_inco.temps(), champ);
572 Champ_Fonc_base& ch_fonc = ref_cast(Champ_Fonc_base, champ.valeur());
573 DoubleTab& tab = ch_fonc.valeurs();
574 tab = -10000.0;
575 Cerr << "[Information] Discretisation_base::residu : the residue is set to -10000.0 at initial time" << finl;
576}
577
579{
580 Cerr << "Discretisation de distance paroi globale" << finl;
581 Noms noms(1), unites(1);
582 noms[0] = Nom("distance_paroi_globale");
583 unites[0] = Nom("m");
584 discretiser_champ(Motcle("champ_elem"), z, scalaire, noms, unites, 1, 0, ch);
585}
classe Champ_Don_base classe de base des Champs donnes (non calcules)
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
class Champ_Face_VDF Cette classe sert a representer un champ vectoriel dont on ne calcule
int fixer_nb_valeurs_nodales(int) override
Fixe le nombre de degres de liberte par composante.
int fixer_nb_valeurs_nodales(int n) override
Fixe le nombre de degres de liberte par composante.
void associer_param(const VECT(OBS_PTR(Champ_base))&, const Table &)
Classe Champ_Fonc_Tabule Classe derivee de Champ_Fonc_base qui represente les.
const Table & table() const
void typer_champ_tabule_discretise(const Nom &typ)
const Champ_Fonc_base & le_champ_tabule_discretise() const
Renvoie le champ tabule calcule.
classe Champ_Fonc_base Classe de base des champs qui sont fonction d'une grandeur calculee
void associer_domaine_dis_base(const Domaine_dis_base &) override
Classe Champ_Inc_base.
const Domaine_dis_base & domaine_dis_base() const override
DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ au temps courant.
classe Champ_Ostwald_VDF Represente un champ en discretisation VDF qui varie en fonction
void associer_champ(const Champ_Face_VDF &un_champ)
void associer_fluide(const Fluide_Ostwald &le_fluide)
int fixer_nb_valeurs_nodales(int nb_noeuds) override
Fixe le nombre de degres de liberte par composante.
classe Champ_P0_VDF Classe qui represente un champ discret P0 par element associe a un domaine discre...
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
virtual double changer_temps(const double t)
Fixe le temps auquel se situe le champ.
double temps() const
Renvoie le temps du champ.
void associer_champ(const Champ_Face_VDF &, const Schema_Temps_base &)
classe Critere_Q_Champ_Face
void associer_domaine_Cl_dis_base(const Domaine_Cl_dis_base &le_dom_Cl_dis_base)
void associer_champ(const Champ_Face_VDF &)
classe Discret_Thyd Cette classe est la classe de base representant une discretisation
static void creer_champ(OWN_PTR(Champ_Inc_base)&ch, const Domaine_dis_base &z, const Nom &type, const Nom &nom, const Nom &unite, int nb_comp, int nb_ddl, int nb_pas_dt, double temps, const Nom &directive=NOM_VIDE, const Nom &nom_discretisation=NOM_VIDE)
Methode statique qui cree un OWN_PTR(Champ_Inc_base) du type specifie.
static const Nom NOM_VIDE
static const Motcle DEMANDE_DESCRIPTION
void discretiser_champ(const Motcle &directive, const Domaine_dis_base &z, const Nom &nom, const Nom &unite, int nb_comp, int nb_pas_dt, double temps, OWN_PTR(Champ_Inc_base)&champ, const Nom &sous_type=NOM_VIDE) const
int verifie_sous_type(Nom &type, const Nom &sous_type, const Motcle &directive) const
class Domaine_Cl_VDF
classe Domaine_Cl_dis_base Les objets Domaine_Cl_dis_base representent les conditions aux limites
class Domaine_VDF
Definition Domaine_VDF.h:64
int nb_faces() const
renvoie le nombre global de faces.
Definition Domaine_VF.h:471
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Probleme_base & probleme()
Renvoie le probleme associe a l'equation.
virtual void fixer_nb_comp(int i)
Fixe le nombre de composantes du champ.
const Nom & le_nom() const override
Renvoie le nom du champ.
void nommer(const Nom &) override
Donne un nom au champ.
virtual const Nom & fixer_unite(const Nom &)
Specifie l'unite d'un champ scalaire ou dont toutes les composantes ont la meme unite.
virtual Nature_du_champ fixer_nature_du_champ(Nature_du_champ nat)
Fixer la nature d'un champ: scalaire, multiscalaire, vectoriel.
virtual int nb_comp() const
Definition Field_base.h:56
virtual void add_synonymous(const Nom &nom)
Definition Field_base.h:53
virtual const Nom & fixer_nom_compo(int, const Nom &)
Fixe le nom de la i-eme composante du champ.
class Fluide_Ostwald
classe Fluide_base Cette classe represente un d'un fluide incompressible ainsi que
Definition Fluide_base.h:38
const Champ_Don_base & viscosite_dynamique() const
Definition Fluide_base.h:60
const Champ_Don_base & viscosite_cinematique() const
Definition Fluide_base.h:58
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
Un tableau d'objets de la classe Motcle.
Definition Motcle.h:63
int search(const Motcle &t) const
Definition Motcle.cpp:321
classe Navier_Stokes_std Cette classe porte les termes de l'equation de la dynamique
const Champ_Inc_base & inconnue() const override
Renvoie la vitesse (champ inconnue de l'equation) (version const).
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
virtual int debute_par(const char *const n) const
Definition Nom.cpp:319
Un tableau de chaine de caracteres (VECT(Nom)).
Definition Noms.h:26
classe Objet_U Cette classe est la classe de base des Objets de TRUST
Definition Objet_U.h:73
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
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
void associer_champ(const Champ_Face_VDF &, const Champ_Don_base &)
classe Rotationnel_Champ_Face
void associer_champ(const Champ_Face_VDF &)
class Schema_Temps_base
double temps_courant() const
Renvoie le temps courant.
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160
int line_size() const
Definition TRUSTVect.tpp:67
void associer_champ(const Champ_P0_VDF &)
void associer_domaine_Cl_dis_base(const Domaine_Cl_dis_base &le_dom_Cl_dis_base)
classe Taux_cisaillement_P0_VDF
void associer_champ(const Champ_Face_VDF &, const Domaine_Cl_dis_base &)
void vorticite(Domaine_dis_base &, const Champ_Inc_base &, OWN_PTR(Champ_Fonc_base)&) const
void discretiser_champ(const Motcle &directive, const Domaine_dis_base &z, Nature_du_champ nature, const Noms &nom, const Noms &unite, int nb_comp, int nb_pas_dt, double temps, OWN_PTR(Champ_Inc_base) &champ, const Nom &sous_type=NOM_VIDE) const override
Discretisation d'un OWN_PTR(Champ_Inc_base) pour le VDF en fonction d'une directive de discretisation...
void residu(const Domaine_dis_base &, const Champ_Inc_base &, OWN_PTR(Champ_Fonc_base)&) const override
void grad_u(const Domaine_dis_base &, const Domaine_Cl_dis_base &, const Champ_Inc_base &, OWN_PTR(Champ_Fonc_base)&) const override
void t_paroi(const Domaine_dis_base &z, const Domaine_Cl_dis_base &zcl, const Champ_Inc_base &, OWN_PTR(Champ_Fonc_base)&ch) const override
void taux_cisaillement(const Domaine_dis_base &, const Domaine_Cl_dis_base &, const Champ_Inc_base &, OWN_PTR(Champ_Fonc_base)&) const override
void proprietes_physiques_fluide_Ostwald(const Domaine_dis_base &, Fluide_Ostwald &, const Navier_Stokes_std &, const Champ_Inc_base &) const override
discretise en VDF le fluide incompressible, donc K e N
void y_plus(const Domaine_dis_base &, const Domaine_Cl_dis_base &, const Champ_Inc_base &, OWN_PTR(Champ_Fonc_base)&) const override
void distance_paroi_globale(const Schema_Temps_base &, Domaine_dis_base &, OWN_PTR(Champ_Fonc_base)&) const override
void reynolds_maille(const Domaine_dis_base &, const Fluide_base &, const Champ_Inc_base &, OWN_PTR(Champ_Fonc_base)&) const override
void critere_Q(const Domaine_dis_base &, const Domaine_Cl_dis_base &, const Champ_Inc_base &, OWN_PTR(Champ_Fonc_base)&) const override
void courant_maille(const Domaine_dis_base &, const Schema_Temps_base &, const Champ_Inc_base &, OWN_PTR(Champ_Fonc_base)&) const override
void creer_champ_vorticite(const Schema_Temps_base &, const Champ_Inc_base &, OWN_PTR(Champ_Fonc_base)&) const override
classe Y_plus_Champ_Face
void associer_domaine_Cl_dis_base(const Domaine_Cl_dis_base &le_dom_Cl_dis_base)
void associer_champ(const Champ_Face_VDF &)
classe grad_U_Champ_Face
void associer_domaine_Cl_dis_base(const Domaine_Cl_dis_base &le_dom_Cl_dis_base)
void associer_champ(const Champ_Face_VDF &)