TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Probleme_FTD_IJK_cut_cell.cpp
1/****************************************************************************
2* Copyright (c) 2025, 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 <Schema_Euler_explicite_IJK.h>
17#include <Probleme_FTD_IJK_cut_cell.h>
18#include <Navier_Stokes_FTD_IJK.h>
19#include <Schema_RK3_IJK.h>
20#include <Cut_cell_tools.h>
21
22Implemente_instanciable(Probleme_FTD_IJK_cut_cell, "Probleme_FTD_IJK_cut_cell", Probleme_FTD_IJK_base);
23// XD Probleme_FTD_IJK_cut_cell probleme_ftd_ijk Probleme_FTD_IJK_cut_cell INHERITS_BRACE not_set
24
25Sortie& Probleme_FTD_IJK_cut_cell::printOn(Sortie& os) const { return os; }
26
28{
30
31 // Determination pour le seuil des petites cellules en cut-cell
33 seuil_indicatrice_petite_facsec_ = 0.125; // Default value = facsec/8. -- Note: The value facsec/20. = 0.01 would often work but not always be stable
34
35 double seuil_indicatrice_petite;
38 else
39 seuil_indicatrice_petite = seuil_indicatrice_petite_fixe_;
40 get_interface().set_seuil_indicatrice_petite(seuil_indicatrice_petite);
41 Cerr << "Le seuil pour l'indicatrice des petites cellules est : " << seuil_indicatrice_petite << finl;
42
43 return is;
44}
45
47{
49
50 /*
51 * TODO FIXME : All these should be placed in the equations set_param ....
52 */
53
54 param.ajouter("seuil_indicatrice_petite_fixe", &seuil_indicatrice_petite_fixe_);
55 param.ajouter("seuil_indicatrice_petite_facsec", &seuil_indicatrice_petite_facsec_);
56
57 param.ajouter("type_surface_efficace_face", (int*)&type_surface_efficace_face_);
58 param.dictionnaire("non_initialise",(int)TYPE_SURFACE_EFFICACE_FACE::NON_INITIALISE);
59 param.dictionnaire("explicite",(int)TYPE_SURFACE_EFFICACE_FACE::EXPLICITE);
60 param.dictionnaire("algebrique_simple",(int)TYPE_SURFACE_EFFICACE_FACE::ALGEBRIQUE_SIMPLE);
61 param.dictionnaire("conservation_volume_iteratif", (int)TYPE_SURFACE_EFFICACE_FACE::CONSERVATION_VOLUME_ITERATIF);
62 param.ajouter("type_surface_efficace_interface", (int*)&type_surface_efficace_interface_);
63 param.dictionnaire("non_initialise",(int)TYPE_SURFACE_EFFICACE_INTERFACE::NON_INITIALISE);
64 param.dictionnaire("explicite",(int)TYPE_SURFACE_EFFICACE_INTERFACE::EXPLICITE);
65 param.dictionnaire("algebrique_simple",(int)TYPE_SURFACE_EFFICACE_INTERFACE::ALGEBRIQUE_SIMPLE);
66 param.dictionnaire("conservation_volume", (int)TYPE_SURFACE_EFFICACE_INTERFACE::CONSERVATION_VOLUME);
67
68 param.ajouter("facettes_interpolation", &cut_cell_facettes_interpolation_);
69}
70
72{
73 Cerr << "Probleme_FTD_IJK_cut_cell::initialize()" << finl;
74 IJK_Interfaces& interf = get_interface();
75
76 // Activation des champs cut-cell de post_ et interfaces_ (obligatoirement avant l'initialisation)
77 cut_cell_disc_.initialise(interf, domaine_ijk_.valeur(), Domaine_IJK::ELEM);
79 interf.activate_cut_cell();
80
82
83 domaine_ijk_->get_local_mesh_delta(DIRECTION_K, 2 /* ghost cells */, delta_z_local_);
84
86 if (has_thermals_)
87 {
88 IJK_Thermals& thermals = get_ijk_thermals();
91 }
92
93 // TODO : FIXME : faut boucler plus tard sur les equations IJK
94 Navier_Stokes_FTD_IJK& eq_ns = ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur());
95 const auto& bc = eq_ns.get_boundary_conditions();
96
97 Cut_field_vector3_double& cut_field_velocity = static_cast<Cut_field_vector3_double&>(eq_ns.get_velocity());
99 {
100 allocate_velocity_persistant(cut_cell_disc_, cut_field_velocity, domaine_ijk_.valeur(), 2, bc.get_dU_perio(bc.get_resolution_u_prime_()));
101 }
102 else
103 allocate_velocity_persistant(cut_cell_disc_, cut_field_velocity, domaine_ijk_.valeur(), thermal_probes_ghost_cells_);
104
105 // Naming the main unknown:
106 const std::string nam_compo[3] = {"X", "Y", "Z"};
107 for (int i=0; i<3; i++)
108 cut_field_velocity[i].nommer(Nom("VELOCITY_") + Nom(nam_compo[i]));
109
111}
112
113const Cut_field_vector3_double& Probleme_FTD_IJK_cut_cell::get_cut_field_velocity() const
114{
115 return static_cast<const Cut_field_vector3_double&>(ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur()).get_velocity());
116}
117
119{
120 // La suppression des cellules mortes est vraiment au tout dernier moment,
121 // pour laisser la possibilite d'utiliser ces cellules lors des bilans
122 // pour determiner l'indicatrice cible du remaillage.
123 cut_cell_disc_.remove_dead_and_virtual_cells(get_interface().In());
124
126}
127
129{
130 for(int i=0; i<2; i++)
131 {
134 }
135 IJK_Interfaces& interf = get_interface();
136
137 // Mise a jour des structures cut-cell
138 cut_cell_disc_.update(interf.I(), interf.In());
139
140 // Mise a jour des indices et coefficients des points d'interpolation a une certaine distance des facettes de l'interface
142
143 // Calcul pour le temps old() egalement, de telle maniere a ce que les coefficients next() et old() sont initialises
144 cut_cell_facettes_interpolation_.cut_cell_perform_interpolation_facettes_old(interf.old());
145
146 Cut_field_vector3_double& cut_field_velocity = static_cast<Cut_field_vector3_double&>(ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur()).get_velocity());
147 cut_field_velocity[0].copie_pure_vers_diph_sans_interpolation();
148 cut_field_velocity[1].copie_pure_vers_diph_sans_interpolation();
149 cut_field_velocity[2].copie_pure_vers_diph_sans_interpolation();
150}
151
152void Probleme_FTD_IJK_cut_cell::deplacer_interfaces(const double timestep, const int rk_step,
153 ArrOfDouble& var_volume_par_bulle,
154 const int first_step_interface_smoothing)
155{
156 Cut_field_vector3_double& cut_field_velocity = static_cast<Cut_field_vector3_double&>(ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur()).get_velocity());
157 IJK_Interfaces& interf = get_interface();
158
159 if (has_thermals_)
160 {
161 IJK_Thermals& thermals = get_ijk_thermals();
164 }
165 update_old_intersections(); // Pour conserver les donnees sur l'interface au temps t_{n} (en plus de t_{n+1})
166
167 cut_field_velocity[0].copie_pure_vers_diph_sans_interpolation();
168 cut_field_velocity[1].copie_pure_vers_diph_sans_interpolation();
169 cut_field_velocity[2].copie_pure_vers_diph_sans_interpolation();
170
171 Probleme_FTD_IJK_base::deplacer_interfaces(timestep, rk_step, var_volume_par_bulle, first_step_interface_smoothing);
172
173 // Mise a jour des structures cut-cell
174 cut_cell_disc_.update(interf.I(), interf.In());
175
176 // Mise a jour des indices et coefficients des points d'interpolation a une certaine distance des facettes de l'interface
178
179 if (has_thermals_)
181
182 cut_field_velocity[0].copie_pure_vers_diph_sans_interpolation();
183 cut_field_velocity[1].copie_pure_vers_diph_sans_interpolation();
184 cut_field_velocity[2].copie_pure_vers_diph_sans_interpolation();
185
188
189 interf.calcul_surface_efficace_face(type_surface_efficace_face_, schema_temps_ijk().get_timestep(), cut_field_velocity);
190 interf.calcul_surface_efficace_interface(type_surface_efficace_interface_, schema_temps_ijk().get_timestep(), cut_field_velocity);
191
194}
195
196void Probleme_FTD_IJK_cut_cell::deplacer_interfaces_rk3(const double timestep, const int rk_step,
197 ArrOfDouble& var_volume_par_bulle)
198{
199 Cut_field_vector3_double& cut_field_velocity = static_cast<Cut_field_vector3_double&>(ref_cast(Navier_Stokes_FTD_IJK, equations_.front().valeur()).get_velocity());
200 IJK_Interfaces& interf = get_interface();
201
202 if (has_thermals_)
203 {
204 IJK_Thermals& thermals = get_ijk_thermals();
207 }
208 update_old_intersections(); // Pour conserver les donnees sur l'interface au temps t_{n} (en plus de t_{n+1})
209
210 cut_field_velocity[0].copie_pure_vers_diph_sans_interpolation();
211 cut_field_velocity[1].copie_pure_vers_diph_sans_interpolation();
212 cut_field_velocity[2].copie_pure_vers_diph_sans_interpolation();
213
214 Probleme_FTD_IJK_base::deplacer_interfaces_rk3(timestep, rk_step, var_volume_par_bulle);
215
216 // Mise a jour des structures cut-cell
217 cut_cell_disc_.update(interf.I(), interf.In());
218
219 // Mise a jour des indices et coefficients des points d'interpolation a une certaine distance des facettes de l'interface
221
222 if (has_thermals_)
224
225 cut_field_velocity[0].copie_pure_vers_diph_sans_interpolation();
226 cut_field_velocity[1].copie_pure_vers_diph_sans_interpolation();
227 cut_field_velocity[2].copie_pure_vers_diph_sans_interpolation();
228
231
232 const double fractionnal_timestep = compute_fractionnal_timestep_rk3(timestep, ref_cast(Schema_RK3_IJK, schema_temps_ijk()).get_rk_step());
233
234 interf.calcul_surface_efficace_face(type_surface_efficace_face_, fractionnal_timestep, cut_field_velocity);
235 interf.calcul_surface_efficace_interface(type_surface_efficace_interface_, fractionnal_timestep, cut_field_velocity);
236
239}
240
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
: class IJK_Interfaces
const IJK_Field_double & I() const
int old() const
void set_seuil_indicatrice_petite(double seuil_indicatrice_petite)
const IJK_Field_double & In() const
void calcul_surface_efficace_face_initial(TYPE_SURFACE_EFFICACE_FACE type_surface_efficace_face)
void calcul_surface_efficace_interface_initial(TYPE_SURFACE_EFFICACE_INTERFACE type_surface_efficace_interface)
void calcul_surface_efficace_face(TYPE_SURFACE_EFFICACE_FACE type_surface_efficace_face, double timestep, const Cut_field_vector3_double &total_velocity)
const Maillage_FT_IJK & old_maillage_ft_ijk() const
const Maillage_FT_IJK & maillage_ft_ijk() const
int get_dt_impression_bilan_indicatrice() const
void calcul_surface_efficace_interface(TYPE_SURFACE_EFFICACE_INTERFACE type_surface_efficace_interface, double timestep, const Cut_field_vector3_double &velocity)
void imprime_bilan_indicatrice()
void compute_ghost_cell_numbers_for_subproblems(const Domaine_IJK &splitting, int ghost_init)
void vide_phase_invalide_cellules_diphasiques()
void echange_diph_vers_pure_cellules_finalement_pures()
void echange_pure_vers_diph_cellules_initialement_pures()
int get_probes_ghost_cells(int ghost_init)
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void dictionnaire(const char *option_name, int value)
Add an (option name, integer value) entry to the dictionary attached to a previously registered integ...
Definition Param.cpp:293
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
virtual void set_param(Param &param) const override
const IJK_Interfaces & get_interface() const
const Schema_Temps_IJK_base & schema_temps_ijk() const
const Postprocessing_IJK & get_post() const
virtual void deplacer_interfaces_rk3(const double timestep, const int rk_step, ArrOfDouble &var_volume_par_bulle)
ArrOfDouble_with_ghost delta_z_local_
void initialize() override
This method is called once at the beginning, before any other one of the interface Problem.
const Navier_Stokes_FTD_IJK & eq_ns() const
virtual void deplacer_interfaces(const double timestep, const int rk_step, ArrOfDouble &var_volume_par_bulle, const int first_step_interface_smoothing)
const IJK_Thermals & get_ijk_thermals() const
void deplacer_interfaces_rk3(const double timestep, const int rk_step, ArrOfDouble &var_volume_par_bulle) override
void set_param(Param &param) const override
const Cut_field_vector3_double & get_cut_field_velocity() const
void deplacer_interfaces(const double timestep, const int rk_step, ArrOfDouble &var_volume_par_bulle, const int first_step_interface_smoothing) override
TYPE_SURFACE_EFFICACE_INTERFACE type_surface_efficace_interface_
TYPE_SURFACE_EFFICACE_FACE type_surface_efficace_face_
Facettes_Interp_FT cut_cell_facettes_interpolation_
void initialize() override
This method is called once at the beginning, before any other one of the interface Problem.
void nommer(const Nom &name) override
Donne un nom a l'Objet_U Methode virtuelle a surcharger.
Definition Probleme_U.h:108
Classe de base des flux de sortie.
Definition Sortie.h:52