16#include <Intersection_Interface_ijk.h>
17#include <IJK_Navier_Stokes_tools.h>
18#include <IJK_Interfaces.h>
45 posit_proj += bary_vap;
55 distance = std::sqrt(distance);
66 Vecteur3 interface_to_point = point_2 - point_1;
76 double norm_normale = 0.;
77 for (
int c = 0; c < 3; c++)
79 norm_normale += std::pow(normal_on_interf[c], 2.);
81 norm_normale = std::pow(norm_normale, 0.5);
84 for (
int c = 0; c < 3; c++)
86 positions[c] = position_on_interf[c] + dist * normal_on_interf[c] / norm_normale;
92 const DoubleTab& position_on_interf,
const DoubleTab& normal_on_interf,
93 const double dist, DoubleTab& positions)
95 const int n_size = position_on_interf.
dimension(0);
96 positions.
resize(n_size, 3);
98 for (
int i_diph = 0; i_diph < n_size; i_diph++)
100 double norm_normale = 0.;
101 for (
int c = 0; c < 3; c++)
102 norm_normale += std::pow(normal_on_interf(i_diph, c), 2.);
103 norm_normale = std::pow(norm_normale, 0.5);
104 for (
int c = 0; c < 3; c++)
109 positions(i_diph, c) = position_on_interf(i_diph, c) +
110 dist * normal_on_interf(i_diph, c) / norm_normale;
118 Int3 ijk =
splitting_->convert_packed_to_ijk_cell(elem);
122 for (
int c=0; c < 3; c++)
124 if (std::abs(normale[c]) > EPS_)
128 Cerr <<
"Attention, il y a un decalage entre l'indicatrice et les valeurs moyennes calculee dans la cellule" << finl;
163 const int i,
const int j,
const int k,
const int dir,
168 const int elem0 =
splitting_->convert_ijk_cell_to_packed(i, j, k);
173 assert((dir >= 0) && (dir < 3));
175 elem1 =
splitting_->convert_ijk_cell_to_packed(i - 1, j, k);
177 elem1 =
splitting_->convert_ijk_cell_to_packed(i, j - 1, k);
179 elem1 =
splitting_->convert_ijk_cell_to_packed(i, j, k - 1);
190 bary = bary_facettes_dans_elem0;
191 bary += bary_facettes_dans_elem1;
196 DoubleTab& positions,
198 DoubleTab& normales_de_la_proj,
199 DoubleTab& distance_barys_interface
202 const auto& surfaces =
interfaces_->get_surface_vapeur_par_face();
203 const auto& barys =
interfaces_->get_barycentre_vapeur_par_face();
204 const int ni = surfaces[0].ni();
205 const int nj = surfaces[0].nj();
206 const int nk = surfaces[0].nk();
207 const double eps = 1.e-6;
217 for (
int dir = 0; dir < 3; dir++)
219 double surf_cell = 1.;
220 for (
int c = 0; c < 3; c++)
224 surf_cell *=
splitting_->get_constant_delta(c);
227 for (
int i = 0; i < ni; i++)
228 for (
int j = 0; j < nj; j++)
229 for (
int k = 0; k < nk; k++)
233 surf_vap = surfaces[dir](i, j, k);
234 if ((surf_vap/surf_cell > 0.) and (surf_vap/surf_cell < 1.))
235 Cerr <<
"frac surf vap " << surf_vap / surf_cell << finl;
236 if ((surf_vap > eps * surf_cell) and (surf_vap < (1. - eps) * surf_cell))
242 surf_liqu = surf_cell - surf_vap;
246 assert(surf_liqu > 0.);
257 for (
int c = 0; c < 3; c++)
259 normales_de_la_proj(i_diph, c) = normale[c];
260 normales_de_la_proj(i_diph + 1, c) = normale[c];
267 for (
int phase = 1; phase > 0; phase--)
269 indices(i_diph, 0) = i;
270 indices(i_diph, 1) = j;
271 indices(i_diph, 2) = k;
272 indices(i_diph, 3) = dir;
273 indices(i_diph, 4) = phase;
279 barys[0][dir](i, j, k), barys[1][dir](i, j, k),
280 barys[2][dir](i, j, k)
291 Vecteur3 bary_liqu = bary_face - bary_vap;
292 bary_liqu *= (surf_vap / surf_liqu);
293 bary_liqu += bary_face;
296 for (
int c = 0; c < 3; c++)
297 positions(i_diph, c) = position[c];
300 for (
int c = 0; c < 3; c++)
301 positions(i_diph + 1, c) = position[c];
310 Cerr <<
"Aucune face coupee rencontree" << finl;
359 const IJK_Field_double& indicatrice,
360 DoubleTab& positions,
362 DoubleTab& normales_de_la_proj,
363 DoubleTab& distance_centre_interface)
367 const int ni = indicatrice.
ni();
368 const int nj = indicatrice.
nj();
369 const int nk = indicatrice.
nk();
374 Vecteur3 normale_interf {0., 0., .0};
380 for (
int i = 0; i < ni; i++)
381 for (
int j = 0; j < nj; j++)
382 for (
int k = 0; k < nk; k++)
384 if (fabs(indicatrice(i, j, k)) > VAPOUR_INDICATOR_TEST && fabs(indicatrice(i, j, k)) < LIQUID_INDICATOR_TEST)
392 for (
int i = 0; i < ni; i++)
393 for (
int j = 0; j < nj; j++)
394 for (
int k = 0; k < nk; k++)
397 if (fabs(indicatrice(i, j, k)) > VAPOUR_INDICATOR_TEST && fabs(indicatrice(i, j, k)) < LIQUID_INDICATOR_TEST)
403 const int elem =
splitting_->convert_ijk_cell_to_packed(i, j, k);
407 for (
int c = 0; c < 3; c++)
408 normales_de_la_proj(i_diph, c) = normale_interf[c];
414 indices(i_diph, 0) = i;
415 indices(i_diph, 1) = j;
416 indices(i_diph, 2) = k;
423 for (
int c = 0; c < 3; c++)
424 positions(i_diph, c) = position[c];
434 const IntTab& indices,
435 const DoubleTab& normales_interf,
436 DoubleTab& positions,
437 IntTab& indices_voisins,
439 DoubleTab& distance_centre_faces_interface)
const
442 Vecteur3 normale_interf {0., 0., .0};
446 positions.
resize(nb_diph, 3, 6);
447 indices_voisins.
resize(nb_diph, 6);
448 distance_centre_faces_interface.
resize(nb_diph, 6);
450 int nb_faces_to_correct = 0.;
451 for (
int i_diph=0; i_diph<nb_diph ; i_diph++)
453 const int i = indices(i_diph, 0);
454 const int j = indices(i_diph, 1);
455 const int k = indices(i_diph, 2);
461 const int elem =
splitting_->convert_ijk_cell_to_packed(i, j, k);
463 for (
int l=0; l<6; l++)
465 const int ii = NEIGHBOURS_I[l];
466 const int jj = NEIGHBOURS_J[l];
467 const int kk = NEIGHBOURS_K[l];
468 const int ii_f = NEIGHBOURS_FACES_I[l];
469 const int jj_f = NEIGHBOURS_FACES_J[l];
470 const int kk_f = NEIGHBOURS_FACES_K[l];
471 indices_voisins(i_diph, l) = 0;
475 if (fabs(indicatrice(i+ii, j+jj, k+kk)) > LIQUID_INDICATOR_TEST)
477 indices_voisins(i_diph, l) = l+1;
478 nb_faces_to_correct++;
485 const double nx = normales_interf(i_diph, 0);
486 const double ny = normales_interf(i_diph, 1);
487 const double nz = normales_interf(i_diph, 2);
488 normale_interf = {nx, ny, nz};
490 for (
int c = 0; c < 3; c++)
491 positions(i_diph, c, l) = position[c];
496 for (
int dir=0; dir<3; dir++)
497 indices_faces_corrections[dir].resize(nb_faces_to_correct);
506 int nb_faces_to_correct = 0.;
507 for (
int i_diph=0; i_diph<nb_diph ; i_diph++)
512 for (
int l=0; l<6; l++)
514 const int ii_f = NEIGHBOURS_FACES_I[l];
515 const int jj_f = NEIGHBOURS_FACES_J[l];
516 const int kk_f = NEIGHBOURS_FACES_K[l];
522 i_pure_face_to_correct[nb_faces_to_correct] = (i + ii_f);
523 j_pure_face_to_correct[nb_faces_to_correct] = (j + jj_f);
524 k_pure_face_to_correct[nb_faces_to_correct] = (k + kk_f);
525 nb_faces_to_correct++;
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
Class defining operators and methods for all reading operation in an input flow (file,...
DoubleTab dist_pure_faces_to_interf_
void update_interpolations_cell_faces_on_interface()
void update_interpolations_cell_centres_on_interface()
FixedVector< DoubleVect, 3 > ijk_pure_face_to_correct_
void calcul_projection_centre_faces_sur_interface_moy(const IJK_Field_double &indicatrice, const IntTab &indices, const DoubleTab &normale_interf, DoubleTab &positions, IntTab &indices_voisins, FixedVector< DoubleVect, 3 > &indices_faces_corrections, DoubleTab &distance_centre_faces_interface) const
void update_interpolations_cell_centres_on_interface_new()
void compute_face_to_correct()
void calcul_projection_centre_sur_interface_moy(const IJK_Field_double &indicatrice, DoubleTab &positions, IntTab &indices, DoubleTab &normales_de_la_proj, DoubleTab &distance_centre_interface)
void update_interpolations_cell_faces_on_interface_new()
IntTab ijk_pure_face_neighbours_
DoubleTab positions_pure_faces_on_interf_
bool face_centres_projected_on_interface_flag_
int initialize(const Domaine_IJK &splitting, const IJK_Interfaces &interfaces) override
void compute_mean_interface_face(const int i, const int j, const int k, const int dir, Vecteur3 &normale, Vecteur3 &bary) const
void calcul_projection_bary_face_mouillee_interface_moy(DoubleTab &positions, IntTab &indices, DoubleTab &normales_de_la_proj, DoubleTab &distance_barys_interface)
void maj_interpolation_coo_on_interfaces()
int initialize(const Domaine_IJK &splitting, const IJK_Interfaces &interfaces) override
IJK_Field_vector3_int idiph_ijk_
const IJK_Interfaces * interfaces_
DoubleTab positions_on_interf_
void get_mean_interface_cell(const int elem, Vecteur3 &normale, Vecteur3 &bary) const
static void distance_point_point_signe(const Vecteur3 &point_1, const Vecteur3 &point_2, const Vecteur3 &normal_interf, double &distance)
DoubleTab dist_to_interf_
DoubleTab normal_on_interf_
static Vecteur3 get_position_interpolation_normal_interf(const Vecteur3 &position_on_interf, const Vecteur3 &normal_on_interf, const double dist)
bool projected_on_interface_flag_
const Domaine_IJK * splitting_
static void projete_interface(const Vecteur3 &normale, const Vecteur3 &point_plan, const Vecteur3 &coo, Vecteur3 &posit_proj)
static void distance_point_point(const Vecteur3 &point_1, const Vecteur3 &point_2, double &distance)
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 void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Classe de base des flux de sortie.
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
_SIZE_ dimension(int d) const
static double produit_scalaire(const Vecteur3 &x, const Vecteur3 &y)