TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Probleme_FTD_IJK_base.h
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#ifndef Probleme_FTD_IJK_base_included
17#define Probleme_FTD_IJK_base_included
18
19#include <Fluide_Diphasique_IJK.h>
20#include <Schema_Temps_IJK_base.h>
21#include <Navier_Stokes_FTD_IJK.h>
22#include <Probleme_FT_Disc_gen.h>
23#include <IJK_Interfaces.h>
24#include <IJK_Thermals.h>
25#include <Domaine_IJK.h>
26#include <Postprocessing_IJK.h>
27#include <Champs_compris_IJK.h>
28#include <Champs_compris_IJK_interface.h>
29
30class Domaine_IJK;
31
33{
34 Declare_base(Probleme_FTD_IJK_base) ;
35public :
37
38 // We take too much advantage of it ...:
41 friend class Postprocessing_IJK;
42
43 int associer_(Objet_U&) override;
44
45 virtual void set_param(Param& param) const override;
46
47 const Domaine_IJK& get_domaine_ft() const { return domaine_ft_ ; }
48 Domaine_IJK& get_domaine_ft() { return domaine_ft_ ; } // non-constpour NS :: // TODO FIXME // associer comme avant !
49
50 const Domaine_IJK& get_domaine() const { return domaine_ijk_.valeur(); }
51 const Domaine_IJK& domaine_ijk() const { return domaine_ijk_.valeur(); }
52 Domaine_IJK& domaine_ijk() { return domaine_ijk_.valeur(); }
53
54 void discretiser(Discretisation_base& dis) override;
55 void preparer_calcul() override;
56
57 void typer_lire_milieu(Entree& is) override;
58 void lire_solved_equations(Entree& is) override;
59
60 void completer() override;
61 void mettre_a_jour(double temps) override { }
62 virtual bool updateGivenFields() override { return false; }
63
64 inline Fluide_Diphasique_IJK& milieu_ijk() { return ref_cast(Fluide_Diphasique_IJK, le_milieu_.front().valeur()); }
65 inline const Fluide_Diphasique_IJK& milieu_ijk() const { return ref_cast(Fluide_Diphasique_IJK, le_milieu_.front().valeur()); }
66 const Schema_Temps_IJK_base& schema_temps_ijk() const { return ref_cast(Schema_Temps_IJK_base, le_schema_en_temps_.valeur()); }
67 Schema_Temps_IJK_base& schema_temps_ijk() { return ref_cast(Schema_Temps_IJK_base, le_schema_en_temps_.valeur()); }
68
69 // interface Problem
70 bool run() override;
71 void initialize() override;
72 void terminate() override;
73// int postraiter(int force=1) override;
74 void sauver() const override;
75
76 // interface UnsteadyProblem
77 double presentTime() const override { return 0.; }
78 double computeTimeStep(bool& stop) const override;
79 bool initTimeStep(double dt) override { return true; }
80 bool solveTimeStep() override;
81 void validateTimeStep() override;
82 void setStationary(bool flag) override { }
83 void abortTimeStep() override { }
84 void resetTime(double time) override { }
85
86 // interface IterativeUnsteadyProblem
87 bool iterateTimeStep(bool& converged) override { return iterateTimeStep_impl(*this, converged); }
88
89 Entree& lire_equations(Entree& is, Motcle& dernier_mot) override { return is; }
90
91 IJK_Field_int& treatment_count() { return treatment_count_; }
92 const IJK_Field_int& treatment_count() const { return treatment_count_; }
93 int new_treatment() const { return new_treatment_; }
94 int& new_treatment() { return new_treatment_; }
95
96 const Nom& nom_sauvegarde() const { return nom_sauvegarde_; }
97
98 // Interface Champs_compris_IJK_interface
99 bool has_champ(const Motcle& nom) const override;
100 bool has_champ(const Motcle& nom, OBS_PTR(Champ_base)& ref_champ) const override { /* not used */ throw; }
101 bool has_champ_vectoriel(const Motcle& nom) const override;
102 const IJK_Field_double& get_IJK_field(const Motcle& nom) override;
103 const IJK_Field_vector3_double& get_IJK_field_vector(const Motcle& nom) override;
104
107
108 void sauvegarder_probleme(const char *fichier_sauvegarde, const int& stop); // const;
109 void reprendre_probleme(const char *fichier_reprise);
110
112
114
116 bool get_reprise() const { return reprise_; }
117
118 void get_noms_champs_postraitables(Noms& noms,Option opt) const override;
119
120 const Postprocessing_IJK& get_post() const { return ref_cast(Postprocessing_IJK, les_postraitements_.front().valeur()); }
121 Postprocessing_IJK& get_post() { return ref_cast(Postprocessing_IJK, les_postraitements_.front().valeur()); }
122
123 ArrOfDouble_with_ghost& get_delta_z_local() { return delta_z_local_; }
124 const ArrOfDouble_with_ghost& get_delta_z_local() const { return delta_z_local_; }
125
126 virtual void deplacer_interfaces(const double timestep, const int rk_step, ArrOfDouble& var_volume_par_bulle, const int first_step_interface_smoothing);
127 virtual void deplacer_interfaces_rk3(const double timestep, const int rk_step, ArrOfDouble& var_volume_par_bulle);
128 virtual void update_indicator_field();
129 virtual void update_twice_indicator_field();
133 void parcourir_maillage();
134 void calculer_rho_mu_indicatrice(const bool parcourir = true);
135
136 const Nom& get_lata_name() const { return lata_name_; }
137
138 const Probleme_base& probleme(const Domaine_IJK& dom) const
139 {
140 if (dom == domaine_ft_)
141 return refprobleme_ft_disc_.valeur();
142 Process::exit("Unrecognized domain provided");
143 throw;
144 }
145
147 {
148 Process::exit("No cut fields are found.");
149 throw;
150 }
151
152 bool has_ns() const { return has_ns_; }
153 bool has_interface() const { return has_interface_; }
154 bool has_thermals() const { return has_thermals_; }
155
157 {
158 assert (has_ns_);
159 if (!has_ns_) { throw; };
160 return ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur());
161 }
163 {
164 assert (has_ns_);
165 if (!has_ns_) { throw; };
166 return ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur());
167 }
168
170 {
171 if (!has_interface_) { return interface_to_remove_later_when_clean_; }; // TODO (teo.boutin) (just in case we forget, and I'm not the one who did that)
172 return ref_cast(IJK_Interfaces, equations_[1].valeur());
173 }
175 {
177 return ref_cast(IJK_Interfaces, equations_[1].valeur());
178 }
179
181 {
182 assert (has_interface_);
183 if (!has_interface_) { throw; };
185 }
187 {
188 assert (has_interface_);
189 if (!has_interface_) { throw; };
191 }
192
194 {
195 assert (has_thermals_);
197 return ref_cast(IJK_Thermals, equations_[2].valeur());
198 else if (!has_interface_ && has_thermals_)
199 return ref_cast(IJK_Thermals, equations_[1].valeur());
200 else
201 throw;
202 }
203
205 {
206 assert (has_thermals_);
208 return ref_cast(IJK_Thermals, equations_[2].valeur());
209 else if (!has_interface_ && has_thermals_)
210 return ref_cast(IJK_Thermals, equations_[1].valeur());
211 else
212 throw;
213 }
214
215
216protected:
218 bool has_interface_ = false, has_ns_ = false, has_thermals_ = false;
219 ArrOfDouble_with_ghost delta_z_local_;
220 OBS_PTR(Domaine_IJK) domaine_ijk_;
223 bool stop_ = false;
224
225 Nom fichier_post_; // TODO a virer une fois le clean du post fini
227 bool sauvegarder_xyz_ = false; // drapeau 0 ou 1
228 bool reprise_ = false;// flag pour indiquer si on fait une reprise
229
230 // Le probleme ft disc qui porte le maillage vdf pour les algorithmes front-tracking
231 OBS_PTR(Probleme_base) refprobleme_ft_disc_;
232 // Creation d'un probleme sur le domaine d'origine pour les sondes et pour faire leur VDF...
233 OBS_PTR(Probleme_base) refprobleme_ns_;
234
235 void euler_time_step(ArrOfDouble& var_volume_par_bulle);
236 void rk3_sub_step(const int rk_step, const double total_timestep, const double fractionnal_timestep, const double time);
237 virtual void create_forced_dilation() { }
238 void solveTimeStep_Euler(DoubleTrav&);
239 void solveTimeStep_RK3(DoubleTrav&);
240 void build_vdf_domaine();
241
242 // Champ IJK_Field notant les cellules parcouru lors d'un traitement,
243 // c'est-a-dire pour eviter de recalculer plusieurs fois les memes cases lors du calculs des flux.
244 // Le champ est public pour faciliter l'utilisation dans IJK_Thermal_cut_cell
245 IJK_Field_int treatment_count_;
246
247 // Compteur du dernier traitement effectue dans treatment_count_
250
251 static void Fill_postprocessable_fields();
252};
253
254#endif /* Probleme_FTD_IJK_base_included */
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
Similar to Champs_compris_interface but for IJK scalar and vector fields.
std::tuple< Motcle, Entity, Nature_du_champ, bool > FieldInfo_t
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
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
: class IJK_Interfaces
const Remaillage_FT_IJK & remaillage_ft_ijk() const
const Maillage_FT_IJK & maillage_ft_ijk() const
: class Maillage_FT_IJK
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
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
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
double t_debut_statistiques() const
const Probleme_base & probleme(const Domaine_IJK &dom) const
void get_noms_champs_postraitables(Noms &noms, Option opt) const override
Fluide_Diphasique_IJK & milieu_ijk()
void calculer_rho_mu_indicatrice(const bool parcourir=true)
const Domaine_IJK & domaine_ijk() const
IJK_Thermals & get_ijk_thermals()
Postprocessing_IJK & get_post()
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 mettre_a_jour(double temps) override
Effectue une mise a jour en temps du probleme.
void reprendre_probleme(const char *fichier_reprise)
const ArrOfDouble_with_ghost & get_delta_z_local() const
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 Maillage_FT_IJK & get_maillage_ft_ijk() const
const IJK_Field_double & get_IJK_field(const Motcle &nom) override
Champs_compris_IJK_interface::FieldInfo_t FieldInfo_t
virtual Cut_cell_FT_Disc * get_cut_cell_disc()
virtual void create_forced_dilation()
const Nom & nom_sauvegarde() const
int associer_(Objet_U &) override
surcharge Objet_U::associer_(Objet_U& ob) Associe differents objets au probleme en controlant
double presentTime() const override
Returns the present time.
IJK_Interfaces interface_to_remove_later_when_clean_
OBS_PTR(Probleme_base) refprobleme_ns_
void resetTime(double time) override
Reset the current time of the Problem to a given value.
const Schema_Temps_IJK_base & schema_temps_ijk() const
const Fluide_Diphasique_IJK & milieu_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)
void setStationary(bool flag) override
Tells to the Problem that stationary is reached or not.
OBS_PTR(Domaine_IJK) domaine_ijk_
OBS_PTR(Probleme_base) refprobleme_ft_disc_
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)
Entree & lire_equations(Entree &is, Motcle &dernier_mot) override
Lecture des equations du probleme.
const IJK_Field_int & treatment_count() const
ArrOfDouble_with_ghost delta_z_local_
bool iterateTimeStep(bool &converged) override
In the case solveTimeStep uses an iterative process, this method executes a single iteration.
IJK_Field_int & treatment_count()
bool solveTimeStep() override
pour recodage eventuel et appel unifie en python
const IJK_Field_vector3_double & get_IJK_field_vector(const Motcle &nom) override
Navier_Stokes_FTD_IJK & eq_ns()
virtual bool updateGivenFields() override
ATTENTION :
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.
ArrOfDouble_with_ghost & get_delta_z_local()
const Navier_Stokes_FTD_IJK & eq_ns() const
const Domaine_IJK & get_domaine_ft() const
void abortTimeStep() override
Aborts the resolution of the current time step.
const Nom & get_lata_name() const
Schema_Temps_IJK_base & schema_temps_ijk()
const Domaine_IJK & get_domaine() const
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 Remaillage_FT_IJK & get_remaillage_ft_ijk() const
IJK_Interfaces & get_interface()
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base)&ref_champ) const override
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.
bool iterateTimeStep_impl(Probleme_base &pb, bool &converged)
classe Probleme_base C'est un Probleme_U qui n'est pas un couplage.
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