16#include <IJK_Composantes_Connex.h>
17#include <Probleme_FTD_IJK.h>
18#include <IJK_Interfaces.h>
19#include <IJK_Bubble_tools.h>
23static int decoder_numero_bulle(
const int code)
25 const int num_bulle = code >> 6;
50 const int& allocate_compo_fields)
109 const int& fill_rising_velocities,
110 const int& use_bubbles_velocities_from_interface,
111 const int& use_bubbles_velocities_from_barycentres)
132 statistics().create_custom_counter(
"Compo Connex - Bounding Box",3,
"FrontTracking");
133 statistics().begin_count(
"Compo Connex - Bounding Box",statistics().get_last_opened_counter_level()+1);
162 statistics().end_count(
"Compo Connex - Bounding Box");
167 statistics().create_custom_counter(
"Compo Connex - From interface",3,
"FrontTracking");
168 statistics().begin_count(
"Compo Connex - From interface",statistics().get_last_opened_counter_level()+1);
183 ArrOfInt elems_valid;
184 for (
int k=0; k < nz ; k++)
185 for (
int j=0; j< ny; j++)
186 for (
int i=0; i < nx; i++)
191 int elems_valid_size = elems_valid.
size_array();
192 while (elems_valid_size > 0)
194 ArrOfInt elems_valid_copy = elems_valid;
196 for (
int elem=0; elem<elems_valid_copy.
size_array(); elem++)
199 const int i = num_elem_ijk[DIRECTION_I];
200 const int j = num_elem_ijk[DIRECTION_J];
201 const int k = num_elem_ijk[DIRECTION_K];
204 for (
int l = 0; l < 6; l++)
206 const int ii = NEIGHBOURS_I[l];
207 const int jj = NEIGHBOURS_J[l];
208 const int kk = NEIGHBOURS_K[l];
209 if((i + ii < 0 || j + jj < 0 || k + kk < 0) || (i + ii >= nx || j + jj >= ny || k + kk >= nz))
212 const double indic_neighbour =
interfaces_->In()(i + ii,j + jj,k + kk);
213 if (num == -1 && indic_neighbour < VAPOUR_INDICATOR_TEST)
228 statistics().end_count(
"Compo Connex - From interface");
233 statistics().create_custom_counter(
"Fill Compo connex",3,
"FrontTracking");
234 statistics().begin_count(
"Fill Compo connex",statistics().get_last_opened_counter_level()+1);
241 const Domaine_IJK& splitting_ft = ref_ijk_ft_->get_domaine_ft();
244 const ArrOfInt& index_elem = intersections.
index_elem();
251 ArrOfInt compo_per_cell;
252 ArrOfInt compo_ghost_per_cell;
253 ArrOfInt count_compo_per_cell;
254 ArrOfInt count_compo_ghost_per_cell;
255 int counter, counter_ghost;
259 const int nbulles_reelles =
interfaces_->get_nb_bulles_reelles();
261 for (
int elem = 0; elem < nb_elem; elem++)
263 int index = index_elem[elem];
264 compo_per_cell.
reset();
265 compo_ghost_per_cell.
reset();
266 count_compo_per_cell.
reset();
267 count_compo_ghost_per_cell.
reset();
274 const int compo_facet = compo_facettes[num_facette];
275 const int compo_size_array = compo_per_cell.
size_array();
276 const int compo_ghost_size_array = compo_ghost_per_cell.
size_array();
281 compo_real = decoder_numero_bulle(-compo_facet);
282 compo_ghost = compo_real + nbulles_reelles;
286 compo_real = compo_facet;
287 compo_ghost = compo_facet;
291 for (l=0; l<compo_size_array; l++)
293 if (compo_real == compo_per_cell(l))
295 count_compo_per_cell(l) += 1;
300 for (l=0; l<compo_ghost_size_array; l++)
302 if (compo_ghost == compo_ghost_per_cell(l))
304 count_compo_ghost_per_cell(l) += 1;
309 if (counter == compo_size_array)
315 if (counter_ghost == compo_ghost_size_array)
324 const int n_ghost = compo_ghost_per_cell.
size_array();
327 std::vector<int> indices(n);
328 for (
int j=0; j<n; j++)
330 std::sort(indices.begin(), indices.end(), [&count_compo_per_cell](
int i,
int j) {return count_compo_per_cell[i] < count_compo_per_cell[j];});
331 const int max_compo_per_cell = compo_per_cell(indices[n-1]);
337 std::vector<int> indices(n);
338 for (
int j=0; j<n; j++)
340 std::sort(indices.begin(), indices.end(), [&count_compo_ghost_per_cell](
int i,
int j) {return count_compo_ghost_per_cell[i] < count_compo_ghost_per_cell[j];});
341 const int max_compo_ghost_per_cell = compo_ghost_per_cell(indices[n-1]);
360 for (
int k=0; k < nz ; k++)
361 for (
int j=0; j< ny; j++)
362 for (
int i=0; i < nx; i++)
373 statistics().end_count(
"Fill Compo connex");
378 statistics().create_custom_counter(
"Compute and fill rising velocity",3,
"FrontTracking");
379 statistics().begin_count(
"Compute and fill rising velocity",statistics().get_last_opened_counter_level()+1);
383 const DoubleTab& bubbles_velocities_from_interface =
interfaces_->get_bubble_velocities_from_interface();
384 const DoubleTab& bubbles_velocities_from_barycentres =
interfaces_->get_bubble_velocities_from_barycentres();
385 int nb_bubbles = ref_ijk_ft_->get_interface().get_nb_bulles_reelles();
390 if (bubbles_velocities_from_interface.
size() == 0)
391 use_bubbles_velocities_from_interface_tmp = 0;
394 if (ref_ijk_ft_->schema_temps_ijk().get_tstep() == 0)
395 use_bubbles_velocities_from_barycentres_tmp = 0;
397 compute_rising_velocity(ref_ijk_ft_->eq_ns().get_velocity(),
398 ref_ijk_ft_->get_interface(),
400 ref_ijk_ft_->milieu_ijk().get_direction_gravite(),
404 bubbles_velocities_from_interface,
405 use_bubbles_velocities_from_interface_tmp,
406 bubbles_velocities_from_barycentres,
407 use_bubbles_velocities_from_barycentres_tmp);
409 compute_rising_velocity_overall(ref_ijk_ft_->get_interface(),
414 bubbles_velocities_from_interface,
415 use_bubbles_velocities_from_interface_tmp,
416 bubbles_velocities_from_barycentres,
417 use_bubbles_velocities_from_barycentres_tmp);
426 Cerr <<
"Don't compute the ghost temperature field" << finl;
428 statistics().end_count(
"Compute and fill rising velocity");
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
int convert_ijk_cell_to_packed(const FixedVector< int, 3 > ijk) const
Converts the ijk index of an element to a cell index.
FixedVector< int, 3 > convert_packed_to_ijk_cell(int index) const
Convert the local index of an element to a vector with IJK indices.
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
const Domaine & domaine() const
Class defining operators and methods for all reading operation in an input flow (file,...
IJK_Field_double eulerian_compo_connex_from_interface_ghost_ft_
Vecteur3 rising_velocity_overall_
IJK_Field_double eulerian_compo_connex_ft_
IJK_Field_int eulerian_compo_connex_from_interface_int_ns_
void compute_compo_connex_from_interface()
int compute_compo_fields_
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)
IJK_Field_double eulerian_compo_connex_from_interface_ghost_ns_
int use_bubbles_velocities_from_interface_
int use_bubbles_velocities_from_barycentres_
DoubleTab min_max_larger_box_
void initialize(IJK_Interfaces &interfaces, const bool is_switch)
DoubleTab rising_vectors_
Vecteur3 liquid_velocity_
DoubleTab bubbles_barycentre_
void associer(const Probleme_FTD_IJK_base &ijk_ft)
int compute_rising_velocities_
void compute_bounding_box_fill_compo_connex()
IJK_Interfaces * interfaces_
IJK_Field_double eulerian_compo_connex_from_interface_ns_
int compute_from_bounding_box_
ArrOfDouble bubbles_volume_
IJK_Field_double eulerian_compo_connex_ghost_ft_
void fill_mixed_cell_compo()
void compute_rising_velocities()
IJK_Field_double eulerian_compo_connex_ghost_ns_
IJK_Field_int eulerian_compo_connex_valid_compo_field_
int fill_rising_velocities_
IJK_Field_double eulerian_rising_velocities_
void allocate_fields(const Domaine_IJK &splitting, const int &compute_compo_fields)
IJK_Field_int eulerian_compo_connex_from_interface_ghost_int_ns_
ArrOfDouble rising_velocities_
void initialise_bubbles_params()
IJK_Field_double eulerian_compo_connex_ns_
IJK_Field_double eulerian_compo_connex_from_interface_ft_
int index_facette_suivante_
: class Intersections_Elem_Facettes
const ArrOfInt & index_elem() const
Renvoie un tableau de taille domaine.
const Intersections_Elem_Facettes_Data & data_intersection(int index) const
Renvoie les donnees de l'intersection stockee a l'indice "index" dans le tableau "data" ( 0 <= index ...
const Intersections_Elem_Facettes & intersections_elem_facettes() const
const ArrOfInt & compo_connexe_facettes() const
classe Objet_U Cette classe est la classe de base des Objets de TRUST
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
static int nproc()
renvoie le nombre de processeurs dans le groupe courant Voir Comm_Group::nproc() et PE_Groups::curren...
Classe de base des flux de sortie.
void append_array(_TYPE_ valeur)
_SIZE_ size_array() const