TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Probleme_FTD_IJK_base.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 <Navier_Stokes_FTD_IJK_tools.h>
17#include <Schema_Euler_explicite_IJK.h>
18#include <IJK_Navier_Stokes_tools.h>
19#include <Statistiques_dns_ijk_FT.h>
20#include <EcritureLectureSpecial.h>
21#include <Probleme_FTD_IJK_tools.h>
22#include <Probleme_FTD_IJK_base.h>
23#include <Navier_Stokes_FTD_IJK.h>
24#include <Postprocessing_IJK.h>
25#include <IJK_discretisation.h>
26#include <LecFicDiffuse_JDD.h>
27#include <IJK_Field_vector.h>
28#include <init_forcage_THI.h>
29#include <IJK_Lata_writer.h>
30#include <Interprete_bloc.h>
31#include <MaillerParallel.h>
32#include <corrections_qdm.h>
33#include <communications.h>
34#include <Ouvrir_fichier.h>
35#include <Schema_RK3_IJK.h>
36#include <Init_spectral.h>
37#include <Probleme_base.h>
38#include <Domaine_IJK.h>
39#include <Option_IJK.h>
40#include <Domaine_VF.h>
41#include <Type_info.h>
42#include <Sonde_IJK.h>
43#include <EFichier.h>
44#include <SFichier.h>
45#include <Force_sp.h>
46#include <Force_ph.h>
47#include <Vecteur3.h>
48#include <EChaine.h>
49#include <SChaine.h>
50#include <Param.h>
51
52Implemente_base(Probleme_FTD_IJK_base, "Probleme_FTD_IJK_base", Probleme_FT_Disc_gen);
53// XD probleme_ftd_ijk Pb_FrontTracking_Disc probleme_ftd_ijk INHERITS_BRACE not_set
54// XD attr Fluide_Diphasique_IJK Fluide_Diphasique_IJK Fluide_Diphasique_IJK OPT The diphasic fluid medium associated
55// XD_CONT with the problem.
56// XD ref scheme schema_temps_base_IJK
57// XD ref Domaine_IJK Domaine_IJK
58
60{
61 return os << " " << que_suis_je() << finl;
62}
63
65{
66 if (Objet_U::dimension != 3)
67 Process::exit("Probleme_FTD_IJK_base currently available in 3D !\n");
68
69 Cerr << "Reading of the problem " << le_nom() << finl;
70
71 Motcle motlu;
72 is >> motlu;
73 if (motlu != "{")
74 {
75 Cerr << "We expected { to start to read the problem" << finl;
77 }
78
79 /* 1 : solved_equations + milieu : NEW SYNTAX */
81 Cerr << "Probleme_FTD_IJK_base::readOn => We expect to read " << (int)equations_.size() << " equations." << finl;
82
84
85 /* 2 : On lit les equations */
86 for (auto& itr : equations_)
87 {
88 Cerr << "Probleme_FTD_IJK_base::readOn => Will read equation of type : " << itr->que_suis_je() << " ..." << finl;
89 is >> motlu;
90 is >> getset_equation_by_name(motlu);
91 itr->associer_milieu_base(milieu_ijk());
92 }
93
94 /* 3 : Tous les params encore non ranges proprement - a changer plus tard */
95 Param param(que_suis_je());
96 nom_sauvegarde_ = nom_du_cas() + ".sauv";
97 set_param(param);
98 param.lire_avec_accolades(is);
99
100 /* 4 : Les postraitements */
102 is >> motlu; // Read next word
103 // Si le postraitement comprend le mot, on en lit un autre...
104 while (les_postraitements_.lire_postraitements(is, motlu, *this))
105 is >> motlu;
106
107 completer();
108
109 if (motlu != "}")
110 {
111 Cerr << "We expected } to start to read the problem" << finl;
113 }
114 return is;
115}
116
118{
119 param.ajouter("nom_sauvegarde", &nom_sauvegarde_); // XD_ADD_P chaine
120 // XD_CONT Definition of filename to save the calculation
121 param.ajouter_flag("sauvegarder_xyz", &sauvegarder_xyz_); // XD_ADD_P rien
122 // XD_CONT save in xyz format
123 param.ajouter("nom_reprise", &nom_reprise_); // XD_ADD_P chaine
124 // XD_CONT Enable restart from filename given
125}
126
128{
129 if (sub_type(Domaine_IJK, obj))
130 {
131 domaine_ijk_ = ref_cast(Domaine_IJK, obj);
132 return 1;
133 }
134 else
136}
137
139{
140 /* Step 1 : special FT : read the list of equations to solve ... */
141 // Here are all possible equations !!!
142 Noms noms_eq, noms_eq_maj;
143 Type_info::les_sous_types(Nom("Equation_base"), noms_eq);
144 for (auto &itr : noms_eq) noms_eq_maj.add(Motcle(itr)); //ha ha ha
145
146 Motcle read_mc;
147 Nom nom_eq;
148 is >> read_mc;
149
150 if (read_mc != "SOLVED_EQUATIONS")
151 {
152 Cerr << "Error in Probleme_FTD_IJK_base::lire_solved_equations !!! We expected reading the SOLVED_EQUATIONS bloc instead of " << read_mc << " !!!" << finl;
153 Cerr << "Fix your data file !!!" << finl;
155 }
156
157 is >> read_mc;
158 if (read_mc != "{")
159 {
160 Cerr << "Error in Probleme_FTD_IJK_base::lire_solved_equations !!! We expected { instead of " << read_mc << " !!!" << finl;
161 Cerr << "Fix your data file !!!" << finl;
163 }
164
165 std::vector<Nom> eq_types, eq_name;
166
167 for (is >> read_mc; read_mc != "}"; is >> read_mc)
168 {
169 const bool non_accepted_eqs = (!read_mc.contient("_FTD_IJK") && (read_mc != "IJK_INTERFACES") && (read_mc != "IJK_THERMALS") );
170
171 if (noms_eq_maj.rang(read_mc) == -1 || non_accepted_eqs)
172 {
173 Cerr << "Error in Probleme_FTD_IJK_base::lire_solved_equations !!! The equation " << read_mc << " could not be used with a problem of type " << que_suis_je() << " !!!" << finl;
174 Cerr << "You can only use the following equations :" << finl;
175 for (auto &itr : noms_eq_maj)
176 if (itr.contient("_FTD_IJK") || itr == "IJK_INTERFACES" || itr == "IJK_THERMALS")
177 Cerr << " - " << itr << finl;
179 }
180
181 eq_types.push_back(read_mc);
182 is >> nom_eq;
183 eq_name.push_back(nom_eq);
184 }
185
186 if (eq_types.size() != eq_name.size())
187 {
188 Cerr << "Error in Probleme_FTD_IJK_base::lire_solved_equations !!! The number of strings read in the bloc SOLVED_EQUATIONS is not correct !!!" << finl;
189 Cerr << "Fix your data file !!!" << finl;
191 }
192
193 /* Step 2 : add equations to the list ... */
194 /* Add Navier_Stokes_FTD_IJK at first */
195 for (int i = 0; i < static_cast<int>(eq_types.size()); i++)
196 if (eq_types[i] == "NAVIER_STOKES_FTD_IJK")
197 {
198 has_ns_ = true;
199 add_FT_equation(eq_name[i], eq_types[i]);
200 }
201
202 /* Add Transport_Interfaces at second */
203 for (int i = 0; i < static_cast<int>(eq_types.size()); i++)
204 if (eq_types[i] == "IJK_INTERFACES")
205 {
206 has_interface_ = true;
207 add_FT_equation(eq_name[i], eq_types[i]);
208 }
209
210 /* Add thermals */
211 for (int i = 0; i < static_cast<int>(eq_types.size()); i++)
212 if (eq_types[i] == "IJK_THERMALS")
213 {
214 has_thermals_ = true;
215 add_FT_equation(eq_name[i], eq_types[i]);
216 }
217}
218
220{
221 const int nb_milieu = 1;
222 le_milieu_.resize(nb_milieu);
223
224 for (int i = 0; i < nb_milieu; i++)
225 is >> le_milieu_[i]; // On commence par la lecture du milieu
226}
227
229{
230 // Preparer le fichier de postraitement
232 if (fichier_post_ != "??")
234
235 lata_name_ += Nom(".lata");
236
237 // FIXME
238 Navier_Stokes_FTD_IJK& ns = ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur());
239 if (has_interface_)
241// ns.associer_domaine_ft(domaine_ft_);
242
243 milieu_ijk().calculate_direction_gravite(); // pour rotation
244
246
247 for (auto& itr : equations_)
248 itr->completer();
249
250 les_postraitements_.completer();
251
253
254 if (nom_reprise_ != "??")
256
258
259 // Register domains for post processing object
260 get_post().associer_domaines(domaine_ijk_.valeur(), domaine_ft_);
261}
262
264{
265 // TODO : FIXME : loop on all IJK equations later
266 const Navier_Stokes_FTD_IJK& ns = ref_cast(Navier_Stokes_FTD_IJK, equations_[0].valeur());
267 Noms nams;
268
269 ns.get_noms_champs_postraitables(nams, opt);
270 for (const auto &n: nams) noms.add(n);
271 nams.reset();
272
274 {
276 for (const auto &n: nams) noms.add(n);
277 nams.reset();
278 }
279
280 if (has_thermals_)
281 {
283 for (const auto &n: nams) noms.add(n);
284 nams.reset();
285 }
286
288 for (const auto &n: nams) noms.add(n);
289 nams.reset();
290}
291
293{
294 // TODO : FIXME : loop on all IJK equations later
295 const Navier_Stokes_FTD_IJK& ns = ref_cast(Navier_Stokes_FTD_IJK, equations_[0].valeur());
296 bool has = ns.has_champ(nom);
297
299 has = has || get_interface().has_champ(nom);
300
301 if (has_thermals_)
302 has = has || get_ijk_thermals().has_champ(nom);
303
304 has = has || get_post().has_champ(nom);
305 return has;
306}
307
309{
310 // TODO : FIXME : loop on all IJK equations later
311 const Navier_Stokes_FTD_IJK& ns = ref_cast(Navier_Stokes_FTD_IJK, equations_[0].valeur());
312 bool has = ns.has_champ_vectoriel(nom);
313
315 has = has || get_interface().has_champ_vectoriel(nom);
316
317 if (has_thermals_)
318 has = has || get_ijk_thermals().has_champ_vectoriel(nom);
319
320 has = has || get_post().has_champ_vectoriel(nom);
321 return has;
322}
323
324const IJK_Field_double& Probleme_FTD_IJK_base::get_IJK_field(const Motcle& nom)
325{
326 // TODO : FIXME : loop on all IJK equations later
327 Navier_Stokes_FTD_IJK& ns = ref_cast(Navier_Stokes_FTD_IJK, equations_[0].valeur());
328
329 if (ns.has_champ(nom))
330 return ns.get_IJK_field(nom);
331
333 return get_interface().get_IJK_field(nom);
334
336 return get_ijk_thermals().get_IJK_field(nom);
337
338 return get_post().get_IJK_field(nom);
339}
340
341const IJK_Field_vector3_double& Probleme_FTD_IJK_base::get_IJK_field_vector(const Motcle& nom)
342{
343 // TODO : FIXME : faut boucler plus tard sur les equations IJK
344 Navier_Stokes_FTD_IJK& ns = ref_cast(Navier_Stokes_FTD_IJK, equations_[0].valeur());
345
346 if (ns.has_champ_vectoriel(nom))
347 return ns.get_IJK_field_vector(nom);
348
351
354
355 return get_post().get_IJK_field_vector(nom);
356}
357
358
359void Probleme_FTD_IJK_base::sauvegarder_probleme(const char *fichier_sauvegarde, const int& stop) // const
360{
361 statistics().begin_count(STD_COUNTERS::backup_file, statistics().get_last_opened_counter_level()+1);
362
363 const double current_time = schema_temps_ijk().get_current_time();
364
365 // TODO : FIXME : faut boucler plus tard sur les equations IJK
366 const Navier_Stokes_FTD_IJK& ns = ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur());
367 const auto& velocity = ns.get_velocity();
368
369 Nom lata_name(fichier_sauvegarde);
370 Nom interf_name = lata_name + ".interfaces";
371 lata_name += ".lata";
372 dumplata_header(lata_name, velocity[0] /* on passe un champ pour ecrire la geometrie */);
373 dumplata_newtime(lata_name, current_time);
374 dumplata_vector(lata_name, "VELOCITY", velocity[0], velocity[1], velocity[2], 0);
375
376 get_post().sauvegarder_post(lata_name);
377
379 {
380 Nom xyz_name(fichier_sauvegarde);
381 xyz_name += ".xyz";
382 // Nom xyz_name_ascii = xyz_name + "_ascii";
383 dumpxyz_vector(*this, velocity, xyz_name, true);
384 // dumpxyz_vector(velocity_, xyz_name_ascii, false);
385 }
387 get_interface().sauvegarder_interfaces(lata_name, interf_name);
388
389 if (has_thermals_)
390 get_ijk_thermals().sauvegarder_temperature(lata_name, stop);
391
392 dumplata_finish(lata_name);
393
394 // curseur = thermique_; // RAZ : Remise au depart du curseur. GB -> Anida : Ne marche pas sur une liste vide? Je dois grader le curseur_bis ensuite.
395 SFichier fichier;
397 {
398 fichier.ouvrir(fichier_sauvegarde);
399 Cerr << "T= " << current_time << " Checkpointing dans le fichier " << fichier_sauvegarde << finl;
400 fichier.precision(17);
401 fichier.setf(std::ios_base::scientific);
402
403// Param param(que_suis_je());
404// param.ajouter("tinit", &current_time_);
405// param.ajouter("terme_acceleration_init", &terme_source_acceleration_);
406// // param.ajouter("force_init", &force_init_);
407// param.ajouter("fichier_reprise_vitesse", &fichier_reprise_vitesse_);
408// param.ajouter("timestep_reprise_vitesse", &timestep_reprise_vitesse_);
409// // param.ajouter("timestep_reprise_rho", &timestep_reprise_rho_);
410// param.ajouter("interfaces", & interfaces_);
411// param.ajouter("statistiques", &statistiques_);
412// param.ajouter("statistiques_FT", &statistiques_FT_);
413// param.ajouter("groups_statistiques_FT", &groups_statistiques_FT_);
414// // S'il y a plusieurs groups, on s'occupe des objets stats pour chaque group:
415// // (en ecrivant directement le vecteur d'objets)
416// param.print(fichier);
417 fichier << "{\n";
418 if (schema_temps_ijk().get_use_tstep_init())
419 fichier << " tstep_init " << (schema_temps_ijk().get_tstep() + schema_temps_ijk().get_tstep_init() + 1) << "\n";
420
421 ns.sauvegarder_equation(lata_name, fichier);
422
423 /*
424 * Thermals problems
425 */
426 //thermals_.sauvegarder_thermals(fichier);
427
428 get_post().sauvegarder_post_maitre(lata_name, fichier);
429 fichier << "}\n" ;
430 Cerr << "T= " << current_time << " Checkpointing dans le fichier l.1168 " << fichier_sauvegarde << finl;
431 }
432 statistics().end_count(STD_COUNTERS::backup_file);
433
434}
435
436
437// TODO teo boutin: les mot clé ajoutés ici ne devraient pas être conditionnels à la présence du mot clé nom_reprise
438// quelle solution pour faire une dépendance entre mot clé propre ??
439void Probleme_FTD_IJK_base::reprendre_probleme(const char *fichier_reprise)
440{
441 // Lecture par tous les processeurs, on retire les commentaires etc...
442 LecFicDiffuse_JDD fichier(fichier_reprise);
443
444 // TODO : FIXME : faut boucler plus tard sur les equations IJK
445 Navier_Stokes_FTD_IJK& ns = ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur());
446 IJK_Interfaces& interf = get_interface();
447
448 Param param(que_suis_je());
449 ns.set_param_reprise_pb(param);
452 interf.set_param_reprise_pb(param);
453
454 get_post().reprendre_post(param);
455
456 param.lire_avec_accolades(fichier);
457
458 // Appeler ensuite initialize() pour lire les fichiers lata etc...
459 Cerr << "Reprise des donnees a t=" << schema_temps_ijk().get_current_time() << "\n" << finl;
460
463
464 reprise_ = true;
465
466 Nom prefix = dirname(fichier_reprise);
467
469 interf.set_fichier_reprise_interface(prefix);
470
471 if (has_thermals_)
472 get_ijk_thermals().set_fichier_reprise(prefix + get_ijk_thermals().get_fichier_reprise());
473
475}
476
477// C'est ici aussi qu'on alloue les champs de temperature.
479{
480 Cerr << que_suis_je() << "::initialise_ijk_fields()" << finl;
481
482// TODO : FIXME : faut boucler plus tard sur les equations IJK
483 Navier_Stokes_FTD_IJK& eq_ns = ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur());
484 IJK_Interfaces& interf = get_interface();
485 eq_ns.initialise_ijk_fields();
486
487 // L'indicatrice non-perturbee est remplie (si besoin, cad si post-traitement) par le post.complete()
488 // get_post().fill_indic(reprise_);
489
490 /*
491 * Thermal problems
492 */
494
495 int ghost_fluid_flag = 0;
496 if (has_thermals_)
497 {
498 IJK_Thermals& thermals = get_ijk_thermals();
499 thermals.initialize(domaine_ijk_.valeur());
500 thermals.get_rising_velocities_parameters(eq_ns.get_compute_rising_velocities(), eq_ns.get_fill_rising_velocities(), eq_ns.get_use_bubbles_velocities_from_interface(),
501 eq_ns.get_use_bubbles_velocities_from_barycentres());
502
503 ghost_fluid_flag = thermals.ghost_fluid_flag();
504 }
505
506
507 interf.allocate_ijk_compo_connex_fields(domaine_ijk_.valeur(), ghost_fluid_flag || eq_ns.get_upstream_velocity_measured());
508 interf.associate_rising_velocities_parameters(domaine_ijk_.valeur(), eq_ns.get_compute_rising_velocities() || eq_ns.get_upstream_velocity_measured(),
509 eq_ns.get_fill_rising_velocities(), eq_ns.get_use_bubbles_velocities_from_interface(), eq_ns.get_use_bubbles_velocities_from_barycentres());
510
511
512 eq_ns.complete_initialise_ijk_fields();
513}
514
515// Deplacement des interfaces par le champ de vitesse :
516// 1. Calcule vitesse_ft (etendue) a partir du champ de vitesse.
517// 2. Supprime les duplicatas.
518// 3. Transporte le maillage avec velocity_ft_.
519// 4. Transfere les bulles a travers la periodicite si besoin.
520// 5. Cree les nouveaux duplicatas.
521//
522// ATTENTION : rho_mu_indicatrice ne sont pas mis a jours.
523//
524// Mettre rk_step = -1 si schema temps different de rk3.
525void Probleme_FTD_IJK_base::deplacer_interfaces(const double timestep, const int rk_step, ArrOfDouble& var_volume_par_bulle, const int first_step_interface_smoothing)
526{
528 return;
529
530 statistics().create_custom_counter("Deplacement de l'interface",3,"FrontTracking");
531 statistics().begin_count("Deplacement de l'interface",statistics().get_last_opened_counter_level()+1);
532
533 // FIXME
534 Navier_Stokes_FTD_IJK& ns = ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur());
535
536 // Calculer vitesse_ft (etendue) a partir du champ de vitesse.
538
539 if (has_thermals_)
540 {
541 IJK_Thermals& thermals = get_ijk_thermals();
542 /*
543 * Calculation of intersections on interface at time (n)
544 */
545 Cerr << "Compute Eulerian distance and curvature fields" << finl;
547 Cerr << "Clean IJK intersections" << finl;
548 thermals.clean_ijk_intersections();
549 Cerr << "Copy interface state for post-processing on surface" << finl;
551 // thermals_.update_intersections(); // no need as IJK_intersections call interfaces_nI interfaces_xI
552 }
553
555
556 ns.deplacer_interfaces(timestep, rk_step, var_volume_par_bulle, first_step_interface_smoothing);
557
558 // On supprime les fragments de bulles.
559 //interfaces_.detecter_et_supprimer_rejeton(false);
560
561 // On met a jour l'indicatrice du pas de temps d'apres.
562 // On met aussi a jour le surf et bary des faces mouillees,
563 // les valeurs moyennes en ijk, les val moy en ijkf, etc
564
566
567 // mise a jour de l'indicatrice pour les variables monofluides
569
570 statistics().end_count("Deplacement de l'interface");
571}
572
573// Nouvelle version ou le transport se fait avec les ghost...
574void Probleme_FTD_IJK_base::deplacer_interfaces_rk3(const double timestep, const int rk_step,
575 ArrOfDouble& var_volume_par_bulle)
576{
578 return;
579
580 // FIXME
581 ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur()).deplacer_interfaces_rk3(timestep, rk_step, var_volume_par_bulle);
582}
583
584// Parcourir_maillage cree des noeuds et facettes virtuelles.
585// Pour maintenir un tableau a jour entre avant et apres,
586// il suffit de resizer le tableau a la sortie de la methode
587// (forcement plus grand qu'avant) et de faire un echange_espace_virtuel.
589{
590 IJK_Interfaces& interf = get_interface();
591 //const int nbsom_before = interfaces_.maillage_ft_ijk().nb_sommets();
592 interf.parcourir_maillage();
593
594 const int nbsom = interf.maillage_ft_ijk().nb_sommets();
595 // const int size_store = interfaces_.RK3_G_store_vi().dimension(0);
596 // if (!((nbsom >= nbsom_before) &&
597 // ((nbsom_before == size_store) || (0 == size_store) )))
598 // {
599 // Cerr << "Une des tailles de tableau n'est pas bonne... "
600 // << " size_store = " << size_store
601 // << " nbsom_before = " << nbsom_before
602 // << " nbsom = " << nbsom
603 // << finl;
604 // Process::exit();
605 // }
606 interf.RK3_G_store_vi_resize(nbsom, 3);
608}
609
611{
612 IJK_Interfaces& interf = get_interface();
613 const double delta_rho = milieu_ijk().get_delta_rho();
615 interf.calculer_indicatrice_next(milieu_ijk().gravite().valeurs(),
616 delta_rho,
617 milieu_ijk().sigma(),
618 schema_temps_ijk().get_current_time(), schema_temps_ijk().get_tstep()
619 );
620}
621
626
631
633{
634 for(int i=0; i<2; i++)
635 {
638 }
639}
640
645
647{
648 Cerr << que_suis_je() << "::initialise_interfaces()" << finl;
649
650 const Domaine_dis_base& domaine_dis_ft = refprobleme_ft_disc_->domaine_dis();
651
652 get_interface().initialize(domaine_ft_, domaine_ijk_.valeur(), domaine_dis_ft, thermal_probes_ghost_cells_);
653
655
656 // On la met a jour 2 fois, une fois next et une fois old
659}
660
661/*! Nothing to be done here for now ...
662 */
664{
665 Cerr << "Discretization (IJK) of the domain associated with the problem '" << le_nom() << "' (nothing to do ...)" << finl;
666 if (!sub_type(IJK_discretisation, dis))
667 Process::exit("Error!! IJK problem must be associated with an IJK discretisation!!");
668}
669
670/** Fills in all possible fields that may be post-processed. Done only once even if multiple problems.
671 */
673{
674 static bool alreadyDone = false;
675
676 if (alreadyDone) return;
677
678 std::vector<FieldInfo_t>& chps = Postprocessing_IJK::Get_champs_postraitables();
679
686
687 // Complete the list with all the components for all vectorial fields.
688 std::vector<FieldInfo_t> more;
689 const std::vector<std::string> compos = {"_X", "_Y", "_Z"};
690 for (const auto& c: chps)
691 {
692 if (get<2>(c) == Nature_du_champ::vectoriel)
693 {
694 for (int d=0; d<Objet_U::dimension; d++)
695 {
696 FieldInfo_t n = c; // deep copy
697 get<0>(n) += Nom(compos[d]);
698 get<2>(n) = Nature_du_champ::scalaire;
699 more.push_back(n);
700 }
701 }
702 }
703 chps.insert(chps.end(), more.begin(), more.end());
704 alreadyDone = true;
705}
706
708{
709 Cerr << "Probleme_FTD_IJK_base::initialize()" << finl;
710
711 // FIXME
712 Navier_Stokes_FTD_IJK& ns = ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur());
714
715 if (que_suis_je() == "Probleme_FTD_IJK_cut_cell") // TODO should do virtual method here ?
716 treatment_count_.allocate(domaine_ijk_.valeur(), Domaine_IJK::ELEM, 2);
717
720
721 init_postraitements(); // from Probleme_base - will invoke Postprocessing_IJK::init()
722
723 Cerr << " Allocating " << IJK_Field_double::alloc_counter() << " IJK_FT_double objects." << finl;
724}
725
726
727/*
728 * TODO: Change this block with OWN_PTR CLASS IJK_Thermal
729 */
735
737{
738 // FIXME
739 IJK_Interfaces& interf = get_interface();
740 Navier_Stokes_FTD_IJK& ns = ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur());
741 ns.preparer_calcul();
742
743 if ((!Option_IJK::DISABLE_DIPHASIQUE) && (get_post().get_liste_post_instantanes().contient_("VI") || get_post().get_liste_post_instantanes().contient_("TOUS")))
744 interf.compute_vinterp();
745
746 if (has_thermals_)
748
749 if (!reprise_ && schema_temps_ijk().get_current_time() == 0.)
750 schema_temps_ijk().set_current_time(schema_temps_ijk().get_modified_time_ini());
751
752 // GB 2019.01.01 Why immobilisation? if (!Option_IJK::DISABLE_DIPHASIQUE && coef_immobilisation_==0.)
755
756// if (reprise_)
757// {
758// // On ecrit a la suite du fichier. Cela suppose qu'il est bien a jour.
759// // L'instant initial a deja ete ecrit a la fin du calcul precedent donc on ne le reecrit pas.
760// }
761// else
762// {
763// // On creer de nouveaux fichiers :
764// Cout << "BF ecrire_statistiques_bulles" << finl;
765// get_post().ecrire_statistiques_bulles(1 /* reset files */, nom_du_cas(), milieu_ijk().gravite().valeurs(), schema_temps_ijk().get_current_time());
766// Cout << "AF ecrire_statistiques_bulles" << finl;
767// }
768
769 // Ecrire la valeur initiale dans les sondes :
770 // Ecriture de la valeur initiale seulement hors reprise
771 if (!reprise_)
773
775}
776
777void Probleme_FTD_IJK_base::euler_time_step(ArrOfDouble& var_volume_par_bulle)
778{
779 // FIXME
780 Navier_Stokes_FTD_IJK& ns = ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur());
781
782 statistics().create_custom_counter("Mise a jour de la vitesse",3,"FrontTracking");
783 statistics().begin_count("Mise a jour de la vitesse",statistics().get_last_opened_counter_level()+1);
784
785 if (has_thermals_)
786 {
787 ns.update_v_or_rhov();
789 }
790
791 ns.euler_time_step(var_volume_par_bulle);
792 statistics().end_count("Mise a jour de la vitesse");
793}
794
795// Perform one sub-step of rk3 for FT algorithm, called 3 times per time step. rk_step = 0, 1 or 2
796// total_timestep = not the fractionnal timestep !
797void Probleme_FTD_IJK_base::rk3_sub_step(const int rk_step, const double total_timestep, const double fractionnal_timestep, const double time)
798{
799 assert(rk_step >= 0 && rk_step < 3);
800 statistics().create_custom_counter("Mise a jour de la vitesse",3,"FrontTracking");
801 statistics().begin_count("Mise a jour de la vitesse",statistics().get_last_opened_counter_level()+1);
802
803 if (has_thermals_)
804 get_ijk_thermals().rk3_sub_step(rk_step, total_timestep, time);
805
806 // FIXME
807 ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur()).rk3_sub_step(rk_step, total_timestep, fractionnal_timestep, time);
808
809 statistics().end_count("Mise a jour de la vitesse");
810}
811
813{
814 Probleme_FTD_IJK_base& pb_non_cst = const_cast<Probleme_FTD_IJK_base&>(*this);
815 Schema_Temps_IJK_base& sh_non_cst = const_cast<Schema_Temps_IJK_base&>(schema_temps_ijk()); // FIXME
816 IJK_Interfaces& interf = const_cast<IJK_Interfaces&>(get_interface());
817
818 sh_non_cst.set_tstep_sauv(schema_temps_ijk().get_tstep() + schema_temps_ijk().get_tstep_init());
819 const int dt_sauvegarde = schema_temps_ijk().get_dt_sauvegarde();
820
821 if (schema_temps_ijk().get_tstep_sauv() % dt_sauvegarde == dt_sauvegarde - 1 || stop_)
822 {
823 // Choix : On supprime les duplicatas pour la sauvegarde.
824 // On pourrait tres bien tout garder. ca serait plus leger en CPU, plus lourd en espace disque.
827
830 {
831 // On les recree :
832 interf.creer_duplicata_bulles();
833
834 // Be on the safe side, on met a jour :
835 // A la suppression des duplicatas, on avait fait mesh.supprimer_facettes qui remet le maillage
836 // a l'etat MINIMAL. Pour les post-tt sur l'interface (eg ai_ft_), il faut que le statut du maillage
837 // soit >= PARCOURU. C'est fait au debut de maj_indicatrice_rho_mu dans
838 // IJK_Interfaces::calculer_indicatrice.
839 const double delta_rho = milieu_ijk().get_delta_rho();
840 interf.calculer_indicatrice_next(milieu_ijk().gravite().valeurs(), delta_rho, milieu_ijk().sigma(),
841 schema_temps_ijk().get_current_time(), schema_temps_ijk().get_tstep());
842 }
843 }
844}
845
847{
848 return schema_temps_ijk().computeTimeStep(stop);
849}
850
852{
853 // TODO: on pourrait mutualiser tous les parcourir maillages dans IJK_Interface au moment du transport de l'interface
854 // et le supprimer de IJK_FT
855 // interfaces_.parcourir_maillage();
856 if ((!Option_IJK::DISABLE_DIPHASIQUE) && (get_post().get_liste_post_instantanes().contient_("VI")))
858}
859
861{
863 {
864 SFichier master_file;
865 master_file.ouvrir(get_post().nom_fich() , ios::app);
866 master_file << "FIN" << finl;
867 master_file.close();
868 }
869}
870
872{
873 // Tableau permettant de calculer la variation de volume au cours du pas de temps :
874 // Si on veut le mettre en optionel, il faut faire attention a faire vivre la taille de ce tableau avec les
875 // creations et destructions de ghosts :
876 IJK_Interfaces& interf = get_interface();
877 const int nbulles_tot = interf.get_nb_bulles_reelles() + interf.get_nb_bulles_ghost(1/*print=1*/);
878 DoubleTrav var_volume_par_bulle(nbulles_tot);
879 var_volume_par_bulle = 0.; // Je ne suis pas sur que ce soit un bon choix. Si on ne le remet pas a zero a chaque dt, on corrigera la petite erreur qui pouvait rester d'avant...
880
881 // FIXME
882 Navier_Stokes_FTD_IJK& ns = ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur());
883 ns.compute_var_volume_par_bulle(var_volume_par_bulle);
884
885 // Au cas ou on soit dans un cas ou des duplicatas sont necessaires mais n'ont pas ete crees, on les cree :
887 interf.creer_duplicata_bulles();
888
890 solveTimeStep_Euler(var_volume_par_bulle);
891 else if ( sub_type(Schema_RK3_IJK, schema_temps_ijk()) )
892 solveTimeStep_RK3(var_volume_par_bulle);
893 else
894 {
895 Cerr << "Erreur dans Probleme_FTD_IJK_base::solveTimeStep() : time_scheme " << schema_temps_ijk().que_suis_je() << " inconnu !" << finl;
897 }
898
899 ns.corriger_qdm();
900
901 //
902 // !!! TODO - the below should not be done here !!! solveTimeStep() should not update current time:
903 //
904 schema_temps_ijk().set_current_time(schema_temps_ijk().get_current_time() + schema_temps_ijk().get_timestep()); // update tn
905
906 // stock dans le spliting le decallage periodique total avec condition de shear (current_time_) et celui du pas de temps (timestep_)
909
910 create_forced_dilation(); // rien si Probleme_FTD_IJK_cut_cell
911
912 if (get_post().is_stats_plans_activated() && schema_temps_ijk().get_current_time() >= get_post().t_debut_statistiques())
913 {
914 ns.update_v_or_rhov(true /* with pressure */);
915
916 get_post().update_stat_ft(schema_temps_ijk().get_timestep());
919 }
920
921 return true;
922}
923
924void Probleme_FTD_IJK_base::solveTimeStep_Euler(DoubleTrav& var_volume_par_bulle)
925{
926 // FIXME
927 Navier_Stokes_FTD_IJK& ns = ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur());
928 IJK_Interfaces& interf = get_interface();
929
930 // Deplacement des interfaces par le champ de vitesse de l'instant n :
932 {
933 int counter_first_iter = 1;
934 bool& first_step_interface_smoothing = schema_temps_ijk().get_first_step_interface_smoothing(); // attention ref
935
936 do
937 {
938 first_step_interface_smoothing = first_step_interface_smoothing && counter_first_iter;
939 deplacer_interfaces(schema_temps_ijk().get_timestep(), -1 /* le numero du sous pas de temps est -1 si on n'est pas en rk3 */, var_volume_par_bulle, first_step_interface_smoothing);
940 counter_first_iter--;
941 if (first_step_interface_smoothing)
942 {
943 if (has_thermals_)
945
946// get_post().posttraiter_champs_instantanes(lata_name_, schema_temps_ijk().get_current_time(), schema_temps_ijk().get_tstep());
947 ns.compute_var_volume_par_bulle(var_volume_par_bulle);
948
949 if (has_thermals_)
951 }
952 }
953 while (first_step_interface_smoothing);
954
956 }
957
958 // Mise a jour de la vitesse (utilise les positions des marqueurs, rho, mu et indic a l'instant n)
959 // Retourne une vitesse mise a jour et projetee a div nulle
960 euler_time_step(var_volume_par_bulle);
961
962 ns.calculer_terme_source_acceleration(schema_temps_ijk().get_current_time() + schema_temps_ijk().get_timestep(),
963 schema_temps_ijk().get_timestep(),
964 -1 /* Euler */,
965 0 /* direction */);
966
967 ns.calculer_terme_source_acceleration(schema_temps_ijk().get_current_time() + schema_temps_ijk().get_timestep(),
968 schema_temps_ijk().get_timestep(),
969 -1 /* Euler */, 2);
970
971 // Deplacement des interfaces par le champ de vitesse :
972 // met a jour la position des marqueurs, la vitesse_ft, et gere les duplicatas.
973 // Ne met pas a jour rho_mu_indicatrice
974
975 if (!Option_IJK::DISABLE_DIPHASIQUE) // && !marker_advection_first_)
976 {
977 // Les sous-pas de temps sont termines. Il n'est plus necessaire de gerer le tableau
978 // RK3_G_store_vi_. On peut donc transferer les bulles et re-creer les duplicatas :
980 interf.transferer_bulle_perio();
981 // On supprime les fragments de bulles.
982 //interfaces_.detecter_et_supprimer_rejeton(false);
983 interf.creer_duplicata_bulles();
984
985 ns.test_etapes_et_bilan_rho_u_euler(false /* avant */);
987
988 if (has_thermals_)
990
991 ns.test_etapes_et_bilan_rho_u_euler(true /* apres */);
992 }
993 else
994 ns.test_etapes_et_bilan_rho_u_euler(true /* apres */);
995}
996
997void Probleme_FTD_IJK_base::solveTimeStep_RK3(DoubleTrav& var_volume_par_bulle)
998{
1000 double current_time_at_rk3_step = rk3.get_current_time();
1001 // GAB, qdm : passe en attribut de classe car utilise au moment de l'ecriture de mon out
1003 // Evaluation de la variation de volume accumule au cours des sous pas de temps.
1004 // On la laisse croitre pendant les sous dt 0 et 1 puis on la corrige a la fin du 2eme :
1005
1006 int& rk_step = rk3.get_rk_step();
1007 const double timestep = rk3.get_timestep();
1008
1009 // FIXME
1010 Navier_Stokes_FTD_IJK& ns = ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur());
1011 IJK_Interfaces& interf = get_interface();
1012
1013 for (rk_step = 0; rk_step < 3; rk_step++)
1014 {
1015 const double fractionnal_timestep = compute_fractionnal_timestep_rk3(timestep /* total*/, rk_step);
1016
1017 // Mise a jour des positions des marqueurs.
1018 // Deplacement des interfaces par le champ de vitesse au sous pas de temps k :
1020 {
1021 deplacer_interfaces_rk3(timestep /* total */, rk_step, var_volume_par_bulle);
1023 }
1024 // Mise a jour de la temperature et de la vitesse :
1025 rk3_sub_step(rk_step, timestep, fractionnal_timestep, current_time_at_rk3_step);
1026
1027 ns.test_etapes_et_bilan_rho_u_euler(false /* avant */);
1028
1029 // Mise a jour rho, mu et l'indicatrice a partir de la nouvelle position de l'interface :
1030 // (sauf au dernier sous pas de temps pour lequel c'est fait a la fin du pas de temps)
1031 // TODO: verifier qu'on doit bien le faire aussi au dernier sous pas de temps : rk_step != 2 &&
1032 // TODO aym: verifier ce bloc, qui applique les sous pas de temps RK3 de la rustine a la temperature
1033 if (rk_step != 2 && !Option_IJK::DISABLE_DIPHASIQUE)
1034 {
1035 // Attention, il faut que les duplicatas soient present pour faire maj_indicatrice_rho_mu :
1037
1038 if (has_thermals_)
1039 get_ijk_thermals().rk3_rustine_sub_step(rk_step, timestep, fractionnal_timestep, current_time_at_rk3_step);
1040 }
1041
1042 ns.calculer_terme_source_acceleration(current_time_at_rk3_step, timestep /*total*/, rk_step, 0 /* direction */);
1043
1044 ns.calculer_terme_source_acceleration(current_time_at_rk3_step, timestep /*total*/, rk_step, 2 /* direction */);
1045
1046 current_time_at_rk3_step += fractionnal_timestep;
1047 // GAB, qdm : passe en attribut de classe car utilise au moment de l'ecriture de mon out
1048 rk3.get_current_time_at_rk3_step() += fractionnal_timestep;
1049
1050// // On ne postraite pas le sous-dt 2 car c'est fait plus bas si on post-traite le pas de temps :
1051// if (get_post().postraiter_sous_pas_de_temps()
1052// && ((rk3.get_tstep() % get_post().nb_pas_dt_post() == get_post().nb_pas_dt_post() - 1)
1053// || (std::floor((current_time - timestep) / get_post().get_timestep_simu_post(current_time, rk3.get_max_simu_time()))
1054// < std::floor(current_time / get_post().get_timestep_simu_post(current_time, rk3.get_max_simu_time())))) && (rk_step != 2))
1055// {
1056// get_post().posttraiter_champs_instantanes(lata_name_, current_time_at_rk3_step, rk3.get_tstep());
1057// }
1058 }
1060 {
1061 // Les sous-pas de temps sont termines. Il n'est plus necessaire de gerer le tableau
1062 // RK3_G_store_vi_. On peut donc transferer les bulles et re-creer les duplicatas :
1064 interf.transferer_bulle_perio();
1065 // On supprime les fragments de bulles.
1066 //interfaces_.detecter_et_supprimer_rejeton(false);
1067 interf.creer_duplicata_bulles();
1068
1069 // Mise a jour rho, mu et l'indicatrice a partir de la nouvelle position de l'interface :
1071
1072 if (has_thermals_)
1074 }
1075
1076 ns.test_etapes_et_bilan_rho_u_euler(true /* apres */);
1077}
1078
1080{
1081 Cerr << "Probleme_FTD_IJK_base::run()" << finl;
1082
1084
1086
1087 statistics().end_count(STD_COUNTERS::computation_start_up);
1088 // Print the initialization CPU statistics
1089 statistics().print_TU_files("Computation start-up statistics");
1090
1091 bool ok = true;
1092 int& tstep = schema_temps_ijk().get_tstep();
1093
1094 statistics().start_timeloop();
1095 for (tstep = 0; tstep < schema_temps_ijk().get_nb_timesteps() && !stop_; tstep++)
1096 {
1097 // Begin the CPU measure of the time step
1098 statistics().start_time_step();
1099 statistics().begin_count(STD_COUNTERS::timeloop);
1100
1101 // In IJK, the post is done at the begining of the time step - at this point tstep and dt are still coherent.
1102 // After 'computeTimeStep()' we are in a situation where loop index 'tstep' has not advanced, but 'dt' (double value) has.
1104
1105 // max time step is modified in order to land as close as possible to a postpro interval (if using intervals)
1106 // this is useful to obtain regularly spaced outputs
1107 // TODO(teo.boutin) set this as optional with a flag in dataset
1108 double max_timestep_for_post_at_intervals = get_post().get_max_timestep_for_post(schema_temps_ijk().get_current_time());
1109 double old_max_timestep = schema_temps_ijk().get_max_timestep();
1110 schema_temps_ijk().set_max_timestep_if_smaller(max_timestep_for_post_at_intervals);
1111
1113
1114 // reset the max_timestep to normal value
1115 schema_temps_ijk().set_max_timestep(old_max_timestep);
1116
1117 /* Contrary to what is done in the classical Probleme_base::run() method, here we do not stop directly
1118 * we still go through the end of the loop:
1119 */
1120 // if (stop_) /* stop file detected ? */
1121 // break;
1122
1123 // Prepare the next time step
1124 if (!initTimeStep(schema_temps_ijk().get_timestep()))
1125 return false;
1126
1127 // Solve the next time step
1128 ok = solveTimeStep();
1129
1130 // Should we stop the computation ? TODO This should be all done in computeTimeStep above ... not ICoCo compliant at the moment ...
1132
1133 sauver();
1134
1135 if (!ok) // The resolution failed, try with a new time interval.
1136 {
1137 abortTimeStep();
1139 }
1140 else // The resolution was successful, validate and go to the next time step.
1142
1143 statistics().end_time_step(tstep);
1144 statistics().end_count(STD_COUNTERS::timeloop);
1145 }
1146
1147 statistics().end_timeloop();
1148
1149 // Last post:
1150 postraiter(true);
1151
1152 statistics().print_TU_files("Time loop statistics");
1153 return ok;
1154}
1155
1157{
1158 Cerr << "Construction du domaine VDF NS pour les sondes..." << finl;
1159 refprobleme_ns_ = creer_domaine_vdf(domaine_ijk_.valeur(), "DOM_NS_VDF");
1160
1161 Cerr << "Construction du domaine VDF..." << finl;
1162 build_extended_splitting(domaine_ijk_.valeur(), domaine_ft_, domaine_ijk_->ft_extension());
1163 refprobleme_ft_disc_ = creer_domaine_vdf(domaine_ft_, "DOM_VDF");
1164
1165 // FIXME
1166 ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur()).build_redistribute_extended_splitting_ft();
1167}
double get_t0_shear() const
double get_dU_perio(int fluctuations=0) const
classe Discretisation_base Cette classe represente un schema de discretisation en espace,...
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
Definition Domaine_IJK.h:47
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
static void Fill_postprocessable_fields(std::vector< FieldInfo_t > &chps)
: class IJK_Interfaces
void associate_rising_velocities_parameters(const Domaine_IJK &splitting, const int &compute_rising_velocities, const int &fill_rising_velocities, const int &use_bubbles_velocities_from_interface, const int &use_bubbles_velocities_from_barycentres)
void initialize(const Domaine_IJK &splitting_FT, const Domaine_IJK &splitting_NS, const Domaine_dis_base &domaine_dis, const int thermal_probes_ghost_cells=0, const bool compute_vint=true, const bool is_switch=false)
void set_param_reprise_pb(Param &)
int get_nb_bulles_ghost(const int print=0) const
void calculer_indicatrice_apres_remaillage(const bool parcourir=true)
void update_indicatrice_variables_monofluides()
int get_nb_bulles_reelles() const
bool has_champ(const Motcle &nom) const override
void get_noms_champs_postraitables(Noms &noms, Option opt=NONE) const override
void update_old_intersections()
void RK3_G_store_vi_echange_esp_vect()
void detecter_et_supprimer_rejeton(bool duplicatas_etaient_presents)
void set_fichier_reprise_interface(const Nom &prefix)
static void Fill_postprocessable_fields(std::vector< FieldInfo_t > &chps)
void RK3_G_store_vi_resize(int n, int n2)
void initialise_ijk_compo_connex_bubbles_params()
void switch_indicatrice_next_old()
const Maillage_FT_IJK & maillage_ft_ijk() const
bool has_champ_vectoriel(const Motcle &nom) const override
void parcourir_maillage()
void calculer_indicatrice_avant_remaillage(const bool parcourir=true)
const IJK_Field_double & get_IJK_field(const Motcle &nom) override
void supprimer_duplicata_bulles()
const IJK_Field_vector3_double & get_IJK_field_vector(const Motcle &nom) override
void sauvegarder_interfaces(const char *lata_name, const Nom &interf_name="??")
void allocate_ijk_compo_connex_fields(const Domaine_IJK &splitting, const int &allocate_compo_fields)
void calculer_indicatrice_next(const DoubleTab &gravite, const double delta_rho, const double sigma, const double time, const int itstep, const bool parcourir=true)
bool has_champ_vectoriel(const Motcle &nom) const override
void rk3_rustine_sub_step(const int rk_step, const double total_timestep, const double fractionnal_timestep, const double time)
void get_noms_champs_postraitables(Noms &noms, Option opt=NONE) const override
void set_post_pro_first_call()
void set_fichier_reprise(const char *lataname)
void set_temperature_ini()
void get_rising_velocities_parameters(int &compute_rising_velocities, int &fill_rising_velocities, int &use_bubbles_velocities_from_interface, int &use_bubbles_velocities_from_barycentres)
const IJK_Field_vector3_double & get_IJK_field_vector(const Motcle &nom) override
bool has_champ(const Motcle &nom) const override
void clean_ijk_intersections()
void sauvegarder_temperature(Nom &lata_name, const int &stop)
void initialize(const Domaine_IJK &splitting)
void euler_rustine_step(const double timestep)
void copy_previous_interface_state()
const IJK_Field_double & get_IJK_field(const Motcle &nom) override
static void Fill_postprocessable_fields(std::vector< FieldInfo_t > &chps)
void update_thermal_properties()
void compute_eulerian_distance_curvature()
void rk3_sub_step(const int rk_step, const double total_timestep, const double time)
void euler_time_step(const double timestep)
class IJK_discretisation handles the IJK discretisation of the problem
Cette classe implemente les operateurs et les methodes virtuelles de la classe EFichier de la facon s...
int nb_sommets() const
renvoie le nombre de sommets (reels et virtuels) (egal a sommets().
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
bool has_champ(const Motcle &nom) const override
void calculer_terme_source_acceleration(IJK_Field_double &vx, const double time, const double timestep, const int rk_step)
void maj_indicatrice_rho_mu(const bool parcourir=true)
const IJK_Field_double & get_IJK_field(const Motcle &nom) override
void set_fichier_reprise_vitesse(const Nom &prefix)
bool has_champ_vectoriel(const Motcle &nom) const override
void get_noms_champs_postraitables(Noms &noms, Option opt=NONE) const override
void sauvegarder_equation(const Nom &, SFichier &) const
void deplacer_interfaces(const double timestep, const int rk_step, ArrOfDouble &var_volume_par_bulle, const int first_step_interface_smoothing)
const Boundary_Conditions & get_boundary_conditions() const
const IJK_Field_vector3_double & get_velocity() const
const IJK_Field_vector3_double & get_IJK_field_vector(const Motcle &nom) override
void compute_var_volume_par_bulle(ArrOfDouble &var_volume_par_bulle)
void euler_time_step(ArrOfDouble &var_volume_par_bulle)
void associer_interfaces(const IJK_Interfaces &inter)
void update_v_or_rhov(bool with_p=false)
int preparer_calcul() override
Tout ce qui ne depend pas des autres problemes eventuels.
void test_etapes_et_bilan_rho_u_euler(bool apres)
static void Fill_postprocessable_fields(std::vector< FieldInfo_t > &chps)
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
Un tableau de chaine de caracteres (VECT(Nom)).
Definition Noms.h:26
int rang(const char *const ch) const
Definition Noms.cpp:65
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
static const Nom & nom_du_cas()
Renvoie une reference constante vers le nom du cas.
Definition Objet_U.cpp:146
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
static bool DISABLE_DIPHASIQUE
Definition Option_IJK.h:26
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
int lire_avec_accolades(Entree &is)
Alias of lire_avec_accolades_depuis.
Definition Param.h:577
int postraiter(int force=1) override
Demande au probleme de postraiter ses champs, sondes,.
void sauvegarder_post(const Nom &lata_name)
const IJK_Field_double & get_IJK_field(const Motcle &nom) override
static void Fill_postprocessable_fields(std::vector< FieldInfo_t > &chps)
static std::vector< FieldInfo_t > & Get_champs_postraitables()
const IJK_Field_vector3_double & get_IJK_field_vector(const Motcle &nom) override
void associer_probleme(const Probleme_FTD_IJK_base &)
void update_stat_ft(const double dt)
void sauvegarder_post_maitre(const Nom &lata_name, SFichier &fichier) const
void get_noms_champs_postraitables(Noms &noms, Option opt=NONE) const
void associer_domaines(Domaine_IJK &dom_ijk, Domaine_IJK &dom_ft)
bool has_champ_vectoriel(const Motcle &nom) const override
double get_max_timestep_for_post(double current_time) const
Compute the max possible timestep to use during the next iteration in order to not skip a time interv...
void reprendre_post(Param &param)
bool has_champ(const Motcle &nom) const override
int postraiter_sondes()
Effectue le postraitement lie au sondes de facon imperative.
void get_noms_champs_postraitables(Noms &noms, Option opt) const override
Fluide_Diphasique_IJK & milieu_ijk()
void completer() override
Complete les equations associees au probleme.
void typer_lire_milieu(Entree &is) override
bool has_champ_vectoriel(const Motcle &nom) const override
virtual void set_param(Param &param) const override
void reprendre_probleme(const char *fichier_reprise)
void terminate() override
This method is called once at the end, after any other one.
const IJK_Interfaces & get_interface() const
void sauver() const override
Ecriture sur fichier en vue d'une reprise (sauvegarde).
const IJK_Field_double & get_IJK_field(const Motcle &nom) override
Champs_compris_IJK_interface::FieldInfo_t FieldInfo_t
virtual void create_forced_dilation()
int associer_(Objet_U &) override
surcharge Objet_U::associer_(Objet_U& ob) Associe differents objets au probleme en controlant
const Schema_Temps_IJK_base & schema_temps_ijk() const
void euler_time_step(ArrOfDouble &var_volume_par_bulle)
void rk3_sub_step(const int rk_step, const double total_timestep, const double fractionnal_timestep, const double time)
const Postprocessing_IJK & get_post() const
void sauvegarder_probleme(const char *fichier_sauvegarde, const int &stop)
void preparer_calcul() override
Prepare le calcul: initialise les parametres du milieu et prepare le calcul de chacune des equations.
void lire_solved_equations(Entree &is) override
void solveTimeStep_Euler(DoubleTrav &)
virtual void update_twice_indicator_field()
virtual void deplacer_interfaces_rk3(const double timestep, const int rk_step, ArrOfDouble &var_volume_par_bulle)
bool solveTimeStep() override
pour recodage eventuel et appel unifie en python
const IJK_Field_vector3_double & get_IJK_field_vector(const Motcle &nom) override
void initialize() override
This method is called once at the beginning, before any other one of the interface Problem.
bool initTimeStep(double dt) override
This method allocates and initializes the unknown and given fields for the future time step.
const Navier_Stokes_FTD_IJK & eq_ns() const
void abortTimeStep() override
Aborts the resolution of the current time step.
void discretiser(Discretisation_base &dis) override
bool has_champ(const Motcle &nom) const override
void validateTimeStep() override
Validates the calculated unknown by moving the present time at the end of the time step.
virtual void deplacer_interfaces(const double timestep, const int rk_step, ArrOfDouble &var_volume_par_bulle, const int first_step_interface_smoothing)
void solveTimeStep_RK3(DoubleTrav &)
const IJK_Thermals & get_ijk_thermals() const
bool run() override
Cette methode est une sorte de main() du Problem Elle peut etre utilisee si le probleme n'est couple ...
double computeTimeStep(bool &stop) const override
Compute the value the Problem would like for the next time step.
Equation_base & getset_equation_by_name(const Nom &le_nom) override
(B. Math): Methode virtuelle ajoutee pour les problemes ayant plusieurs equations de meme type (Probl...
void add_FT_equation(const Nom &, const Nom &)
int associer_(Objet_U &ob) override
surcharge Objet_U::associer_(Objet_U& ob) Associe differents objets au probleme en controlant
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
Definition Probleme_U.h:109
void init_postraitements()
Flag le premier et le dernier postraitement pour chaque fichier Et initialise les postraitements.
Postraitements les_postraitements_
std::vector< OWN_PTR(Milieu_base)> le_milieu_
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
Definition Process.cpp:86
Cette classe est a la classe C++ ofstream ce que la classe Sortie est a la classe C++ ostream Elle re...
Definition SFichier.h:27
Explicit Euler scheme for IJK setups.
double & get_current_time_at_rk3_step()
void set_max_timestep(const double t)
double computeTimeStep(bool &stop) const override
void set_max_timestep_if_smaller(const double t)
void set_modified_time_ini(const double t)
void set_tstep_sauv(const int ts)
void set_current_time(const double t)
void check_stop_criteria(bool &stop) const
virtual int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::out)
void precision(int pre) override
void setf(IOS_FORMAT code) override
Classe de base des flux de sortie.
Definition Sortie.h:52
static void Fill_postprocessable_fields(std::vector< FieldInfo_t > &chps)
static int les_sous_types(const Nom &, Noms &sous_types)
Donne les noms des sous-types, un type mere etant donne par son nom.