TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Modele_turbulence_hyd_base.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 <Modele_turbulence_hyd_base.h>
17#include <EcritureLectureSpecial.h>
18#include <Operateur_Diff_base.h>
19#include <Operateur_Conv_base.h>
20#include <Discretisation_base.h>
21#include <Schema_Temps_base.h>
22#include <communications.h>
23#include <LecFicDiffuse.h>
24#include <EcrFicPartage.h>
25#include <Postraitement.h>
26#include <Equation_base.h>
27#include <Probleme_base.h>
28#include <TRUST_2_PDI.h>
29#include <Operateur.h>
30#include <Domaine.h>
31#include <Param.h>
32#include <Debog.h>
33
34Implemente_base(Modele_turbulence_hyd_base, "Modele_turbulence_hyd_base", Objet_U);
35// XD modele_turbulence_hyd_deriv objet_lecture modele_turbulence_hyd_deriv INHERITS_BRACE Basic class for turbulence
36// XD_CONT model for Navier-Stokes equations.
37
38Sortie& Modele_turbulence_hyd_base::printOn(Sortie& s) const { return s << que_suis_je() << " " << le_nom(); }
39
40/*! @brief Reads the specifications of a turbulence model from an input stream.
41 *
42 * Format:
43 * Modele_turbulence type_modele
44 * {
45 * [Turbulence_paroi la_loi_de_paroi]
46 * reading block specific to the turbulence type
47 * }
48 *
49 * @param (Entree& is) an input stream
50 * @return (Entree&) the modified input stream
51 * @throws opening brace expected
52 * @throws wall law incompatible with the problem
53 */
55{
56 Cerr << "Reading of data for a " << que_suis_je() << " hydraulic turbulence model" << finl;
57 Param param(que_suis_je());
58 set_param(param);
59 param.lire_avec_accolades_depuis(is);
60 // Checks
61 // Case where Correction_visco_turb_pour_controle_pas_de_temps_parametre is read without Correction_visco_turb_pour_controle_pas_de_temps
62 if (dt_diff_sur_dt_conv_ != -1)
63 calcul_borne_locale_visco_turb_ = true;
64 // Case where Correction_visco_turb_pour_controle_pas_de_temps is set without Correction_visco_turb_pour_controle_pas_de_temps_parametre
65 else if (calcul_borne_locale_visco_turb_)
66 dt_diff_sur_dt_conv_ = 1;
67 // Case where Correction_visco_turb_pour_controle_pas_de_temps_parametre is incorrectly set
68 if (dt_diff_sur_dt_conv_ <= 0 && calcul_borne_locale_visco_turb_)
69 {
70 Cerr << "Parameter value Correction_visco_turb_pour_controle_pas_de_temps_parametre must be strictly positive." << finl;
71 exit();
72 }
73 return is;
74}
75
77{
78 param.ajouter_non_std("turbulence_paroi", (this), Param::REQUIRED); // XD attr turbulence_paroi turbulence_paroi_base turbulence_paroi OPT Keyword to set the wall law.
79 param.ajouter_non_std("dt_impr_ustar", (this)); // XD attr dt_impr_ustar floattant dt_impr_ustar OPT This keyword is used to print the values (U +, d+, u$\star$) obtained with the wall laws into a file named datafile_ProblemName_Ustar.face and periode refers to the printing period, this value is expressed in seconds.
80 param.ajouter_non_std("dt_impr_ustar_mean_only", (this)); // XD attr dt_impr_ustar_mean_only dt_impr_ustar_mean_only dt_impr_ustar_mean_only OPT This keyword is used to print the mean values of u* ( obtained with the wall laws) on each boundary, into a file named datafile_ProblemName_Ustar_mean_only.out. periode refers to the printing period, this value is expressed in seconds. If you don\'t use the optional keyword boundaries, all the boundaries will be considered. If you use it, you must specify nb_boundaries which is the number of boundaries on which you want to calculate the mean values of u*, then you have to specify their names.
81 param.ajouter("nut_max", &XNUTM_); // XD attr nut_max floattant nut_max OPT Upper
82 // XD_CONT limitation of turbulent viscosity (default value 1.e8).
83 param.ajouter_flag("Correction_visco_turb_pour_controle_pas_de_temps", &calcul_borne_locale_visco_turb_); // XD attr correction_visco_turb_pour_controle_pas_de_temps rien correction_visco_turb_pour_controle_pas_de_temps OPT Keyword to set a limitation to low time steps due to high values of turbulent viscosity. The limit for turbulent viscosity is calculated so that diffusive time-step is equal or higher than convective time-step. For a stationary flow, the correction for turbulent viscosity should apply only during the first time steps and not when permanent state is reached. To check that, we could post process the corr_visco_turb field which is the correction of turbulent viscosity: it should be 1. on the whole domain.
84 param.ajouter("Correction_visco_turb_pour_controle_pas_de_temps_parametre", &dt_diff_sur_dt_conv_); // XD attr correction_visco_turb_pour_controle_pas_de_temps_parametre floattant correction_visco_turb_pour_controle_pas_de_temps_parametre OPT Keyword to set a limitation to low time steps due to high values of turbulent viscosity. The limit for turbulent viscosity is the ratio between diffusive time-step and convective time-step is higher or equal to the given value [0-1]
85 //param.ajouter_condition("not(is_read_dt_impr_ustar_mean_only_and_is_read_dt_impr_ustar)","only one of dt_impr_ustar_mean_only and dt_impr_ustar can be used");
86}
87
89{
90 Motcle motlu;
91 int retval = 1;
92 if (mot == "turbulence_paroi")
93 {
95 is >> loipar_.valeur();
96 }
97 else if (mot == "dt_impr_ustar")
98 {
99 if (loipar_->que_suis_je().contient("negligeable"))
100 Process::exit("Please remove dt_impr_ustar option if the wall law is of Negligeable type.");
101 is >> dt_impr_ustar_;
102 }
103 else if (mot == "dt_impr_ustar_mean_only")
104 {
105 if (loipar_->que_suis_je().contient("negligeable"))
106 Process::exit("Please remove dt_impr_ustar option if the wall law is of Negligeable type.");
107 // XD dt_impr_ustar_mean_only objet_lecture nul BRACE not_set
108 // XD attr dt_impr floattant dt_impr REQ not_set
109 // XD attr boundaries listchaine boundaries OPT not_set
110 Nom accolade_ouverte = "{";
111 Nom accolade_fermee = "}";
112 nom_fichier_ = Objet_U::nom_du_cas() + "_" + equation().probleme().le_nom() + "_ustar_mean_only";
113 Domaine& dom = equation().probleme().domaine();
114 LIST(Nom) nlistbord_dom; //!< list storing all boundary names of the domain
115 int nbfr = dom.nb_front_Cl();
116 for (int b = 0; b < nbfr; b++)
117 {
118 Frontiere& org = dom.frontiere(b);
119 nlistbord_dom.add(org.le_nom());
120 }
121 is >> motlu;
122 if (motlu != accolade_ouverte)
123 {
124 Cerr << motlu << " is not a keyword understood by " << que_suis_je() << " in lire_motcle_non_standard" << finl;
125 Cerr << "A specification of kind : dt_impr_ustar_mean_only { dt_impr periode [boundaries nb_boundaries boundary_name1 boundary_name2 ... ] } was expected." << finl;
126 exit();
127 }
128 is >> motlu;
129 if (motlu != "dt_impr")
130 {
131 Cerr << "We expected dt_impr..." << finl;
132 exit();
133 }
135
136 is >> motlu; // boundaries, closing brace, or unknown token
137 if (motlu != accolade_fermee)
138 {
139 if (motlu == "boundaries")
140 {
141 boundaries_ = 1;
142 int nb_bords = 0;
143 Nom nom_bord_lu;
144
145 // read boundaries number
146 is >> nb_bords;
147 if (nb_bords != 0)
148 {
149 // read boundaries
150 for (int i = 0; i < nb_bords; i++)
151 {
152 is >> nom_bord_lu;
153 boundaries_list_.add(Nom(nom_bord_lu));
154 // check boundary name
155 if (!nlistbord_dom.contient(boundaries_list_[i]))
156 {
157 Cerr << "Problem in the dt_impr_ustar_mean_only instruction:" << finl;
158 Cerr << "The boundary named '" << boundaries_list_[i] << "' is not a boundary of the domain " << dom.le_nom() << "." << finl;
159 exit();
160 }
161 }
162 }
163 // read closing brace
164 is >> motlu;
165 if (motlu != accolade_fermee)
166 {
167 Cerr << "Problem in the dt_impr_ustar_mean_only instruction:" << finl;
168 Cerr << "TRUST wants to read a '" << accolade_fermee << "' but find '" << motlu << "'!!" << finl;
169 exit();
170 }
171 }
172 else
173 {
174 Cerr << motlu << " is not a keyword understood by " << que_suis_je() << " in lire_motcle_non_standard" << finl;
175 Cerr << "A specification of kind : dt_impr_ustar_mean_only { dt_impr periode [boundaries nb_boundaries boundary_name1 boundary_name2 ... ] } was expected." << finl;
176 exit();
177 }
178 }
179 } // end dt_impr_ustar_mean_only
180 else
181 retval = -1;
182
183 return retval;
184}
185
186/*! @brief Associates the equation passed as parameter to the turbulence model.
187 *
188 * @param eqn The equation to associate with this object.
189 */
191{
192 mon_equation_ = eqn;
193}
194
195/*! @brief Reads the domain Wall_length.xyz file to populate the wall_length field for distance_paroi post-processing.
196 *
197 */
199{
200 // PQ : 25/02/04 retrieval of the wall distance from Wall_length.xyz
201 DoubleTab& wall_length = wall_length_->valeurs();
202 wall_length = -1.;
203
204 LecFicDiffuse fic;
205 Nom nom_fic = equation().probleme().domaine().le_nom() + "_Wall_length.xyz";
206 fic.set_bin(1);
207 if (!fic.ouvrir(nom_fic))
208 {
209 Cerr << " File " << nom_fic << " doesn't exist. To generate it, please, refer to html.doc (Distance_paroi) " << finl;
210 exit();
211 }
212
213 Noms nom_paroi;
214
215 fic >> nom_paroi;
216
218
219}
220
221/*! @brief Discretizes the turbulence model.
222 *
223 */
225{
226 Cerr << "Turbulence hydraulic model discretization" << finl;
227 discretiser_visc_turb(mon_equation_->schema_temps(), mon_equation_->domaine_dis(), la_viscosite_turbulente_);
228 champs_compris_.ajoute_champ(la_viscosite_turbulente_);
229
230 discretiser_corr_visc_turb(mon_equation_->schema_temps(), mon_equation_->domaine_dis(), corr_visco_turb_);
231 champs_compris_.ajoute_champ(corr_visco_turb_);
232 const Discretisation_base& dis = ref_cast(Discretisation_base, mon_equation_->discretisation());
233 dis.discretiser_champ("champ_elem", mon_equation_->domaine_dis(), "distance_paroi", "m", 1, mon_equation_->schema_temps().temps_courant(), wall_length_);
234 champs_compris_.ajoute_champ(wall_length_);
235}
236
238{
239 int is_dilat = equation().probleme().is_dilatable();
240 if (!is_dilat)
241 Cerr << "Turbulent viscosity field discretization" << finl;
242 else
243 Cerr << "Turbulent dynamic viscosity field discretization" << finl;
244 Nom nom = (is_dilat == 1) ? "viscosite_dynamique_turbulente" : "viscosite_turbulente";
245 Nom unite = (is_dilat == 1) ? "kg/(m.s)" : "m2/s";
246 const Discretisation_base& dis = mon_equation_->discretisation();
247 dis.discretiser_champ("champ_elem", z, nom, unite, 1, sch.temps_courant(), ch);
248}
249
251{
252 Cerr << "Turbulent viscosity correction field discretization" << finl;
253 const Discretisation_base& dis = mon_equation_->discretisation();
254 dis.discretiser_champ("champ_elem", z, "corr_visco_turb", "adimensionnel", 1, sch.temps_courant(), ch);
255}
256
258{
259 Cerr << "Kinetic turbulent energy field discretisation" << finl;
260 const Discretisation_base& dis = mon_equation_->discretisation();
261 dis.discretiser_champ("champ_elem", z, "K", "m2/s2", 1, sch.temps_courant(), ch);
262}
263
264/*! @brief Prepares the computation.
265 *
266 * Initializes the wall law.
267 * Fills the wall_length field for distance_paroi post-processing.
268 *
269 * @return Return code from Turbulence_paroi::init_lois_paroi().
270 */
272{
273 int res = 1;
274 if (loipar_)
275 res = loipar_->init_lois_paroi();
276
277 bool contient_distance_paroi = false;
278
279 for (auto &itr : equation().probleme().postraitements())
280 if (!contient_distance_paroi)
281 if (sub_type(Postraitement, itr.valeur()))
282 {
283 Postraitement& post = ref_cast(Postraitement, itr.valeur());
284 for (int i = 0; i < post.noms_champs_a_post().size(); i++)
285 {
286 // The new global wall distance computation does not use the old method.
287 const Nom& chmp = post.noms_champs_a_post()[i];
288 if (!chmp.contient("DISTANCE_PAROI_GLOBALE") && chmp.contient("DISTANCE_PAROI"))
289 {
291 contient_distance_paroi = true;
292 break;
293 }
294 }
295 }
296 if (nom_fichier_!="")
297 loipar_->imprimer_premiere_ligne_ustar(boundaries_, boundaries_list_, nom_fichier_);
298 return res;
299}
300
302{
303 return true;
304}
305
307{
308 if (loipar_)
309 {
310 loipar_->creer_champ(motlu);
311 }
312}
313
314bool Modele_turbulence_hyd_base::has_champ(const Motcle& nom, OBS_PTR(Champ_base)& ref_champ) const
315{
316 if (champs_compris_.has_champ(nom, ref_champ))
317 return true;
318
319 if (loipar_)
320 if (loipar_->has_champ(nom, ref_champ))
321 return true;
322
323 return false; /* nothing found */
324}
325
327{
328 if (champs_compris_.has_champ(nom))
329 return true;
330
331 if (loipar_)
332 if (loipar_->has_champ(nom))
333 return true;
334
335 return false; /* nothing found */
336}
337
339{
340 OBS_PTR(Champ_base) ref_champ;
341
342 if (champs_compris_.has_champ(nom, ref_champ))
343 return ref_champ;
344
345 if (loipar_)
346 if (loipar_->has_champ(nom, ref_champ))
347 return ref_champ;
348
349 throw std::runtime_error(std::string("Field ") + nom.getString() + std::string(" not found !"));
350}
351
353{
354 if (opt == DESCRIPTION)
355 Cerr << que_suis_je() << " : " << champs_compris_.liste_noms_compris() << finl;
356 else
357 nom.add(champs_compris_.liste_noms_compris());
358
359 if (loipar_)
360 loipar_->get_noms_champs_postraitables(nom, opt);
361}
362
363/*! @brief Performs printing if necessary.
364 *
365 * @param os Output stream.
366 */
368{
369 const Schema_Temps_base& sch = mon_equation_->schema_temps();
370 double temps_courant = sch.temps_courant();
371 double dt = sch.pas_de_temps();
372 if (loipar_ && limpr_ustar(temps_courant, sch.temps_precedent(), dt, dt_impr_ustar_))
373 loipar_->imprimer_ustar(os);
374 if (loipar_ && limpr_ustar(temps_courant, sch.temps_precedent(), dt, dt_impr_ustar_mean_only_))
375 loipar_->imprimer_ustar_mean_only(os, boundaries_, boundaries_list_, nom_fichier_);
376}
377
378int Modele_turbulence_hyd_base::limpr_ustar(double temps_courant, double temps_prec, double dt, double dt_ustar) const
379{
380 const Schema_Temps_base& sch = mon_equation_->schema_temps();
381 if (sch.nb_pas_dt() == 0)
382 return 0;
383 if (dt_ustar <= dt
384 || ((sch.temps_cpu_max_atteint() || (!get_disable_stop() && sch.stop_lu()) || sch.temps_final_atteint() || sch.nb_pas_dt_max_atteint() || sch.nb_pas_dt() == 1 || sch.stationnaire_atteint())
385 && !est_egal(dt_ustar, 1.e20)))
386 return 1;
387 else
388 {
389 // See Schema_Temps_base::limpr for information on epsilon and modf
390 double i, j, epsilon = 1.e-8;
391 modf(temps_courant / dt_ustar + epsilon, &i);
392 modf(temps_prec / dt_ustar + epsilon, &j);
393 return (i > j);
394 }
395}
396
397
398/*! @brief for PDI IO: retrieve name, type and dimensions of the fields to save/restore
399 *
400 */
402{
403 std::vector<YAML_data> data;
404 if (loipar_)
405 {
406 data = loipar_->data_a_sauvegarder();
407 }
408 return data;
409}
410
411/*! @brief Saves the turbulence model to an output stream.
412 *
413 * Saves the object type.
414 *
415 * @param (Sortie& os) an output stream
416 * @return (int) always returns 1
417 */
419{
420 a_faire(os);
421 if (loipar_)
422 {
423 loipar_->sauvegarder(os);
424 }
425 else if(!TRUST_2_PDI::is_PDI_checkpoint()) // OC: for low Re, we write negligeable — no issue doing this here
426 {
427 const Discretisation_base& discr = mon_equation_->discretisation();
428 Nom nom_discr = discr.que_suis_je();
429 Nom type = "negligeable_";
430 type += nom_discr.substr_old(1, 3);
431 os << type << finl;
432 }
433 // Verify that Modele_turbulence_hyd_base::limiter_viscosite_turbulente() was indeed called
434 assert(mp_sum(borne_visco_turb_.size()) != 0);
435 return 0;
436}
437/*! @brief Restores the wall law from a checkpoint.
438 *
439 * @param (Entree&) an input stream
440 * @return (int) always returns 0
441 */
443{
444 if (loipar_)
445 loipar_->reprendre(is);
446 return 0;
447}
448
449/*! @brief Writes an identity record to the output stream if required.
450 *
451 */
453{
454 int afaire, special;
456
457 if (afaire)
458 {
459 Nom mon_ident(que_suis_je());
460 mon_ident += equation().probleme().domaine().le_nom();
461 double temps = equation().inconnue().temps();
462 mon_ident += Nom(temps, "%e");
463 os << mon_ident << finl;
464 os << que_suis_je() << finl;
465 os.flush();
466 }
467}
468
470{
471 // Initialise
472 int size = viscosite_turbulente().valeurs().size();
473 if (borne_visco_turb_.size() == 0)
474 borne_visco_turb_ = la_viscosite_turbulente_->valeurs();
475 borne_visco_turb_ = XNUTM_;
476 if (calcul_borne_locale_visco_turb_ && (equation().schema_temps().nb_pas_dt() != 0 || equation().probleme().reprise_effectuee()))
477 {
478 // Recompute the turbulent viscosity bounds after the first time step
479 const Operateur_Diff_base& op_diff = ref_cast(Operateur_Diff_base, equation().operateur(0).l_op_base());
480 const Operateur_Conv_base& op_conv = ref_cast(Operateur_Conv_base, equation().operateur(1).l_op_base());
481 op_diff.calculer_borne_locale(borne_visco_turb_, op_conv.dt_stab_conv(), dt_diff_sur_dt_conv_);
482 }
483 // Apply the turbulent viscosity bound
484 int nb_elem = equation().domaine_dis().domaine().nb_elem();
485 assert(nb_elem == size);
486 int compt = 0;
487 Debog::verifier("Modele_turbulence_hyd_base::limiter_viscosite_turbulente la_viscosite_turbulente before", la_viscosite_turbulente_->valeurs());
488
489 CDoubleArrView borne_visco_turb = borne_visco_turb_.view_ro();
490 DoubleArrView corr_visco_turb = static_cast<DoubleVect&>(corr_visco_turb_->valeurs()).view_wo();
491 DoubleArrView visco_turb = static_cast<DoubleVect&>(la_viscosite_turbulente_->valeurs()).view_rw();
492 // Fill the work arrays:
493 Kokkos::parallel_reduce(start_gpu_timer(__KERNEL_NAME__),
494 Kokkos::RangePolicy<>(0, nb_elem), KOKKOS_LAMBDA(
495 const int elem, int& compt_)
496 {
497 if (visco_turb(elem) > borne_visco_turb(elem))
498 {
499 compt_++;
500 corr_visco_turb(elem) = borne_visco_turb(elem) / visco_turb(elem);
501 visco_turb(elem) = borne_visco_turb(elem);
502 }
503 else
504 corr_visco_turb(elem) = 1.;
505 }, Kokkos::Sum<int>(compt));
506 end_gpu_timer(__KERNEL_NAME__);
507 corr_visco_turb_->changer_temps(mon_equation_->inconnue().temps());
508 la_viscosite_turbulente_->valeurs().echange_espace_virtuel();
509 Debog::verifier("Modele_turbulence_hyd_base::limiter_viscosite_turbulente la_viscosite_turbulente after", la_viscosite_turbulente_->valeurs());
510
511 // Print if required
512 int imprimer_compt = 0;
513 if (mon_equation_->schema_temps().temps_impr() <= mon_equation_->schema_temps().pas_de_temps())
514 imprimer_compt = 1;
515 else
516 {
517 if (mon_equation_->schema_temps().nb_pas_dt() == 0)
518 imprimer_compt = 0;
519 else
520 {
521 // See Schema_Temps_base::limpr for information on epsilon and modf
522 double i, j, epsilon = 1.e-8;
523 modf(mon_equation_->schema_temps().temps_courant() / mon_equation_->schema_temps().temps_impr() + epsilon, &i);
524 modf((mon_equation_->schema_temps().temps_courant() - mon_equation_->schema_temps().pas_de_temps()) / mon_equation_->schema_temps().temps_impr() + epsilon, &j);
525 if (i > j)
526 imprimer_compt = 1;
527 }
528 }
529 if (imprimer_compt)
530 {
531 // PL: optimization to avoid 2 mp_sum instead 1:
532 ArrOfTID tmp(2);
533 tmp[0] = compt;
534 tmp[1] = size;
536 /* compt=mp_sum(compt);
537 size=mp_sum(size); */
538 double pourcent = 100.0 * (double(tmp[0]) / double(tmp[1]));
539 if (je_suis_maitre() && pourcent > 0)
540 Cout << "\nTurbulent viscosity has been limited on " << pourcent << " % of cells mesh." << finl;
541 }
542}
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
double temps() const
Returns the time of the field.
bool has_champ(const Motcle &nom, OBS_PTR(FIELD_TYPE)&ref_champ) const
static void verifier(const char *const msg, double)
Definition Debog.cpp:21
class Discretisation_base This class represents a spatial discretization scheme, which
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 nb_front_Cl() const
Definition Domaine.h:236
const Frontiere_t & frontiere(int i) const
Definition Domaine.h:539
int_t nb_elem() const
Definition Domaine.h:131
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
const Domaine & domaine() const
static int is_ecriture_special(int &special, int &a_faire)
Indicates whether the special format was requested in active writing by xyz save.
static void lecture_special(Champ_base &ch, Entree &fich)
Simple call to EcritureLectureSpecial::lecture_special (const Domaine_VF& zvf,Entree& fich,...
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
Probleme_base & probleme()
Returns the problem associated with the equation.
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
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
void add(const Frontiere_32_64 &)
Adds the vertices (and faces) of the given boundary to this object (Frontiere_32_64).
This class implements the operators and virtual methods of the EFichier class as follows: The file to...
int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::in) override
Opens the file.
void set_bin(bool bin) override
Calls get_entree_master().
Base class for the turbulence model hierarchy for Navier-Stokes equations.
OBS_PTR(Equation_base) mon_equation_
int limpr_ustar(double, double, double, double) const
LIST(Nom) boundaries_list_
virtual std::vector< YAML_data > data_a_sauvegarder() const
for PDI IO: retrieve name, type and dimensions of the fields to save/restore
void associer_eqn(const Equation_base &)
Associates the equation passed as parameter to the turbulence model.
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
OWN_PTR(Champ_Fonc_base) la_viscosite_turbulente_
virtual int preparer_calcul()
Prepares the computation.
void discretiser_visc_turb(const Schema_Temps_base &, Domaine_dis_base &, OWN_PTR(Champ_Fonc_base)&) const
virtual void set_param(Param &param) const override
void discretiser_K(const Schema_Temps_base &, Domaine_dis_base &, OWN_PTR(Champ_Fonc_base)&) const
int reprendre(Entree &) override
Restores the wall law from a checkpoint.
void discretiser_corr_visc_turb(const Schema_Temps_base &, Domaine_dis_base &, OWN_PTR(Champ_Fonc_base)&) const
int sauvegarder(Sortie &) const override
Saves the turbulence model to an output stream.
const Champ_Fonc_base & viscosite_turbulente() const
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
void creer_champ(const Motcle &motlu) override
void lire_distance_paroi()
Reads the domain Wall_length.xyz file to populate the wall_length field for distance_paroi post-proce...
Equation_base & equation()
Returns the equation associated with the turbulence model.
virtual void discretiser()
Discretizes the turbulence model.
void a_faire(Sortie &) const
Writes an identity record to the output stream if required.
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
virtual void imprimer(Sortie &) const
Performs printing if necessary.
const Champ_base & get_champ(const Motcle &nom) const override
A character string (Nom) in uppercase.
Definition Motcle.h:26
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
Nom substr_old(const int, const int) const
Returns a name using the usual substr command. NOTE: deb = 1 means the first character of the string.
Definition Nom.cpp:466
bool contient(const Nom &nom) const
Definition Nom.h:86
const std::string & getString() const
Definition Nom.h:92
An array of character strings (VECT(Nom)).
Definition Noms.h:26
Base class for TRUST objects (Objet_U).
Definition Objet_U.h:68
friend class Entree
Definition Objet_U.h:71
friend class Sortie
Definition Objet_U.h:70
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 const Nom & le_nom() const
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Objet_U.cpp:317
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
Operateur_Conv_base This class is the base of the hierarchy of operators representing.
double dt_stab_conv() const
Operateur_Diff_base This class is the base of the hierarchy of operators representing.
virtual void calculer_borne_locale(DoubleVect &, double, double) const
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(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
@ REQUIRED
Definition Param.h:115
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
class Postraitement. The class holds -a list of generic fields champs_post_complet_ containing
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Probleme_U.h:109
bool is_dilatable() const
const Domaine & domaine() const
Returns the domain associated with the problem.
static void mp_sum_for_each_item(TRUSTArray< _TYPE_ > &x, int n=-1)
Definition Process.cpp:194
static double mp_sum(double)
Computes the sum of x over all processors in the current group.
Definition Process.cpp:145
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
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).
int nb_pas_dt() const
Returns the number of time steps performed.
int stop_lu() const
Returns 1 if the .stop file contains a 1, returns 0 otherwise.
int stationnaire_atteint() const
int temps_cpu_max_atteint() const
double temps_precedent() const
Returns the previous time.
Base class for output streams.
Definition Sortie.h:52
virtual Sortie & flush()
Definition Sortie.cpp:138
_SIZE_ size() const
Definition TRUSTVect.tpp:45
static int is_PDI_checkpoint()
static void typer_lire_turbulence_paroi(OWN_PTR(Turbulence_paroi_base)&, const Modele_turbulence_hyd_base &, Entree &)
Reads the characteristics of the wall law from an input stream.