TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
IJK_One_Dimensional_Subproblem.cpp
1/****************************************************************************
2* Copyright (c) 2023, 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 <IJK_One_Dimensional_Subproblem.h>
17#include <IJK_Field_vector.h>
18#include <IJK_Navier_Stokes_tools.h>
19#include <Ouvrir_fichier.h>
20#include <Probleme_FTD_IJK.h>
21#include <IJK_Thermal_base.h>
22#include <IJK_Thermal_Subresolution.h>
23#include <IJK_One_Dimensional_Subproblems.h>
24
25#define selectxy(a,x,y) ((a==0)?(x):(y))
26Implemente_instanciable_sans_constructeur( IJK_One_Dimensional_Subproblem, "IJK_One_Dimensional_Subproblem", Objet_U ) ;
27
29
31{
32 associer(ijk_ft);
33}
34
36{
37 Objet_U::printOn( os );
38 return os;
39}
40
42{
43 Objet_U::readOn( is );
44 return is;
45}
46
47static int compute_periodic_index(const int index, const int n)
48{
49 return (n + index % n) % n;
50}
51
52void IJK_One_Dimensional_Subproblem::get_ijk_indices(int& i, int& j, int& k) const
53{
54 i = (int) index_i_;
55 j = (int) index_j_;
56 k = (int) index_k_;
57}
58
60{
62 vect *= 0.;
63}
64
65/*
66 * TODO: Remplacer cette methode pour eviter de fournir tous les attributs
67 */
69 IJK_One_Dimensional_Subproblems& ref_one_dimensional_subproblems,
70 int i, int j, int k,
71 int init,
72 int sub_problem_index,
73 double global_time_step,
74 double current_time,
75 int compo_connex,
76 double distance,
77 double curvature,
78 double interfacial_area,
79 ArrOfDouble facet_barycentre,
80 ArrOfDouble normal_vector,
81 double bubble_rising_velocity,
82 ArrOfDouble bubble_rising_vector,
83 ArrOfDouble bubble_barycentre,
84 const double& indicator,
85 const IJK_Interfaces& interfaces,
86 const IJK_Field_vector3_double& velocity,
87 const IJK_Field_vector3_double& velocity_ft,
88 const IJK_Field_double& pressure)
89{
90 /*
91 * Should not change over iterations
92 */
93 init_ = init;
94 sub_problem_index_ = sub_problem_index;
95
96 if (init_)
97 {
99 ref_thermal_subresolution.debug_,
100 ref_thermal_subresolution.n_iter_distance_,
101 ref_thermal_subresolution.delta_T_subcooled_overheated_,
102 ref_thermal_subresolution.pre_initialise_thermal_subproblems_list_,
103 ref_thermal_subresolution.use_sparse_matrix_,
104 ref_thermal_subresolution.compute_normal_derivatives_on_reference_probes_,
105 ref_thermal_subresolution.latastep_reprise_ini_);
108 ref_thermal_subresolution.eulerian_distance_ns_,
109 ref_thermal_subresolution.eulerian_curvature_ns_,
110 ref_thermal_subresolution.eulerian_interfacial_area_ns_,
111 ref_thermal_subresolution.eulerian_normal_vectors_ns_,
112 ref_thermal_subresolution.eulerian_facets_barycentre_ns_,
113 *ref_thermal_subresolution.temperature_,
114 ref_thermal_subresolution.temperature_ft_,
115 ref_thermal_subresolution.temperature_before_extrapolation_,
116 velocity,
117 velocity_ft,
118 pressure,
119 ref_thermal_subresolution.grad_T_elem_,
120 ref_thermal_subresolution.grad_T_elem_smooth_,
121 ref_thermal_subresolution.hess_diag_T_elem_,
122 ref_thermal_subresolution.hess_cross_T_elem_,
123 ref_thermal_subresolution.eulerian_grad_T_interface_ns_,
124 ref_thermal_subresolution.probe_collision_debug_field_,
125 ref_thermal_subresolution.zero_liquid_neighbours_,
126 ref_thermal_subresolution.smooth_grad_T_elem_);
128 ref_thermal_subresolution.cp_liquid_,
129 ref_thermal_subresolution.uniform_alpha_,
130 ref_thermal_subresolution.uniform_lambda_,
131 ref_thermal_subresolution.prandtl_number_,
132 ref_thermal_subresolution.coeff_distance_diagonal_,
133 ref_thermal_subresolution.cell_diagonal_,
134 ref_thermal_subresolution.dr_,
135 ref_thermal_subresolution.radial_coordinates_);
136 associate_bubble_parameters(ref_one_dimensional_subproblems.total_surface_per_bubble_,
137 ref_one_dimensional_subproblems.radius_from_surfaces_per_bubble_,
138 ref_one_dimensional_subproblems.radius_from_volumes_per_bubble_,
139 ref_one_dimensional_subproblems.delta_temperature_,
140 ref_thermal_subresolution.mean_liquid_temperature_,
141 ref_thermal_subresolution.bubbles_volume_,
142 ref_thermal_subresolution.rising_vectors_);
144 ref_thermal_subresolution.implicit_solver_from_previous_probe_field_,
145 ref_one_dimensional_subproblems.subproblem_to_ijk_indices_previous_,
146 ref_one_dimensional_subproblems.temperature_probes_previous_,
147 ref_one_dimensional_subproblems.indicator_probes_previous_,
148 ref_one_dimensional_subproblems.velocities_probes_previous_,
149 ref_one_dimensional_subproblems.normal_vector_compo_probes_previous_);
151 ref_thermal_subresolution.radial_second_order_operator_raw_,
152 ref_thermal_subresolution.radial_first_order_operator_,
153 ref_thermal_subresolution.radial_second_order_operator_,
154 ref_thermal_subresolution.identity_matrix_explicit_implicit_,
155 ref_thermal_subresolution.identity_matrix_subproblems_,
156 ref_thermal_subresolution.radial_diffusion_matrix_,
157 ref_thermal_subresolution.radial_convection_matrix_);
159 ref_thermal_subresolution.thermal_subproblems_matrix_assembly_,
160 ref_thermal_subresolution.thermal_subproblems_rhs_assembly_,
161 ref_thermal_subresolution.thermal_subproblems_temperature_solution_,
162 ref_thermal_subresolution.thermal_subproblems_temperature_solution_ini_);
164 ref_thermal_subresolution.source_terms_correction_,
165 ref_thermal_subresolution.source_terms_correction_,
166 ref_thermal_subresolution.advected_frame_of_reference_,
167 ref_thermal_subresolution.neglect_frame_of_reference_radial_advection_,
168 ref_thermal_subresolution.compute_tangential_variables_);
170 || ref_thermal_subresolution.diffusive_flux_correction_),
171 ref_thermal_subresolution.distance_cell_faces_from_lrs_,
172 ref_thermal_subresolution.interp_eulerian_,
173 ref_thermal_subresolution.use_corrected_velocity_convection_,
174 ref_thermal_subresolution.use_velocity_cartesian_grid_,
175 ref_thermal_subresolution.compute_radial_displacement_,
176 ref_thermal_subresolution.fluxes_correction_conservations_,
177 ref_thermal_subresolution.conserve_max_interfacial_fluxes_,
178 ref_thermal_subresolution.fluxes_corrections_weighting_,
179 ref_thermal_subresolution.use_normal_gradient_for_flux_corr_);
181 ref_thermal_subresolution.first_time_step_varying_probes_,
182 ref_thermal_subresolution.probe_variations_priority_,
183 ref_thermal_subresolution.disable_interpolation_in_mixed_cells_);
185 !ref_thermal_subresolution.correct_neighbours_using_probe_length_,
186 ref_thermal_subresolution.neighbours_corrected_rank_,
187 ref_thermal_subresolution.neighbours_colinearity_weighting_,
188 ref_thermal_subresolution.neighbours_distance_weighting_,
189 ref_thermal_subresolution.neighbours_colinearity_distance_weighting_,
190 ref_thermal_subresolution.neighbours_last_faces_colinearity_weighting_,
192 ref_thermal_subresolution.neighbours_last_faces_distance_weighting_,
195 ref_thermal_subresolution.find_reachable_fluxes_,
198 ref_thermal_subresolution.disable_probe_weak_gradient_gfm_);
200 ref_thermal_subresolution.enable_resize_probe_collision_,
201 ref_thermal_subresolution.debug_probe_collision_);
202
203// // TODO: If the calculation of the distance is changed in intersection_ijk, it will be useless...
205 ref_thermal_subresolution.first_time_step_temporal_,
206 ref_thermal_subresolution.first_time_step_explicit_,
207 ref_thermal_subresolution.local_fourier_,
208 ref_thermal_subresolution.local_cfl_,
209 ref_thermal_subresolution.min_delta_xyz_,
210 ref_thermal_subresolution.max_u_radial_);
212 }
213
214 /*
215 * Should be reinitialised at each time step.
216 */
219 reset_flags();
222 associate_temporal_parameters(global_time_step, current_time);
223 associate_cell_ijk(i, j, k);
224 associate_eulerian_field_values(compo_connex, indicator);
225 associate_interface_related_parameters(distance, curvature, interfacial_area, facet_barycentre, normal_vector);
226 associate_rising_velocity(bubble_rising_velocity, bubble_rising_vector, bubble_barycentre);
229 (*first_time_step_temporal_) = 0;
231}
232
257
262
272
274 const int& debug,
275 const int& n_iter_distance,
276 const double& delta_T_subcooled_overheated,
277 const int& pre_initialise_thermal_subproblems_list,
278 const int& use_sparse_matrix,
279 const int& compute_normal_derivative_on_reference_probes,
280 const int& latastep_reprise)
281{
282 reference_gfm_on_probes_ = reference_gfm_on_probes;
283 debug_ = debug;
284 n_iter_distance_ = n_iter_distance;
285 delta_T_subcooled_overheated_ = delta_T_subcooled_overheated;
286 pre_initialise_thermal_subproblems_list_ = pre_initialise_thermal_subproblems_list;
287 use_sparse_matrix_ = use_sparse_matrix;
288 compute_normal_derivative_on_reference_probes_ = compute_normal_derivative_on_reference_probes;
289 latastep_reprise_ = &latastep_reprise;
290}
291
296
298 const IJK_Field_double * eulerian_distance,
299 const IJK_Field_double * eulerian_curvature,
300 const IJK_Field_double * eulerian_interfacial_area,
301 const IJK_Field_vector3_double * eulerian_normal_vect,
302 const IJK_Field_vector3_double * eulerian_facets_barycentre,
303 const IJK_Field_double& temperature,
304 const IJK_Field_double& temperature_ft,
305 const IJK_Field_double& temperature_before_extrapolation,
306 const IJK_Field_vector3_double& velocity,
307 const IJK_Field_vector3_double& velocity_ft,
308 const IJK_Field_double& pressure,
309 const IJK_Field_vector3_double& grad_T_elem,
310 const IJK_Field_vector3_double& grad_T_elem_smooth,
311 const IJK_Field_vector3_double& hess_diag_T_elem,
312 const IJK_Field_vector3_double& hess_cross_T_elem,
313 const IJK_Field_double& eulerian_grad_T_interface_ns,
314 IJK_Field_double& probe_collision_debug_field,
315 IJK_Field_int& zero_liquid_neighbours,
316 const int& smooth_grad_T_elem)
317{
318 interfaces_ = &interfaces;
319 eulerian_distance_ = eulerian_distance;
320 eulerian_curvature_ = eulerian_curvature;
321 eulerian_interfacial_area_ = eulerian_interfacial_area;
322 eulerian_normal_vect_ = eulerian_normal_vect;
323 eulerian_facets_barycentre_ = eulerian_facets_barycentre;
324 temperature_ = &temperature ;
325 temperature_ft_ = &temperature_ft ;
326 temperature_before_extrapolation_ = &temperature_before_extrapolation;
327 velocity_ = &velocity ;
328 velocity_ft_ = &velocity_ft;
329 pressure_ = &pressure;
330 grad_T_elem_ = &grad_T_elem;
331 grad_T_elem_smooth_ = &grad_T_elem_smooth;
332 smooth_grad_T_elem_ = smooth_grad_T_elem;
334 grad_T_elem_solver_ = &grad_T_elem_smooth;
335 else
336 grad_T_elem_solver_ = &grad_T_elem;
337 hess_diag_T_elem_ = &hess_diag_T_elem;
338 hess_cross_T_elem_ = &hess_cross_T_elem;
339 eulerian_grad_T_interface_ns_ = &eulerian_grad_T_interface_ns;
340 probe_collision_debug_field_ = &probe_collision_debug_field;
341 zero_liquid_neighbours_ = &zero_liquid_neighbours;
342}
343
344void IJK_One_Dimensional_Subproblem::associate_tweaked_parameters(const int& disable_probe_weak_gradient,
345 const int& disable_probe_weak_gradient_gfm)
346{
347 disable_probe_weak_gradient_ = disable_probe_weak_gradient;
348 disable_probe_weak_gradient_gfm_ = disable_probe_weak_gradient_gfm;
351}
352
353void IJK_One_Dimensional_Subproblem::associate_collisions_parameters(const int& enable_probe_collision_detection,
354 const int& enable_resize_probe_collision,
355 const int& debug_probe_collision)
356{
357 enable_probe_collision_detection_ = enable_probe_collision_detection;
358 enable_resize_probe_collision_ = enable_resize_probe_collision;
359 debug_probe_collision_ = debug_probe_collision;
360}
361
363 bool& first_time_step_temporal,
364 const int& first_time_step_explicit,
365 const double& local_fourier,
366 const double& local_cfl,
367 const double& min_delta_xyz,
368 int max_u_radial)
369{
370 is_first_time_step_ = is_first_time_step;
371 first_time_step_temporal_ = &first_time_step_temporal;
372 first_time_step_explicit_ = first_time_step_explicit;
373 local_fourier_ = local_fourier;
374 local_cfl_ = local_cfl;
375 min_delta_xyz_ = min_delta_xyz;
376 max_u_radial_ = max_u_radial;
378}
379
380void IJK_One_Dimensional_Subproblem::associate_varying_probes_params(const int& readjust_probe_length_from_vertices,
381 const int& first_time_step_varying_probes,
382 const int& probe_variations_priority,
383 const int& disable_interpolation_in_mixed_cells)
384{
385 readjust_probe_length_from_vertices_ = readjust_probe_length_from_vertices;
386 first_time_step_varying_probes_ = first_time_step_varying_probes;
387 probe_variations_priority_ = probe_variations_priority;
388 disable_interpolation_in_mixed_cells_ = disable_interpolation_in_mixed_cells;
389}
390
392 const int& distance_cell_faces_from_lrs,
393 const int& interp_eulerian,
394 const int& use_corrected_velocity_convection,
395 const int& use_velocity_cartesian_grid,
396 const int& compute_radial_displacement,
397 const int& fluxes_correction_conservations,
398 const int& conserve_max_interfacial_fluxes,
399 const int& fluxes_corrections_weighting,
400 const int& use_normal_gradient_for_flux_corr)
401{
402 correct_fluxes_ = correct_fluxes;
403 distance_cell_faces_from_lrs_ = distance_cell_faces_from_lrs;
404 interp_eulerian_ = interp_eulerian;
405 use_corrected_velocity_convection_ = use_corrected_velocity_convection;
406 use_velocity_cartesian_grid_ = use_velocity_cartesian_grid;
407 compute_radial_displacement_ = compute_radial_displacement;
408 fluxes_correction_conservations_ = fluxes_correction_conservations;
409 conserve_max_interfacial_fluxes_ = conserve_max_interfacial_fluxes;
410 fluxes_corrections_weighting_ = fluxes_corrections_weighting;
411 use_normal_gradient_for_flux_corr_ = use_normal_gradient_for_flux_corr;
412}
413
417 const int& advected_frame_of_reference,
418 const int& neglect_frame_of_reference_radial_advection,
419 const int& compute_tangential_variables)
420{
421 source_terms_type_ = source_terms_type;
424 advected_frame_of_reference_ = advected_frame_of_reference;
425 neglect_frame_of_reference_radial_advection_ = neglect_frame_of_reference_radial_advection;
430 compute_tangential_variables_ = compute_tangential_variables;
431}
432
434 Matrice& thermal_subproblems_matrix_assembly,
435 DoubleVect& thermal_subproblems_rhs_assembly,
436 DoubleVect& thermal_subproblems_temperature_solution,
437 DoubleVect& thermal_subproblems_temperature_solution_ini)
438{
439 finite_difference_assembler_ = &finite_difference_assembler;
440 thermal_subproblems_matrix_assembly_ = &thermal_subproblems_matrix_assembly;
441 thermal_subproblems_rhs_assembly_ = &thermal_subproblems_rhs_assembly;
442 thermal_subproblems_temperature_solution_ = &thermal_subproblems_temperature_solution;
443 thermal_subproblems_temperature_solution_ini_ = &thermal_subproblems_temperature_solution_ini;
444}
445
446void IJK_One_Dimensional_Subproblem::associate_temporal_parameters(const double& global_time_step, const double& current_time)
447{
448 global_time_step_ = global_time_step;
449 current_time_ = current_time;
450}
451
452void IJK_One_Dimensional_Subproblem::associate_flags_neighbours_correction(const int& correct_temperature_cell_neighbours,
453 const int& correct_neighbours_rank,
454 const int& neighbours_corrected_rank,
455 const int& neighbours_colinearity_weighting,
456 const int& neighbours_distance_weighting,
457 const int& neighbours_colinearity_distance_weighting,
458 const int& neighbours_last_faces_colinearity_weighting,
459 const int& neighbours_last_faces_colinearity_face_weighting,
460 const int& neighbours_last_faces_distance_weighting,
461 const int& neighbours_last_faces_distance_colinearity_weighting,
462 const int& neighbours_last_faces_distance_colinearity_face_weighting,
463 const int& compute_reachable_fluxes,
464 const int& find_cell_neighbours_for_fluxes_spherical_correction)
465{
466 /*
467 * Keep it under IJK_One_Dimensional_Subproblem::associate_flux_correction_parameters()
468 */
469 correct_temperature_cell_neighbours_ = correct_temperature_cell_neighbours;
470 correct_neighbours_rank_ = correct_neighbours_rank;
471 neighbours_corrected_rank_ = neighbours_corrected_rank;
472 neighbours_colinearity_weighting_ = neighbours_colinearity_weighting;
473 neighbours_distance_weighting_ = neighbours_distance_weighting;
474 neighbours_colinearity_distance_weighting_ = neighbours_colinearity_distance_weighting;
478 neighbours_last_faces_colinearity_weighting_ = neighbours_last_faces_colinearity_weighting;
479 neighbours_last_faces_colinearity_face_weighting_ = neighbours_last_faces_colinearity_face_weighting;
480 neighbours_last_faces_distance_weighting_ = neighbours_last_faces_distance_weighting;
481 neighbours_last_faces_distance_colinearity_weighting_ = neighbours_last_faces_distance_colinearity_weighting;
482 neighbours_last_faces_distance_colinearity_face_weighting_ = neighbours_last_faces_distance_colinearity_face_weighting;
488 compute_reachable_fluxes_ = compute_reachable_fluxes;
489 find_cell_neighbours_for_fluxes_spherical_correction_ = find_cell_neighbours_for_fluxes_spherical_correction;
491}
492
493void IJK_One_Dimensional_Subproblem::associate_probe_parameters(const int& points_per_thermal_subproblem,
494 const double& cp_liquid,
495 const double& alpha,
496 const double& lambda,
497 const double& prandtl_number,
498 const double& coeff_distance_diagonal,
499 const double& cell_diagonal,
500 const double& dr_base,
501 const DoubleVect& radial_coordinates)
502{
503 /*
504 * If the probe characteristics are the same (don't copy attributes)
505 */
506 points_per_thermal_subproblem_base_ = &points_per_thermal_subproblem;
507 coeff_distance_diagonal_ = &coeff_distance_diagonal;
508 cp_liquid_ = &cp_liquid;
509 alpha_ = &alpha;
510 lambda_ = &lambda;
511 prandtl_number_ = &prandtl_number;
512 cell_diagonal_ = &cell_diagonal;
513 dr_base_ = &dr_base;
514 radial_coordinates_base_ = &radial_coordinates;
515
516 /*
517 * If each probe differs (create attributes !)
518 */
521 else
523}
524
526 const ArrOfDouble& radius_from_surfaces_per_bubble,
527 const ArrOfDouble& radius_from_volumes_per_bubble,
528 const double& delta_temperature,
529 const double& mean_liquid_temperature,
530 const ArrOfDouble * bubbles_volume,
531 const DoubleTab * rising_vectors)
532{
533 bubbles_surface_ = &bubbles_surface;
534 radius_from_surfaces_per_bubble_ = &radius_from_surfaces_per_bubble;
535 radius_from_volumes_per_bubble_ = &radius_from_volumes_per_bubble;
536 delta_temperature_ = &delta_temperature;
537 mean_liquid_temperature_ = &mean_liquid_temperature;
538 bubbles_volume_ = bubbles_volume;
539 bubbles_rising_vectors_per_bubble_ = rising_vectors;
540}
541
542void IJK_One_Dimensional_Subproblem::associate_global_subproblems_parameters(const int& reconstruct_previous_probe_field,
543 const int& implicit_solver_from_previous_probe_field,
544 const std::map<int, std::map<int, std::map<int, int>>>& subproblem_to_ijk_indices_previous,
545 const std::vector<DoubleVect>& temperature_probe_previous,
546 const std::vector<double>& indicator_probes_previous,
547 const std::vector<Vecteur3>& velocities_probes_previous,
548 const std::vector<Vecteur3>& normal_vector_compo_probes_previous)
549
550{
551 reconstruct_previous_probe_field_ = reconstruct_previous_probe_field;
552 implicit_solver_from_previous_probe_field_ = implicit_solver_from_previous_probe_field;
553 subproblem_to_ijk_indices_previous_ = &subproblem_to_ijk_indices_previous;
554 temperature_probes_previous_ = &temperature_probe_previous;
555 indicator_probes_previous_ = &indicator_probes_previous;
556 velocities_probes_previous_ = &velocities_probes_previous;
557 normal_vector_compo_probes_previous_ = &normal_vector_compo_probes_previous;
558}
559
561 const Matrice& radial_second_order_operator_raw,
562 const Matrice& radial_first_order_operator,
563 const Matrice& radial_second_order_operator,
564 const Matrice& identity_matrix_explicit_implicit_raw,
565 Matrice& identity_matrix_subproblems,
566 Matrice& radial_diffusion_matrix,
567 Matrice& radial_convection_matrix)
568{
569 radial_first_order_operator_raw_base_ = &radial_first_order_operator_raw;
570 radial_second_order_operator_raw_base_ = &radial_second_order_operator_raw;
571 radial_first_order_operator_base_ = &radial_first_order_operator;
572 radial_second_order_operator_base_ = &radial_second_order_operator;
573 identity_matrix_explicit_implicit_base_ = &identity_matrix_explicit_implicit_raw;
574
578
579 identity_matrix_subproblems_ = &identity_matrix_subproblems;
580 radial_diffusion_matrix_base_ = &radial_diffusion_matrix;
581 radial_convection_matrix_base_ = &radial_convection_matrix;
582}
583
585{
586 if (debug_)
587 Cerr << "Compute interface basis vectors" << finl;
589
590 if (debug_)
591 Cerr << "Compute pure spherical basis vectors" << finl;
593
594 if (debug_)
595 Cerr << "Compute probe parameters" << finl;
596
597 probe_length_ = (*coeff_distance_diagonal_) * (*cell_diagonal_);
598
599 /*
600 * Curvature is negative for a convex bubble
601 * but R should be positive in that case
602 * FIXME: What happen with highly deformable bubbles (concave interface portions) ?
603 */
604 if (fabs(curvature_) > DMINFLOAT)
605 {
607 if (curvature_ >= DMINFLOAT)
608 {
609 const double max_length = osculating_radius_ - probe_length_;
610 if (curvature_ >= DMINFLOAT && max_length < 0)
611 osculating_radius_ = 1.e30;
612 }
613 else
615 }
616
617 if (debug_)
618 Cerr << "Compute local discretisation" << finl;
620
623 {
625 if (debug_)
626 Cerr << "Compute cell and faces distance to the interface" << finl;
630 {
633 {
634 if (debug_)
635 Cerr << "Compute distance cell neighbours" << finl;
638 if (debug_)
639 Cerr << "Compute distance faces neighbours" << finl;
642 }
643 }
644 }
645
647 {
650 }
651
652 surface_ = (*eulerian_interfacial_area_)(index_i_, index_j_, index_k_);
653 // Resize won't change the values if size is not changing...
655 // rhs_assembly_.resize(*points_per_thermal_subproblem_);
656 // rhs_assembly_ *= 0.;
657}
658
660{
661 /*
662 * TODO: Associate a basis to each subproblem
663 * Use Rodrigues' rotation formula to determine ephi ?
664 * Needs an axis of (rotation gravity_dir x relative_vectors)
665 * and an angle (gravity_dir dot relative_vectors) / (norm(gravity_dir)*norm(relative_vectors))
666 * ephi is determined in the gravity_align rising direction
667 * | gravity_dir
668 * |
669 * *****
670 * *** ***
671 * ** **
672 * *** ***
673 * *****
674 * |
675 * |
676 */
677
679 if (debug_)
680 {
681 Cerr << "bubble_barycentre_"<< bubble_barycentre_[0] << " ; " << bubble_barycentre_[1] << " ; " << bubble_barycentre_[2] << finl;
682 Cerr << "facet_barycentre_"<< facet_barycentre_[0] << " ; " << facet_barycentre_[1] << " ; " << facet_barycentre_[2] << finl;
683 Cerr << "facet_barycentre_relative_"<< facet_barycentre_relative_[0] << " ; " << facet_barycentre_relative_[1] << " ; " << facet_barycentre_relative_[2] << finl;
684 }
685 Vecteur3 facet_barycentre_relative_normed = facet_barycentre_relative_;
686 const double facet_barycentre_relative_norm = facet_barycentre_relative_normed.length();
687 facet_barycentre_relative_normed *= (1 / facet_barycentre_relative_norm);
688 Vecteur3 normal_contrib;
689 const double normal_vector_compo_norm = normal_vector_compo_.length();
690 normal_vector_compo_ *= (1 / normal_vector_compo_norm);
691
692 if (debug_)
693 Cerr << "Normal vector norm:" << normal_vector_compo_norm << finl;
694 /*
695 * First method with tangential direction of maximum velocity variations
696 */
697 DoubleTab facet_barycentre(1, 3);
699 for (int dir=0; dir<3; dir++)
700 facet_barycentre(0, dir) = facet_barycentre_[dir];
701 for (int dir=0; dir<3; dir++)
702 {
703 DoubleVect interfacial_velocity_component(1);
704 ijk_interpolate_skip_unknown_points((*velocity_)[dir], facet_barycentre, interfacial_velocity_component, INVALID_INTERP);
705 interfacial_velocity_compo_[dir] = interfacial_velocity_component[0];
706 }
707 if (interfacial_velocity_compo_.length() < INVALID_VELOCITY)
708 {
709 normal_contrib = normal_vector_compo_;
710 normal_contrib *= Vecteur3::produit_scalaire(facet_barycentre_relative_normed, normal_vector_compo_);
711 first_tangential_vector_compo_ = facet_barycentre_relative_normed - normal_contrib;
712 }
713 else
714 {
715 // Should I remove the rising velocity ?
717 normal_contrib = normal_vector_compo_;
721 }
722 const double norm_first_tangential_vector = first_tangential_vector_compo_.length();
723 first_tangential_vector_compo_ *= (1 / norm_first_tangential_vector);
725 const double norm_second_tangential_vector = second_tangential_vector_compo_.length();
726 second_tangential_vector_compo_ *= (1 / norm_second_tangential_vector);
727
728 /*
729 * Second method with rising velocity
730 */
732
734 const double norm_azymuthal_vector_compo_raw_ = azymuthal_vector_compo_raw_.length();
735// const int sign_vector = signbit(Vecteur3::produit_scalaire(bubble_rising_vector_, normal_vector_compo_));
736// if (sign_vector)
737// azymuthal_vector_compo_ *= -1;
738 azymuthal_vector_compo_ *= (1 / norm_azymuthal_vector_compo_raw_);
739
740 normal_contrib = normal_vector_compo_;
744 const double norm_first_tangential_vector_from_rising_dir = first_tangential_vector_compo_from_rising_dir_.length();
745 first_tangential_vector_compo_from_rising_dir_ *= (1 / norm_first_tangential_vector_from_rising_dir);
746
747
749 {
758 }
759 else
760 {
761 // By default
770 }
771}
772
774{
775 /*
776 * FIXME: It is align with gravity z but it should be modified to be align with the gravity dir ?
777 */
778 if (debug_)
779 Cerr << "r_sph_ calculation" << finl;
783 if (debug_)
784 {
785 Cerr << "r_sph_ = " << r_sph_ << finl;
786 Cerr << "theta_sph_ calculation" << finl;
787 }
788
789// theta_sph_ = atan(sqrt(facet_barycentre_relative_[0] * facet_barycentre_relative_[0]
790// + facet_barycentre_relative_[1] * facet_barycentre_relative_[1])/ facet_barycentre_relative_[2]);
793 const double atan_theta_incr_ini = M_PI / 2;
794 const double atan_incr_factor = -1;
795 theta_sph_ = (theta_sph_ - atan_theta_incr_ini) * atan_incr_factor;
796
798 if (theta_sph_ < 0)
800
801 if (debug_)
802 {
803 Cerr << "theta_sph_ = " << theta_sph_ << finl;
804 Cerr << "phi_sph_ calculation" << finl;
805 }
807
808 if (debug_)
809 {
810 Cerr << "phi_sph_ = " << phi_sph_ << finl;
811 Cerr << "er_sph_ calculation" << finl;
812 }
813 for (int dir=0; dir<3; dir++)
815
816 const double length = sqrt(facet_barycentre_relative_[0] * facet_barycentre_relative_[0]
818
819 if (debug_)
820 {
821 Cerr << "er_sph_ = " << er_sph_[0] << finl;
822 Cerr << "etheta_sph_ calculation" << finl;
823 }
824 for (int dir=0; dir<2; dir++)
826 etheta_sph_[2] = - facet_barycentre_relative_[2] * length / r_sph_;
827
828 ephi_sph_ = {0., 0., 0.};
831}
832
834{
835 int i;
837 {
839 {
841 {
843 dr_ = *dr_base_;
844 }
845 }
846 else
847 {
850 for (i=0; i < *points_per_thermal_subproblem_; i++)
853 }
854 }
855 else
856 {
857 /*
858 * coeff_distance_diagonal_ as well as
859 * points_per_thermal_subproblem_ could be adapted
860 */
864 for (i=0; i < *points_per_thermal_subproblem_; i++)
867 }
868 /*
869 * Following attributes differ anyway !
870 */
872 {
873 dr_inv_ = 1 / dr_;
874 osculating_radial_coordinates_ = (*radial_coordinates_);
877 {
882 }
883 for (i=0; i < *points_per_thermal_subproblem_; i++)
884 {
886 for (int dir=0; dir<3; dir++)
887 {
888 radial_coordinates_cartesian_compo_(i, dir) = (*radial_coordinates_)(i) * normal_vector_compo_[dir];
891 }
892 }
893 }
894}
895
897{
899 {
900 double max_u_inv = 1.e20;
901 if (max_u_ > INVALID_VELOCITY_CFL)
902 max_u_inv = 1 / max_u_;
903 local_fourier_time_step_probe_length_ = probe_length_ * probe_length_ * local_fourier_ / (*alpha_) * 0.125; // factor 1/8 in 3D ?
904 local_cfl_time_step_probe_length_ = probe_length_ * max_u_inv * local_cfl_ * 0.5; // factor 1/2 in 3D ?
907 {
908 local_dt_fo_ = dr_ * dr_ * local_fourier_ / (*alpha_);
909
910 local_dt_cfl_ = dr_ * max_u_inv * local_cfl_;
915 else
920 else
923 nb_iter_explicit_ *= (*points_per_thermal_subproblem_);
924 }
925 else
926 {
929 }
930 }
931}
932
938
940{
941 int check_nb_elem;
942 check_nb_elem = (*finite_difference_assembler_).build(identity_matrix_explicit_implicit, *points_per_thermal_subproblem_, -1);
943 if (debug_)
944 Cerr << "Check_nb_elem" << check_nb_elem << finl;
945}
946
948{
949 int check_nb_elem;
950 check_nb_elem = (*finite_difference_assembler_).build(radial_first_order_operator, *points_per_thermal_subproblem_, 0);
951 if (debug_)
952 Cerr << "Check_nb_elem" << check_nb_elem << finl;
954}
955
957{
958 int check_nb_elem;
959 check_nb_elem = (*finite_difference_assembler_).build(radial_second_order_operator, *points_per_thermal_subproblem_, 0);
960 if (debug_)
961 Cerr << "Check_nb_elem" << check_nb_elem << finl;
962 const double dr_squared_inv = 1 / pow(dr_, 2);
963 radial_second_order_operator_local_ *= dr_squared_inv;
964}
965
979
985
987{
988 radial_second_order_operator_local_ = (*radial_second_order_operator);
989 const double dr_squared_inv = 1 / pow(dr_, 2);
990 radial_second_order_operator_local_ *= dr_squared_inv;
991}
992
1000
1002{
1004 {
1008 const IJK_Field_double& indicator = interfaces_->I();
1009 ijk_interpolate_skip_unknown_points(indicator, coordinates_cartesian_compo_, indicator_interp_, INVALID_INTERP);
1011 {
1012 for (int i=(*points_per_thermal_subproblem_)-1; i>=0; i--)
1013 {
1014 const double indic_last = find_cell_related_indicator_on_probes(i);
1015 if (indic_last > LIQUID_INDICATOR_TEST)
1016 {
1018 if (i != (*points_per_thermal_subproblem_)-1)
1020 return;
1021 }
1023 }
1024 }
1025 else
1026 {
1028 {
1029
1030 const int last_index = (*points_per_thermal_subproblem_) - 1;
1031 const double indic_last = find_cell_related_indicator_on_probes(last_index);
1032 if (indic_last < LIQUID_INDICATOR_TEST)
1033 {
1035 return;
1036 }
1037 }
1038 else
1039 {
1040 for (int i=(*points_per_thermal_subproblem_)-1; i>=0; i--)
1041 {
1042 const double indicator_val = indicator_interp_(i);
1043 if (indicator_val < LIQUID_INDICATOR_TEST)
1044 {
1046 return;
1047 }
1048 }
1049 }
1050 }
1051 }
1052}
1053
1055{
1056 const IJK_Field_double& indicator = interfaces_->I();
1057 const Domaine_IJK& geom = ref_ijk_ft_->get_domaine();
1058
1059 const double dx = geom.get_constant_delta(DIRECTION_I);
1060 const double dy = geom.get_constant_delta(DIRECTION_J);
1061 const double dz = geom.get_constant_delta(DIRECTION_K);
1062 Vecteur3 xyz_cart_end = {coordinates_cartesian_compo_(last_index, 0),
1063 coordinates_cartesian_compo_(last_index, 1),
1064 coordinates_cartesian_compo_(last_index, 2)
1065 };
1066 Vecteur3 centre_elem = ref_ijk_ft_->get_domaine().get_coords_of_dof(index_i_, index_j_, index_k_, Domaine_IJK::ELEM);
1067 Vecteur3 displacement_centre_probe = centre_elem;
1068 displacement_centre_probe *= (-1);
1069 displacement_centre_probe += xyz_cart_end;
1070 Vecteur3 displacement_factor = {displacement_centre_probe[0] / dx,
1071 displacement_centre_probe[1] / dy,
1072 displacement_centre_probe[2] / dz
1073 };
1074 const int offset_x = (int) displacement_factor[0];
1075 const int offset_y = (int) displacement_factor[1];
1076 const int offset_z = (int) displacement_factor[2];
1077 const int offset_x_elem = ((abs(displacement_factor[0] - offset_x) >= 0.5) ? 1 : 0);
1078 const int offset_y_elem = ((abs(displacement_factor[1] - offset_y) >= 0.5) ? 1 : 0);
1079 const int offset_z_elem = ((abs(displacement_factor[2] - offset_z) >= 0.5) ? 1 : 0);
1080 const int real_offset_x = offset_x + (signbit(offset_x) ? - offset_x_elem : offset_x_elem);
1081 const int real_offset_y = offset_y + (signbit(offset_y) ? - offset_y_elem : offset_y_elem);
1082 const int real_offset_z = offset_z + (signbit(offset_z) ? - offset_z_elem : offset_z_elem);
1083 const double indic_last = indicator(index_i_ + real_offset_x,
1084 index_j_ + real_offset_y,
1085 index_k_ + real_offset_z);
1086 return indic_last;
1087}
1088
1090{
1092 {
1098
1104
1106
1110
1114
1121 }
1122}
1123
1125{
1130 else
1131 Cerr << "This strategy for readjusting the probe length does not exist" << finl;
1132
1133}
1134
1136{
1137 switch(probe_length_condition)
1138 {
1139 case 0:
1141 break;
1142 case 1:
1144 break;
1145 case 2:
1147 break;
1148 default:
1149 break;
1150 }
1151}
1152
1157
1159{
1161 bool has_liquid_neighbours = 1;
1162 for (int i=0; i<6; i++)
1163 has_liquid_neighbours = has_liquid_neighbours && pure_liquid_neighbours_[i];
1164 // const double max_distance_pure_face_centre = compute_max_distance_pure_face_centre();
1165 // const double max_distance_face_centre_vertex = std::max(max_distance_pure_face_centre, max_distance_pure_vertex_centre);
1166 int lmax, mmax;
1167 const double max_distance_pure_vertex_centre = compute_max_distance_pure_face_vertices(lmax, mmax);
1168 // Vecteur3 normal_contrib = normal_vector_compo_;
1169 // normal_contrib *= vertices_centres_distance_[lmax][mmax];
1170 // Vecteur3 tangential_distance = vertices_tangential_distance_vector_[lmax][mmax];
1171 // tangential_distance *= vertices_centres_tangential_distance_[lmax][mmax];
1172 // Vecteur3 facet_to_vertex = facet_to_vertex;
1173 // facet_to_vertex += tangential_distance;
1174
1176 modified_probe_length_from_vertices_ += (*cell_diagonal_) / 2.;
1178 if (debug_)
1179 Cerr << "Maximum vertex distance:" << max_distance_pure_vertex_centre << finl;
1180}
1181
1183{
1184 const double current_time = ref_ijk_ft_->schema_temps_ijk().get_current_time();
1185 cfl_probe_length_ = (max_u_ * current_time) / local_cfl_; // Add 3D constants ?
1186 fourier_probe_length_ = sqrt(((*alpha_ * (current_time + global_time_step_))) / local_fourier_); // Add 3D constants ?
1188 /*
1189 * TODO: ADD constraint on the temperature because of the displacement of the interface !!!!
1190 */
1191 cell_temperature_ = (*temperature_before_extrapolation_)(index_i_, index_j_, index_k_);
1193 {
1194 if (debug_)
1195 Cerr << "Probe length should be modified" << finl;
1196 if (!correct_fluxes_)
1197 {
1198 if (indicator_ < 0.5)
1199 {
1201 assert(cell_centre_distance_ >= 0.);
1204 else
1206 }
1207 }
1208 else
1209 {
1211 bool has_liquid_neighbours = 1;
1212 for (int i=0; i<6; i++)
1213 has_liquid_neighbours = has_liquid_neighbours && pure_liquid_neighbours_[i];
1214 const double max_distance_pure_face_centre = compute_max_distance_pure_face_centre();
1215 const double max_distance_pure_vertex_centre = compute_max_distance_pure_face_vertices();
1216 const double max_distance_face_centre_vertex = std::max(max_distance_pure_face_centre, max_distance_pure_vertex_centre);
1217 if (max_cfl_fourier_probe_length_ < max_distance_face_centre_vertex || !has_liquid_neighbours)
1218 {
1222 else
1224 }
1225 else
1227 }
1229 }
1230 else
1232}
1233
1234/*
1235 * TODO: Use ijk_intersections_interface instead !
1236 * and avoid redundancy...
1237 * Compare Calculation with mean_over_compo()
1238 * not weighted by the surface
1239 * Separate geometric attributes and physical attributes -> in the future
1240 */
1241
1243{
1245 {
1246 Vecteur3 centre = ref_ijk_ft_->get_domaine().get_coords_of_dof(index_i_, index_j_, index_k_, Domaine_IJK::ELEM);
1247
1248 Vecteur3 facet_to_cell_centre = facet_barycentre_;
1249 facet_to_cell_centre *= -1;
1250 facet_to_cell_centre += centre;
1251
1252 Vecteur3 facet_to_osculating_cell_centre = normal_vector_compo_;
1253 facet_to_osculating_cell_centre *= - (- osculating_radius_);
1254 facet_to_osculating_cell_centre += facet_to_cell_centre;
1255
1258 cell_centre_osculating_radius_difference_ = (facet_to_osculating_cell_centre.length()
1260
1261 Vecteur3 normal_contrib = normal_vector_compo_;
1262 normal_contrib *= cell_centre_distance_;
1263 Vecteur3 tangential_displacement = normal_contrib;
1264 tangential_displacement *= (-1);
1265 tangential_displacement += facet_to_cell_centre;
1266 cell_centre_tangential_distance_ = tangential_displacement.length();
1267 tangential_distance_vector_ = tangential_displacement;
1271 }
1272 else if (debug_)
1273 Cerr << "Cell centre distances have already been computed" << finl;
1274}
1275
1277{
1279 {
1280 Vecteur3 bary_face {0., 0., .0};
1281 Vecteur3 vector_relative {0., 0., 0.};
1282 Vecteur3 bary_vertex {0., 0., 0.};
1283 const int face_dir[6] = FACES_DIR;
1284 int m;
1285 for (int l=0; l<6; l++)
1286 {
1287 const int ii = NEIGHBOURS_I[l];
1288 const int jj = NEIGHBOURS_J[l];
1289 const int kk = NEIGHBOURS_K[l];
1290 const double indic_neighbour = ref_ijk_ft_->get_interface().I()(index_i_+ii, index_j_+jj, index_k_+kk);
1291 if (fabs(indic_neighbour) > LIQUID_INDICATOR_TEST)
1292 {
1293 const int ii_f = NEIGHBOURS_FACES_I[l];
1294 const int jj_f = NEIGHBOURS_FACES_J[l];
1295 const int kk_f = NEIGHBOURS_FACES_K[l];
1298 if (ii)
1299 bary_face = ref_ijk_ft_->get_domaine().get_coords_of_dof(index_i_+ii_f, index_j_+jj_f, index_k_+kk_f, Domaine_IJK::FACES_I);
1300 if (jj)
1301 bary_face = ref_ijk_ft_->get_domaine().get_coords_of_dof(index_i_+ii_f, index_j_+jj_f, index_k_+kk_f, Domaine_IJK::FACES_J);
1302 if (kk)
1303 bary_face = ref_ijk_ft_->get_domaine().get_coords_of_dof(index_i_+ii_f, index_j_+jj_f, index_k_+kk_f, Domaine_IJK::FACES_K);
1304
1305 // Normal distance
1306 vector_relative = facet_barycentre_;
1307 vector_relative *= (-1);
1308 vector_relative += bary_face;
1309 {
1310 const double distance_face_centre = Vecteur3::produit_scalaire(vector_relative, normal_vector_compo_);
1311 face_centres_radius_difference_[l] = vector_relative.length() - distance_face_centre;
1312 face_centres_distance_[l] = distance_face_centre;
1313 // Tangential distance
1314 Vecteur3 normal_contrib = normal_vector_compo_;
1315 normal_contrib *= distance_face_centre;
1316 Vecteur3 tangential_displacement = normal_contrib;
1317 tangential_displacement *= (-1);
1318 tangential_displacement += vector_relative;
1319 face_centres_tangential_distance_[l] = tangential_displacement.length();
1320 if (face_centres_tangential_distance_[l] > 1e-16)
1321 tangential_displacement *= (1 / face_centres_tangential_distance_[l]);
1322 face_tangential_distance_vector_[l] = tangential_displacement;
1323 }
1324 // Distance to vertex
1325 for (m=0; m<4; m++)
1326 {
1327 double distance_vertex_centre = 0.;
1328 double tangential_distance_vertex_centre = 0.;
1329 Vecteur3 tangential_distance_vector_vertex_centre = {0., 0., 0.};
1330 bary_vertex = vector_relative;
1332 face_dir[l],
1333 bary_vertex,
1334 distance_vertex_centre,
1335 tangential_distance_vertex_centre,
1336 tangential_distance_vector_vertex_centre);
1337 vertices_centres_distance_[l][m] = distance_vertex_centre;
1338 vertices_centres_tangential_distance_[l][m] = tangential_distance_vertex_centre;
1339 vertices_tangential_distance_vector_[l][m] = tangential_distance_vector_vertex_centre;
1340 }
1341 }
1342 else
1343 {
1344 if (fabs(indic_neighbour) < VAPOUR_INDICATOR_TEST)
1346 else
1349 face_centres_distance_[l] = 0.;
1351 face_tangential_distance_vector_[l] = {0., 0., 0.};
1352 for (m=0; m<4; m++)
1353 {
1354 vertices_centres_distance_[l][m] = 0.;
1356 vertices_tangential_distance_vector_[l][m] = {0., 0., 0.};
1357 }
1358 }
1359 }
1362 }
1363 else if (debug_)
1364 Cerr << "Cell face distances have already been computed" << finl;
1365}
1366
1368{
1369 double min_face_centre_distance = 1.e20;
1370 for (int l=0; l<6; l++)
1372 if(face_centres_distance_[l] > 0)
1373 min_face_centre_distance = std::min(min_face_centre_distance, face_centres_distance_[l]);
1374 return min_face_centre_distance;
1375}
1376
1378{
1379 double min_face_vertex_distance = 1.e20;
1380 int m;
1381 for (int l=0; l<6; l++)
1383 for (m=0; m<4; m++)
1384 if(vertices_centres_distance_[l][m] > 0)
1385 min_face_vertex_distance = std::min(min_face_vertex_distance, vertices_centres_distance_[l][m]);
1386 return min_face_vertex_distance;
1387}
1388
1390{
1391 double max_face_centre_distance = 0.;
1392 for (int l=0; l<6; l++)
1394 if(face_centres_distance_[l] > 0)
1395 max_face_centre_distance = std::max(max_face_centre_distance, face_centres_distance_[l]);
1396 return max_face_centre_distance;
1397}
1398
1400{
1401 double max_face_vertex_distance = 0.;
1402 int m;
1403 for (int l=0; l<6; l++)
1405 for (m=0; m<4; m++)
1406 if(vertices_centres_distance_[l][m] > 0)
1407 max_face_vertex_distance = std::max(max_face_vertex_distance, vertices_centres_distance_[l][m]);
1408 return max_face_vertex_distance;
1409}
1410
1412{
1413 double max_face_vertex_distance = 0.;
1414 int m;
1415 lmax = 0;
1416 mmax = 0;
1417 for (int l=0; l<6; l++)
1419 for (m=0; m<4; m++)
1420 if(vertices_centres_distance_[l][m] > 0)
1421 {
1422 max_face_vertex_distance = std::max(max_face_vertex_distance, vertices_centres_distance_[l][m]);
1423 if (vertices_centres_distance_[l][m] >= max_face_vertex_distance)
1424 {
1425 lmax = l;
1426 mmax = m;
1427 }
1428 }
1429 return max_face_vertex_distance;
1430}
1431
1433 const int& face_dir,
1434 Vecteur3& bary_vertex,
1435 double& distance_vertex_centre,
1436 double& tangential_distance_vertex_centre,
1437 Vecteur3& tangential_distance_vector_vertex_centre)
1438{
1439 const Domaine_IJK& geom = ref_ijk_ft_->get_domaine();
1440 const double dx = geom.get_constant_delta(DIRECTION_I);
1441 const double dy = geom.get_constant_delta(DIRECTION_J);
1442 const double dz = geom.get_constant_delta(DIRECTION_K);
1443 const double neighbours_first_dir[4] = NEIGHBOURS_FIRST_DIR;
1444 const double neighbours_second_dir[4] = NEIGHBOURS_SECOND_DIR;
1445 Vecteur3 point_coords {0., 0., 0.};
1446 double dl1;
1447 double dl2;
1448 switch(face_dir)
1449 {
1450 case 0:
1451 dl1 = dy / 2.;
1452 dl2 = dz / 2.;
1453 point_coords[1] = dl1 * neighbours_first_dir[vertex_number];
1454 point_coords[2] = dl2 * neighbours_second_dir[vertex_number];
1455 break;
1456 case 1:
1457 dl1 = dx / 2.;
1458 dl2 = dz / 2.;
1459 point_coords[0] = dl1 * neighbours_first_dir[vertex_number];
1460 point_coords[2] = dl2 * neighbours_second_dir[vertex_number];
1461 break;
1462 case 2:
1463 dl1 = dx / 2.;
1464 dl2 = dy / 2.;
1465 point_coords[0] = dl1 * neighbours_first_dir[vertex_number];
1466 point_coords[1] = dl2 * neighbours_second_dir[vertex_number];
1467 break;
1468 default:
1469 dl1 = dx / 2.;
1470 dl2 = dy / 2.;
1471 point_coords[0] = dl1 * neighbours_first_dir[vertex_number];
1472 point_coords[1] = dl2 * neighbours_second_dir[vertex_number];
1473 break;
1474 }
1475 bary_vertex += point_coords;
1476 distance_vertex_centre = Vecteur3::produit_scalaire(bary_vertex, normal_vector_compo_);
1477 Vecteur3 tangential_distance_vector = normal_vector_compo_;
1478 tangential_distance_vector *= distance_vertex_centre;
1479 tangential_distance_vector *= (-1);
1480 tangential_distance_vector += bary_vertex;
1481 tangential_distance_vertex_centre = tangential_distance_vector.length();
1482 if (tangential_distance_vertex_centre > 1e-16)
1483 tangential_distance_vector *= (1 / tangential_distance_vertex_centre);
1484 tangential_distance_vector_vertex_centre = tangential_distance_vector;
1485}
1486
1488{
1489 const Domaine_IJK& geom = ref_ijk_ft_->get_domaine();
1490 const double dx = geom.get_constant_delta(DIRECTION_I);
1491 const double dy = geom.get_constant_delta(DIRECTION_J);
1492 const double dz = geom.get_constant_delta(DIRECTION_K);
1493 int l, m, n;
1494
1495 int dxyz_increment_max = get_dxyz_increment_max();
1496 /*
1497 * 8-1 values for one neighbour in each dir... (Too much, enhance later)
1498 * Positive OR Negative dir depending on the normal vector
1499 */
1500 pure_neighbours_to_correct_.resize(dxyz_increment_max + 1);
1501 pure_neighbours_corrected_distance_.resize(dxyz_increment_max + 1);
1503 pure_neighbours_corrected_colinearity_.resize(dxyz_increment_max + 1);
1504 for (l=dxyz_increment_max; l>=0; l--)
1505 {
1506 pure_neighbours_to_correct_[l].resize(dxyz_increment_max + 1);
1507 pure_neighbours_corrected_distance_[l].resize(dxyz_increment_max + 1);
1509 pure_neighbours_corrected_colinearity_[l].resize(dxyz_increment_max + 1);
1510 for (m=dxyz_increment_max; m>=0; m--)
1511 {
1512 pure_neighbours_to_correct_[l][m].resize(dxyz_increment_max + 1);
1513 pure_neighbours_corrected_distance_[l][m].resize(dxyz_increment_max + 1);
1515 pure_neighbours_corrected_colinearity_[l][m].resize(dxyz_increment_max + 1);
1516 for (n=dxyz_increment_max; n>=0; n--)
1517 {
1518 pure_neighbours_to_correct_[l][m][n] = false;
1522 }
1523 }
1524 }
1525
1526 double remaining_distance_diag = probe_length_ - cell_centre_distance_;
1527 Vecteur3 remaining_distance_diag_projected = normal_vector_compo_;
1528 remaining_distance_diag_projected *= remaining_distance_diag;
1529 for (int i=0; i<3; i++)
1531 int dx_increment = (int) abs(remaining_distance_diag_projected[0] / dx);
1532 int dy_increment = (int) abs(remaining_distance_diag_projected[1] / dy);
1533 int dz_increment = (int) abs(remaining_distance_diag_projected[2] / dz);
1535 {
1536 dx_increment = std::min(dx_increment, dxyz_increment_max);
1537 dy_increment = std::min(dy_increment, dxyz_increment_max);
1538 dz_increment = std::min(dz_increment, dxyz_increment_max);
1539 }
1540 dxyz_increment_bool_ = (dx_increment || dy_increment || dz_increment);
1541 for (l=dx_increment; l>=0; l--)
1542 for (m=dy_increment; m>=0; m--)
1543 for (n=dz_increment; n>=0; n--)
1544 if (l!=0 || m!=0 || n!=0)
1545 {
1546 const int l_dir = (pure_neighbours_corrected_sign_[0]) ? l * (-1) : l;
1547 const int m_dir = (pure_neighbours_corrected_sign_[1]) ? m * (-1) : m;
1548 const int n_dir = (pure_neighbours_corrected_sign_[2]) ? n * (-1) : n;
1549 const double indic_neighbour = ref_ijk_ft_->get_interface().I()(index_i_ + l_dir, index_j_ + m_dir, index_k_ + n_dir);
1550 if (indic_neighbour > LIQUID_INDICATOR_TEST)
1551 {
1552 pure_neighbours_to_correct_[l][m][n] = true;
1553 const double dx_contrib = l_dir * dx;
1554 const double dy_contrib = m_dir * dy;
1555 const double dz_contrib = n_dir * dz;
1556 Vecteur3 distance_contrib = {dx_contrib, dy_contrib, dz_contrib};
1560 {
1561 const double colinearity = compute_cell_weighting(dx_contrib, dy_contrib, dz_contrib);
1562 pure_neighbours_corrected_colinearity_[l][m][n] = colinearity;
1563 }
1564 }
1565 }
1566}
1567
1569 const double& dy_contrib,
1570 const double& dz_contrib)
1571{
1573 return compute_colinearity(dx_contrib, dy_contrib, dz_contrib);
1575 return compute_distance_cell_faces(dx_contrib, dy_contrib, dz_contrib);
1577 return compute_colinearity(dx_contrib, dy_contrib, dz_contrib) * compute_distance_cell_faces(dx_contrib, dy_contrib, dz_contrib);
1578 return 1;
1579}
1580
1582{
1583 const Domaine_IJK& geom = ref_ijk_ft_->get_domaine();
1584 const double dx = geom.get_constant_delta(DIRECTION_I);
1585 const double dy = geom.get_constant_delta(DIRECTION_J);
1586 const double dz = geom.get_constant_delta(DIRECTION_K);
1587 const double dx_over_two = dx / 2.;
1588 const double dy_over_two = dy / 2.;
1589 const double dz_over_two = dz / 2.;
1590 int l, m, n;
1591 int l_cell, m_cell, n_cell;
1592
1593 int dxyz_increment_max = get_dxyz_increment_max();
1594 int dxyz_over_two_increment_max = get_dxyz_over_two_increment_max();
1595 const int first_increment[3] = {dxyz_over_two_increment_max + 1, dxyz_increment_max, dxyz_increment_max};
1596 const int second_increment[3] = {dxyz_increment_max, dxyz_over_two_increment_max + 1, dxyz_increment_max};
1597 const int third_increment[3] = {dxyz_increment_max, dxyz_increment_max, dxyz_over_two_increment_max + 1};
1598 // dxyz_over_two_increment_max *= 2;
1599 // if (!dxyz_over_two_increment_max%2)
1600 // dxyz_over_two_increment_max -= 1;
1601
1602 /*
1603 * 8-1 values for one neighbour in each dir... (Too much, enhance later)
1604 * Positive OR Negative dir depending on the normal vector
1605 */
1608 // if (neighbours_last_faces_weighting_) ?
1610 for (int c=0; c<3; c++)
1611 {
1612 const int first_incr = first_increment[c];
1613 const int second_incr = second_increment[c];
1614 const int third_incr = third_increment[c];
1615 pure_neighbours_last_faces_to_correct_[c].resize(first_incr + 1);
1616 pure_neighbours_last_faces_corrected_distance_[c].resize(first_incr + 1);
1617 // if (neighbours_last_faces_weighting_) ?
1618 pure_neighbours_last_faces_corrected_colinearity_[c].resize(first_incr + 1);
1619 for (l=first_incr; l>=0; l--)
1620 {
1621 pure_neighbours_last_faces_to_correct_[c][l].resize(second_incr + 1);
1622 pure_neighbours_last_faces_corrected_distance_[c][l].resize(second_incr + 1);
1623 // if (neighbours_last_faces_weighting_) ?
1624 pure_neighbours_last_faces_corrected_colinearity_[c][l].resize(second_incr + 1);
1625 for (m=second_incr; m>=0; m--)
1626 {
1627 pure_neighbours_last_faces_to_correct_[c][l][m].resize(third_incr + 1);
1628 pure_neighbours_last_faces_corrected_distance_[c][l][m].resize(third_incr + 1);
1629 // if (neighbours_last_faces_weighting_) ?
1630 pure_neighbours_last_faces_corrected_colinearity_[c][l][m].resize(third_incr + 1);
1631 for (n=third_incr; n>=0; n--)
1632 {
1633 pure_neighbours_last_faces_to_correct_[c][l][m][n] = false;
1635 // if (neighbours_last_faces_weighting_) ?
1637 }
1638 }
1639 }
1640 }
1641
1642 double remaining_distance_diag = probe_length_ - cell_centre_distance_;
1643 Vecteur3 remaining_distance_diag_projected = normal_vector_compo_;
1644 remaining_distance_diag_projected *= remaining_distance_diag;
1645 for (int i=0; i<3; i++)
1647 int dx_over_two_increment = (int) abs(remaining_distance_diag_projected[0] / dx_over_two);
1648 int dy_over_two_increment = (int) abs(remaining_distance_diag_projected[1] / dy_over_two);
1649 int dz_over_two_increment = (int) abs(remaining_distance_diag_projected[2] / dz_over_two);
1650 int dx_increment = (int) (dx_over_two_increment / 2);
1651 int dy_increment = (int) (dy_over_two_increment / 2);
1652 int dz_increment = (int) (dz_over_two_increment / 2);
1653 dx_over_two_increment -= dx_increment;
1654 dy_over_two_increment -= dy_increment;
1655 dz_over_two_increment -= dz_increment;
1657 {
1658 dx_over_two_increment = std::min(dx_over_two_increment, dxyz_over_two_increment_max);
1659 dy_over_two_increment = std::min(dy_over_two_increment, dxyz_over_two_increment_max);
1660 dz_over_two_increment = std::min(dz_over_two_increment, dxyz_over_two_increment_max);
1661 dx_increment = std::min(dx_increment, dxyz_increment_max);
1662 dy_increment = std::min(dy_increment, dxyz_increment_max);
1663 dz_increment = std::min(dz_increment, dxyz_increment_max);
1664 }
1665 dxyz_over_two_increment_bool_ = (dx_over_two_increment >0 || dy_over_two_increment>0 || dz_over_two_increment >0 );
1666 if (dx_over_two_increment>0)
1667 dx_over_two_increment--;
1668 if (dy_over_two_increment>0)
1669 dy_over_two_increment--;
1670 if (dz_over_two_increment>0)
1671 dz_over_two_increment--;
1672
1673 /*
1674 * TODO: Should we look to cells faces that are not in the normal vector direction ?
1675 */
1676 for (l=dx_over_two_increment + 1; l>=0; l--)
1677 for (m_cell=dy_increment; m_cell>=0; m_cell--)
1678 for (n_cell=dz_increment; n_cell>=0; n_cell--)
1679 {
1680 const int l_dir = (pure_neighbours_corrected_sign_[0]) ? l * (-1) + 1 : l;
1681 const int m_dir = (pure_neighbours_corrected_sign_[1]) ? m_cell * (-1) : m_cell;
1682 const int n_dir = (pure_neighbours_corrected_sign_[2]) ? n_cell * (-1) : n_cell;
1683 const int l_dir_elem = (pure_neighbours_corrected_sign_[0]) ? (l + 1) * (-1) + 1 : l;
1684 const double indic_neighbour = ref_ijk_ft_->get_interface().I()(index_i_ + l_dir_elem, index_j_ + m_dir, index_k_ + n_dir);
1685 if (indic_neighbour > LIQUID_INDICATOR_TEST)
1686 {
1687 pure_neighbours_last_faces_to_correct_[0][l][m_cell][n_cell] = true;
1688 const double lmn_zero = (l > 0) ? 1. : 0.;
1689 const double contrib_factor = (pure_neighbours_corrected_sign_[0]) ? (lmn_zero * (2 * abs(l_dir) + 1) - (1. - lmn_zero)) * (-1):
1690 lmn_zero * (2 * (l_dir - 1) + 1) - (1. - lmn_zero);
1691 const double dx_contrib = contrib_factor * dx_over_two;
1692 const double dy_contrib = m_dir * dy;
1693 const double dz_contrib = n_dir * dz;
1694 Vecteur3 distance_contrib = {dx_contrib, dy_contrib, dz_contrib};
1697 if (pure_neighbours_last_faces_corrected_distance_[0][l][m_cell][n_cell] < 0)
1698 pure_neighbours_last_faces_to_correct_[0][l][m_cell][n_cell] = false;
1700 {
1701 const double colinearity = compute_cell_faces_weighting(dx_contrib, dy_contrib, dz_contrib, 0);
1702 pure_neighbours_last_faces_corrected_colinearity_[0][l][m_cell][n_cell] = colinearity;
1703 }
1704 }
1705 }
1706
1707 for (l_cell=dx_increment; l_cell>=0; l_cell--)
1708 for (m=dy_over_two_increment + 1; m>=0; m--)
1709 for (n_cell=dz_increment; n_cell>=0; n_cell--)
1710 {
1711 const int l_dir = (pure_neighbours_corrected_sign_[0]) ? l_cell * (-1) : l_cell;
1712 const int m_dir = (pure_neighbours_corrected_sign_[1]) ? m * (-1) + 1: m;
1713 const int n_dir = (pure_neighbours_corrected_sign_[2]) ? n_cell * (-1) : n_cell;
1714 const int m_dir_elem = (pure_neighbours_corrected_sign_[1]) ? (m + 1) * (-1) + 1 : m;
1715 const double indic_neighbour = ref_ijk_ft_->get_interface().I()(index_i_ + l_dir, index_j_ + m_dir_elem, index_k_ + n_dir);
1716 if (indic_neighbour > LIQUID_INDICATOR_TEST)
1717 {
1718 pure_neighbours_last_faces_to_correct_[1][l_cell][m][n_cell] = true;
1719 const double lmn_zero = (m > 0) ? 1. : 0.;
1720 const double contrib_factor = (pure_neighbours_corrected_sign_[1]) ? (lmn_zero * (2 * abs(m_dir) + 1) - (1. - lmn_zero)) * (-1):
1721 lmn_zero * (2 * (m_dir - 1) + 1) - (1. - lmn_zero);
1722 const double dx_contrib = l_dir * dx;
1723 const double dy_contrib = contrib_factor * dy_over_two;
1724 const double dz_contrib = n_dir * dz;
1725 Vecteur3 distance_contrib = {dx_contrib, dy_contrib, dz_contrib};
1728 if (pure_neighbours_last_faces_corrected_distance_[1][l_cell][m][n_cell] < 0)
1729 pure_neighbours_last_faces_to_correct_[1][l_cell][m][n_cell] = false;
1731 {
1732 const double colinearity = compute_cell_faces_weighting(dx_contrib, dy_contrib, dz_contrib, 1);
1733 pure_neighbours_last_faces_corrected_colinearity_[1][l_cell][m][n_cell] = colinearity;
1734 }
1735 }
1736 }
1737
1738 for (l_cell=dx_increment; l_cell>=0; l_cell--)
1739 for (m_cell=dy_increment; m_cell>=0; m_cell--)
1740 for (n=dz_over_two_increment + 1; n>=0; n--)
1741 {
1742 const int l_dir = (pure_neighbours_corrected_sign_[0]) ? l_cell * (-1) : l_cell;
1743 const int m_dir = (pure_neighbours_corrected_sign_[1]) ? m_cell * (-1) : m_cell;
1744 const int n_dir = (pure_neighbours_corrected_sign_[2]) ? n * (-1) + 1: n;
1745 const int n_dir_elem = (pure_neighbours_corrected_sign_[2]) ? (n + 1) * (-1) + 1 : n;
1746 const double indic_neighbour = ref_ijk_ft_->get_interface().I()(index_i_ + l_dir, index_j_ + m_dir, index_k_ + n_dir_elem);
1747 if (indic_neighbour > LIQUID_INDICATOR_TEST)
1748 {
1749 pure_neighbours_last_faces_to_correct_[2][l_cell][m_cell][n] = true;
1750 const double lmn_zero = (n > 0) ? 1. : 0.;
1751 const double contrib_factor = (pure_neighbours_corrected_sign_[2]) ? (lmn_zero * (2 * abs(n_dir) + 1) - (1. - lmn_zero)) * (-1):
1752 lmn_zero * (2 * (n_dir - 1) + 1) - (1. - lmn_zero);
1753 const double dx_contrib = l_dir * dx;
1754 const double dy_contrib = m_dir * dy;
1755 const double dz_contrib = contrib_factor * dz_over_two;
1756 Vecteur3 distance_contrib = {dx_contrib, dy_contrib, dz_contrib};
1759 if (pure_neighbours_last_faces_corrected_distance_[2][l_cell][m_cell][n] < 0)
1760 pure_neighbours_last_faces_to_correct_[2][l_cell][m_cell][n] = false;
1762 {
1763 const double colinearity = compute_cell_faces_weighting(dx_contrib, dy_contrib, dz_contrib, 2);
1764 pure_neighbours_last_faces_corrected_colinearity_[2][l_cell][m_cell][n] = colinearity;
1765 }
1766 }
1767 }
1768 // if (neighbours_last_faces_colinearity_weighting_)
1769 // {
1770 // Vecteur3 relative_vector = normal_vector_compo_;
1771 // relative_vector *= cell_centre_distance_;
1772 // relative_vector[0] += ((l + 1) * normal_vector_compo_[0] * dx_over_two);
1773 // relative_vector[1] += ((m + 1) * normal_vector_compo_[1] * dy_over_two);
1774 // relative_vector[2] += ((n + 1) * normal_vector_compo_[2] * dz_over_two);
1775 // const double relative_vector_norm = relative_vector.length();
1776 // relative_vector *= (1 / relative_vector_norm);
1777 // // pure_neighbours_corrected_colinearity_[l][m][n] = Vecteur3::produit_scalaire(normal_vector_compo_, relative_vector);
1778 // }
1779}
1780
1782 const double& dy_contrib,
1783 const double& dz_contrib,
1784 const int& dir)
1785{
1787 return compute_colinearity(dx_contrib, dy_contrib, dz_contrib);
1789 return compute_colinearity_cell_faces(dx_contrib, dy_contrib, dz_contrib, dir);
1791 return compute_distance_cell_faces(dx_contrib, dy_contrib, dz_contrib);
1793 return compute_colinearity(dx_contrib, dy_contrib, dz_contrib) * compute_distance_cell_faces(dx_contrib, dy_contrib, dz_contrib);
1795 return compute_colinearity_cell_faces(dx_contrib, dy_contrib, dz_contrib, dir) * compute_distance_cell_faces(dx_contrib, dy_contrib, dz_contrib);
1796 return 1;
1797}
1798
1800 const double& dy_contrib,
1801 const double& dz_contrib)
1802{
1803 Vecteur3 relative_vector = normal_vector_compo_;
1804 relative_vector *= cell_centre_distance_;
1805 Vecteur3 tangential_relative_vector = tangential_distance_vector_;
1806 tangential_relative_vector *= cell_centre_tangential_distance_;
1807 relative_vector += tangential_relative_vector;
1808 Vecteur3 dxyz_contrib = {dx_contrib, dy_contrib, dz_contrib};
1809 relative_vector += dxyz_contrib;
1810 return relative_vector;
1811}
1812
1813double IJK_One_Dimensional_Subproblem::compute_colinearity(const double& dx_contrib, const double& dy_contrib, const double& dz_contrib)
1814{
1815 Vecteur3 relative_vector = compute_relative_vector_cell_faces(dx_contrib, dy_contrib, dz_contrib);
1816 const double relative_vector_norm = relative_vector.length();
1817 relative_vector *= (1 / relative_vector_norm);
1818 const double colinearity = Vecteur3::produit_scalaire(normal_vector_compo_, relative_vector);
1819 return abs(colinearity);
1820}
1821
1823 const double& dy_contrib,
1824 const double& dz_contrib,
1825 const int& dir)
1826{
1827 Vecteur3 relative_vector = compute_relative_vector_cell_faces(dx_contrib, dy_contrib, dz_contrib);
1828 const double relative_vector_norm = relative_vector.length();
1829 relative_vector *= (1 / relative_vector_norm);
1830 return abs(relative_vector[dir]);
1831}
1832
1834 const double& dy_contrib,
1835 const double& dz_contrib)
1836{
1837 Vecteur3 relative_vector = compute_relative_vector_cell_faces(dx_contrib, dy_contrib, dz_contrib);
1838 const double distance = Vecteur3::produit_scalaire(tangential_distance_vector_, relative_vector);
1839 return abs(1 / (distance + 1e-16));
1840}
1841
1843{
1844 const Domaine_IJK& geom = ref_ijk_ft_->get_domaine();
1845 const double dx = geom.get_constant_delta(DIRECTION_I);
1846 const double dy = geom.get_constant_delta(DIRECTION_J);
1847 const double dz = geom.get_constant_delta(DIRECTION_K);
1848
1849 int dxyz_increment_max;
1851 {
1852 const int dx_increment_max = (int) ((dx + probe_length_) / dx);
1853 const int dy_increment_max = (int) ((dy + probe_length_) / dy);
1854 const int dz_increment_max = (int) ((dz + probe_length_) / dz);
1855 dxyz_increment_max = std::max(std::max(dx_increment_max, dy_increment_max), dz_increment_max);
1856 }
1857 else
1858 {
1859 dxyz_increment_max = neighbours_corrected_rank_;
1860 }
1861 return dxyz_increment_max;
1862}
1863
1865{
1866 const Domaine_IJK& geom = ref_ijk_ft_->get_domaine();
1867 const double dx = geom.get_constant_delta(DIRECTION_I);
1868 const double dy = geom.get_constant_delta(DIRECTION_J);
1869 const double dz = geom.get_constant_delta(DIRECTION_K);
1870
1871 int dxyz_over_two_increment_max;
1873 {
1874 const int dx_increment_max = (int) ((probe_length_ + dx) / (dx / 2.));
1875 const int dy_increment_max = (int) ((probe_length_ + dy) / (dy / 2.));
1876 const int dz_increment_max = (int) ((probe_length_ + dz) / (dz / 2.));
1877 dxyz_over_two_increment_max = std::max(std::max(dx_increment_max, dy_increment_max), dz_increment_max);
1878 }
1879 else
1880 {
1881 dxyz_over_two_increment_max = neighbours_face_corrected_rank_;
1882 }
1883 return dxyz_over_two_increment_max;
1884}
1885
1887{
1888 if (probe_variations_enabled && probe_variations_enabled_)
1889 {
1891 {
1893 if (min_probe_length_ == modified_probe_length_from_vertices_)
1894 probe_length_ = min_probe_length_;
1895 else
1896 {
1898 return;
1899 }
1900 }
1907 else
1908 probe_length_ = (*coeff_distance_diagonal_) * (*cell_diagonal_);
1909
1912
1914 {
1915 clear_vectors();
1916 if (debug_)
1917 Cerr << "Compute distance cell neighbours" << finl;
1920 if (debug_)
1921 Cerr << "Compute distance faces neighbours" << finl;
1924 }
1925 }
1926 else
1927 {
1930 }
1931}
1932
1933
1935{
1936 Vecteur3 bary_cell = ref_ijk_ft_->get_domaine().get_coords_of_dof(index_i_, index_j_, index_k_, Domaine_IJK::ELEM);
1937 xyz_velocity_cell_ = {0., 0., 0.};
1938 double x_velocity_cell, y_velocity_cell, z_velocity_cell;
1939 interpolate_quantities_at_point((*velocity_)[0], bary_cell, x_velocity_cell);
1940 interpolate_quantities_at_point((*velocity_)[1], bary_cell, y_velocity_cell);
1941 interpolate_quantities_at_point((*velocity_)[2], bary_cell, z_velocity_cell);
1942 xyz_velocity_cell_ = {x_velocity_cell, y_velocity_cell, z_velocity_cell};
1943}
1944
1945void IJK_One_Dimensional_Subproblem::interpolate_quantities_at_point(const IJK_Field_double& eulerian_field, const Vecteur3& compo_xyz, double& field_value)
1946{
1947 DoubleVect field_interp(1);
1948 DoubleTab coordinates_point = get_single_point_coordinates(compo_xyz);
1949 ijk_interpolate_skip_unknown_points(eulerian_field, coordinates_point, field_interp, INVALID_INTERP);
1950 field_value = field_interp(0);
1951}
1952
1954{
1955 DoubleTab coordinates_point;
1956 coordinates_point.resize(1,3);
1957 for (int c=0; c<3; c++)
1958 coordinates_point(0,c) = compo_xyz[c];
1959 return coordinates_point;
1960}
1961
1963{
1964 ijk_interpolate_skip_unknown_points((*pressure_), coordinates_cartesian_compo_, pressure_interp_, INVALID_INTERP);
1965}
1966
1968{
1969 DoubleVect * vel_compo = nullptr;
1970 for (int dir = 0; dir < 3; dir++)
1971 {
1972 switch (dir)
1973 {
1974 case 0:
1975 vel_compo = &x_velocity_;
1976 break;
1977 case 1:
1978 vel_compo = &y_velocity_;
1979 break;
1980 case 2:
1981 vel_compo = &z_velocity_;
1982 break;
1983 default:
1984 vel_compo = &x_velocity_;
1985 break;
1986 }
1987 ijk_interpolate_skip_unknown_points((*velocity_)[dir], coordinates_cartesian_compo_, *vel_compo, INVALID_INTERP);
1988 }
1989}
1990
1992{
1995 DoubleVect velocity_magnitude_y = y_velocity_;
1996 velocity_magnitude_y *= y_velocity_;
1997 velocity_magnitude_ += velocity_magnitude_y;
1998 DoubleVect velocity_magnitude_z = z_velocity_;
1999 velocity_magnitude_z *= z_velocity_;
2000 velocity_magnitude_ += velocity_magnitude_z;
2001 for(int i=0; i<(*points_per_thermal_subproblem_); i++)
2002 {
2003 const double velocity_magnitude_sqrt = sqrt(velocity_magnitude_[i]);
2004 velocity_magnitude_[i] = velocity_magnitude_sqrt;
2005 }
2006}
2007
2009{
2016 // project_cartesian_onto_basis_vector(x_velocity_, y_velocity_, z_velocity_, *first_tangential_vector_compo_solver_, first_tangential_velocity_);
2017 // project_cartesian_onto_basis_vector(x_velocity_, y_velocity_, z_velocity_, *second_tangential_vector_compo_solver_, second_tangential_velocity_);
2018
2020
2021 max_u_ = INVALID_VELOCITY_CFL * 0.9;
2022 for (int i=0; i<radial_velocity_corrected_.size(); i++)
2023 if (max_u_cartesian_)
2024 max_u_ = std::max(max_u_, fabs(velocity_magnitude_[i]));
2025 else
2026 max_u_ = std::max(max_u_, fabs(radial_velocity_corrected_[i]));
2028
2041}
2042
2044{
2050
2056
2058 {
2064 }
2065 else
2066 {
2069 else
2075 }
2076
2078 {
2079 radial_displacement_over_time_step_ = 0.5 * global_time_step_ * radial_velocity_[0]; // or * 0.5 ? Like crank nicholson ?
2081 {
2087 {
2089 for (int l=0; l<6; l++)
2090 {
2093 }
2094 }
2095 }
2096 }
2097}
2098
2099void IJK_One_Dimensional_Subproblem::correct_velocity(const DoubleVect& velocity, DoubleVect& velocity_corrected)
2100{
2101 velocity_corrected = velocity;
2102 for (int i=0; i<velocity_corrected.size(); i++)
2103 velocity_corrected[i] -= velocity[0];
2104}
2105
2106void IJK_One_Dimensional_Subproblem::correct_velocity_rise(const DoubleVect& velocity, const Vecteur3& basis, DoubleVect& velocity_corrected)
2107{
2108 DoubleVect bubble_rising_velocity_projection(1);
2109 DoubleVect bubble_rising_velocity_compo_x(1);
2110 DoubleVect bubble_rising_velocity_compo_y(1);
2111 DoubleVect bubble_rising_velocity_compo_z(1);
2112 bubble_rising_velocity_compo_x[0] = bubble_rising_velocity_compo_[0];
2113 bubble_rising_velocity_compo_y[0] = bubble_rising_velocity_compo_[1];
2114 bubble_rising_velocity_compo_z[0] = bubble_rising_velocity_compo_[2];
2115 project_cartesian_onto_basis_vector(bubble_rising_velocity_compo_x,bubble_rising_velocity_compo_y, bubble_rising_velocity_compo_z,
2116 basis, bubble_rising_velocity_projection);
2117 velocity_corrected = velocity;
2118 for (int i=0; i<velocity_corrected.size(); i++)
2119 velocity_corrected[i] -= bubble_rising_velocity_projection[0];
2120}
2121
2126
2128 const DoubleVect& compo_y,
2129 const DoubleVect& compo_z,
2130 const Vecteur3& basis,
2131 DoubleVect& projection)
2132{
2133 const int size_x = compo_x.size();
2134 for (int i=0; i<size_x; i++)
2135 projection[i] = compo_x[i] * basis[0] + compo_y[i] * basis[1] + compo_z[i] * basis[2];
2136}
2137
2139 const DoubleVect& compo_u,
2140 const DoubleVect& compo_v,
2141 const DoubleVect& compo_w,
2142 const Vecteur3& basis_u,
2143 const Vecteur3& basis_v,
2144 const Vecteur3& basis_w,
2145 DoubleVect& projection)
2146{
2147 const int size_u = compo_u.size();
2148 const int size_v = compo_v.size();
2149 const int size_w = compo_w.size();
2150 for (int i=0; i<projection.size(); i++)
2151 {
2152 if (i< size_u)
2153 projection[i] += (compo_u[i] * basis_u[dir]);
2154 if (i< size_v)
2155 projection[i] += (compo_v[i] * basis_v[dir]);
2156 if (i< size_w)
2157 projection[i] += (compo_w[i] * basis_w[dir]);
2158 }
2159}
2160
2161void IJK_One_Dimensional_Subproblem::compute_integral_quantity(DoubleVect& quantity, double& integrated_quantity)
2162{
2163 double integrated_quantity_tmp = 0.;
2164 for (int i=0; i<quantity.size()-1; i++)
2165 {
2166 integrated_quantity_tmp += 0.5*(quantity[i] + quantity[i+1]) * dr_;
2167 }
2168 integrated_quantity = integrated_quantity_tmp;
2169}
2170
2171void IJK_One_Dimensional_Subproblem::compute_integral_quantity_on_probe(DoubleVect& quantity, double& integrated_quantity)
2172{
2173 compute_integral_quantity(quantity, integrated_quantity);
2174 integrated_quantity /= (probe_length_);
2175}
2176
2181
2183{
2186 else
2187 {
2188 if (ref_ijk_ft_->schema_temps_ijk().get_tstep() == 0)
2189 {
2191 const double radius_ini = osculating_radius_;
2192 for (int i=0; i<(*points_per_thermal_subproblem_); i++)
2194 * (radius_ini / osculating_radial_coordinates_[i])
2195 * (1 - erf( (*radial_coordinates_)[i] / (2 * sqrt((*alpha_) * ref_ijk_ft_->schema_temps_ijk().get_current_time())) ) );
2196 }
2197 else
2198 {
2200 if (count_index_ijk)
2201 {
2202 const int previous_rank = (*subproblem_to_ijk_indices_previous_).at(index_i_).at(index_j_).at(index_k_);
2203 temperature_previous_ = (*temperature_probes_previous_)[previous_rank];
2204 }
2205 else
2206 {
2207 int counter_mixed_neighbours = 0;
2208 // double indicator_mixed_neighbours = 0;
2209 // double colinearity_mixed_neighbours = 0;
2210 // double velocity_mixed_neighbours = 0;
2211 double averaging_weight = 0.;
2212 DoubleVect temperature_previous, temperature_previous_options;
2213 temperature_previous.resize((*points_per_thermal_subproblem_));
2214 temperature_previous_options.resize((*points_per_thermal_subproblem_));
2215 for (int l=0; l<6; l++)
2216 {
2217 const int ii = NEIGHBOURS_I[l];
2218 const int jj = NEIGHBOURS_J[l];
2219 const int kk = NEIGHBOURS_K[l];
2220 int index_i_neighbour_prev = index_i_ + NEIGHBOURS_I[l];
2221 int index_j_neighbour_prev = index_j_ + NEIGHBOURS_J[l];
2222 int index_k_neighbour_prev = index_k_ + NEIGHBOURS_K[l];
2223 const int count_index_ijk_neighbour = is_in_map_index_ijk((*subproblem_to_ijk_indices_previous_), index_i_neighbour_prev, index_j_neighbour_prev, index_k_neighbour_prev);
2224 if (count_index_ijk_neighbour)
2225 {
2226 const int previous_rank = (*subproblem_to_ijk_indices_previous_).at(index_i_neighbour_prev).at(index_j_neighbour_prev).at(index_k_neighbour_prev);
2227 const double indicator_prev = (*indicator_probes_previous_)[previous_rank];
2228 const double indicator_prev_vapour = 1 - indicator_prev;
2229 double best_indicator_prev = 0;
2230 best_indicator_prev = (indicator_ > 0.5) ? indicator_prev_vapour : indicator_prev;
2231 double velocity = 0.;
2232 Vecteur3 velocities_xyz = (*velocities_probes_previous_)[previous_rank];
2233 Vecteur3 normal_vector_compo_previous = (*normal_vector_compo_probes_previous_)[previous_rank];
2234 const double colinearity = Vecteur3::produit_scalaire(normal_vector_compo_, normal_vector_compo_previous);
2235 // int incr = 0;
2236 if (ii)
2237 {
2238 velocity = velocities_xyz[0];
2239 // incr = ii;
2240 }
2241 if (jj)
2242 {
2243 velocity = velocities_xyz[1];
2244 // incr = jj;
2245 }
2246 if (kk)
2247 {
2248 velocity = velocities_xyz[2];
2249 // incr = kk;
2250 }
2251 const double velocity_eval = abs(velocity) > 1e-10 ? abs(velocity) : 1.;
2252 // if (signbit(velocity) != signbit(incr) || (abs(velocity) <= 1e-10))
2253 {
2255 best_indicator_prev,
2256 colinearity,
2257 velocity_eval,
2258 temperature_previous,
2259 temperature_previous_options,
2260 averaging_weight);
2261 counter_mixed_neighbours++;
2262 }
2263 }
2264 }
2265 if (counter_mixed_neighbours)
2266 {
2267 if (averaging_weight < 1e-12)
2268 {
2269 if (debug_)
2270 Cerr << "temperature_previous_mixed_neighbour: " << counter_mixed_neighbours << finl;
2271 temperature_previous_ = temperature_previous;
2272 temperature_previous_ *= (1 / counter_mixed_neighbours);
2273 }
2274 else
2275 {
2276 if (debug_)
2277 Cerr << "temperature_previous_averaging_weight: " << averaging_weight << finl;
2278 temperature_previous_ = temperature_previous_options;
2279 temperature_previous_ *= (1 / averaging_weight);
2280 }
2281 }
2282 else
2284 }
2285 }
2286 }
2287}
2288
2290 const int& previous_rank,
2291 const double& best_indicator_prev,
2292 const double& colinearity,
2293 const double& velocity_eval,
2294 DoubleVect& temperature_previous,
2295 DoubleVect& temperature_previous_options,
2296 double& averaging_weight)
2297{
2298 DoubleVect temperature_previous_tmp = (*temperature_probes_previous_)[previous_rank];
2299 temperature_previous += temperature_previous_tmp;
2300 // temperature_previous_tmp *= best_indicator_prev;
2301 // temperature_previous_tmp *= velocity_eval;
2302 temperature_previous_tmp *= colinearity;
2303 temperature_previous_options += temperature_previous_tmp;
2304 // averaging_weight += best_indicator_prev;
2305 // averaging_weight += velocity_eval;
2306 averaging_weight += colinearity;
2307}
2308
2309int IJK_One_Dimensional_Subproblem::is_in_map_index_ijk(const std::map<int, std::map<int, std::map<int, int>>>& subproblem_to_ijk_indices,
2310 const int& index_i,
2311 const int& index_j,
2312 const int& index_k)
2313{
2314 const int count_index_i = (int) subproblem_to_ijk_indices.count(index_i);
2315 int count_index_j = 0;
2316 int count_index_k = 0;
2317 if (count_index_i)
2318 {
2319 count_index_j = (int) subproblem_to_ijk_indices.at(index_i).count(index_j);
2320 if (count_index_j)
2321 count_index_k = (int) subproblem_to_ijk_indices.at(index_i).at(index_j).count(index_k);
2322 }
2323 return (count_index_i && count_index_j && count_index_k);
2324}
2325
2337
2339{
2340 for (int dir = 0; dir < 3; dir++)
2341 {
2343 ijk_interpolate_skip_unknown_points((*grad_T_elem_solver_)[dir], coordinates_cartesian_compo_, grad_T_elem_interp_[dir], INVALID_INTERP);
2344 }
2345}
2346
2367
2387
2389{
2391 /*
2392 * A' = P^tAP
2393 */
2394 Matrice33 temperature_hessian_cartesian;
2395 Matrice33 temperature_hessian_spherical;
2396 Matrice33 temperature_hessian_spherical_from_rising;
2397 for (int i=0; i<*points_per_thermal_subproblem_; i++)
2398 {
2399 temperature_hessian_cartesian = Matrice33(hess_diag_T_elem_interp_[0](i), hess_cross_T_elem_interp_[2](i), hess_cross_T_elem_interp_[1](i),
2402
2403 project_matrix_on_basis(projection_matrix_, inverse_projection_matrix_, temperature_hessian_cartesian, temperature_hessian_spherical);
2404 hess_diag_T_elem_spherical_[0](i) = temperature_hessian_spherical(0, 0);
2405 hess_diag_T_elem_spherical_[1](i) = temperature_hessian_spherical(1, 1);
2406 hess_diag_T_elem_spherical_[2](i) = temperature_hessian_spherical(2, 2);
2407 hess_cross_T_elem_spherical_[0](i) = temperature_hessian_spherical(1, 2);
2408 hess_cross_T_elem_spherical_[1](i) = temperature_hessian_spherical(0, 2);
2409 hess_cross_T_elem_spherical_[2](i) = temperature_hessian_spherical(0, 1);
2410
2411 project_matrix_on_basis(projection_matrix_from_rising_, inverse_projection_matrix_from_rising_, temperature_hessian_cartesian, temperature_hessian_spherical_from_rising);
2412 hess_diag_T_elem_spherical_from_rising_[0](i) = temperature_hessian_spherical_from_rising(0, 0);
2413 hess_diag_T_elem_spherical_from_rising_[1](i) = temperature_hessian_spherical_from_rising(1, 1);
2414 hess_diag_T_elem_spherical_from_rising_[2](i) = temperature_hessian_spherical_from_rising(2, 2);
2415 hess_cross_T_elem_spherical_from_rising_[0](i) = temperature_hessian_spherical_from_rising(1, 2);
2416 hess_cross_T_elem_spherical_from_rising_[1](i) = temperature_hessian_spherical_from_rising(0, 2);
2417 hess_cross_T_elem_spherical_from_rising_[2](i) = temperature_hessian_spherical_from_rising(0, 1);
2418 }
2419}
2420
2434
2454
2455void IJK_One_Dimensional_Subproblem::project_matrix_on_basis(const Matrice33& projection_matrix, const Matrice33& inverse_projection_matrix, const Matrice33& matrix, Matrice33& projected_matrix)
2456{
2457 Matrice33 matrix_ap_tmp = matrix;
2458 // AP
2459 Matrice33::produit_matriciel(matrix, projection_matrix, matrix_ap_tmp);
2460 // P^tAP
2461 Matrice33::produit_matriciel(inverse_projection_matrix, matrix_ap_tmp, projected_matrix);
2462}
2463
2479
2495
2508
2510{
2511 const double alpha_inv = - 1 / *alpha_;
2512 DoubleVect osculating_radial_coefficient = osculating_radial_coordinates_inv_;
2513 osculating_radial_coefficient *= 2;
2515 // radial_convection_prefactor_.resize(*points_per_thermal_subproblem_);
2516 // interpolate_project_velocities_on_probes();
2520 {
2523 else
2525 radial_convection_prefactor_ *= alpha_inv;
2526 }
2527 else
2528 Cerr << "Diffusion case : don't compute the radial convection pre-factor" << finl;
2530 {
2533 else
2534 radial_convection_prefactor_ += osculating_radial_coefficient;
2535 }
2536 const int boundary_conditions = 0;
2541 (*finite_difference_assembler_).scale_matrix_subproblem_by_vector(radial_convection_matrix_base_,
2544 boundary_conditions,
2547}
2548
2550{
2552 {
2553 if (sub_problem_index_ == 0)
2554 {
2555 (*radial_convection_matrix_base_) *= (- (*alpha_) * global_time_step_);
2556 (*radial_diffusion_matrix_base_) *= (- (*alpha_) * global_time_step_);
2557 }
2558 }
2559
2561 {
2563 (*finite_difference_assembler_).apply_euler_time_step(radial_convection_matrix_base_,
2567 (*alpha_));
2568 else
2569 (*finite_difference_assembler_).correct_sign_temporal_schemes_subproblems(radial_convection_matrix_base_,
2573 (*alpha_));
2574 }
2575}
2576
2577void IJK_One_Dimensional_Subproblem::prepare_boundary_conditions(DoubleVect * thermal_subproblems_rhs_assembly,
2578 DoubleVect * thermal_subproblems_temperature_solution_ini,
2579 int& boundary_condition_interface,
2580 const double& interfacial_boundary_condition_value,
2581 const int& impose_boundary_condition_interface_from_simulation,
2582 int& boundary_condition_end,
2583 const double& end_boundary_condition_value,
2584 const int& impose_user_boundary_condition_end_value)
2585{
2589
2590 for (int i=0; i<temperature_interp_.size(); i++)
2591 if (fabs(temperature_interp_[i]) > INVALID_INTERP_TEST)
2592 Cerr << "Error in the temperature_interpolation" << temperature_interp_[i] << finl;
2593
2594 /*
2595 * Written for Dirichlet only
2596 * TODO: Write for other B.Cs or vapour-liquid coupled system
2597 */
2598 if (!impose_boundary_condition_interface_from_simulation)
2599 interfacial_boundary_condition_value_ = interfacial_boundary_condition_value;
2600 else
2601 {
2602 switch (boundary_condition_interface)
2603 {
2604 case default_bc:
2606 break;
2607 case dirichlet:
2609 break;
2610 case neumann:
2612 break;
2613 case flux_jump:
2615 break;
2616 default:
2617 break;
2618 }
2619 }
2620
2621
2622 if (impose_user_boundary_condition_end_value)
2623 end_boundary_condition_value_ = end_boundary_condition_value;
2624 else
2625 {
2626 switch (boundary_condition_end)
2627 {
2628 case default_bc:
2630 break;
2631 case dirichlet:
2633 break;
2634 case neumann:
2636 break;
2637 case flux_jump:
2639 break;
2640 default:
2641 break;
2642 }
2643 }
2644
2645
2646 const int thermal_subproblems_rhs_size = (*thermal_subproblems_rhs_assembly_).size();
2649 else
2650 {
2651 start_index_ = thermal_subproblems_rhs_size;
2652 (*thermal_subproblems_rhs_assembly_).resize(thermal_subproblems_rhs_size + *points_per_thermal_subproblem_);
2653 }
2654 end_index_ = start_index_ + (*points_per_thermal_subproblem_);
2655
2657 {
2658 /*
2659 * Some tests !
2660 */
2661 boundary_condition_end = implicit;
2663
2664 boundary_condition_end = neumann;
2665 end_boundary_condition_value_ = normal_temperature_gradient_interp_[(*points_per_thermal_subproblem_) - 1];
2667 (*finite_difference_assembler_).compute_operator(radial_first_order_operator_, temperature_previous_, normal_temperature_gradient_previous_);
2668 // end_boundary_condition_value_ = normal_temperature_gradient_previous_[(*points_per_thermal_subproblem_) - 1];
2669 }
2670
2671 /*
2672 * Some tests...
2673 */
2675 {
2678 (*thermal_subproblems_temperature_solution_ini_).resize(thermal_subproblems_rhs_size + *points_per_thermal_subproblem_);
2679
2681 if (boundary_condition_interface == dirichlet || boundary_condition_interface == default_bc)
2682 temperature_ini_temporal_schemes_[0] = interfacial_boundary_condition_value;
2683 else
2685
2686 double end_field_value_temporal=0.;
2687 if (boundary_condition_end == dirichlet || boundary_condition_end == default_bc)
2688 if (impose_user_boundary_condition_end_value)
2689 end_field_value_temporal = end_boundary_condition_value;
2690 else
2691 end_field_value_temporal = delta_T_subcooled_overheated_;
2692 else
2693 end_field_value_temporal = temperature_interp_[(*points_per_thermal_subproblem_) - 1];
2694 for (int i=1; i<(*points_per_thermal_subproblem_); i++)
2695 temperature_ini_temporal_schemes_[i] = end_field_value_temporal;
2696 // temperature_ini_temporal_schemes_[(*points_per_thermal_subproblem_) - 1] = delta_T_subcooled_overheated_;
2697 }
2698}
2699
2701 const double& interfacial_boundary_condition_value,
2702 const int& impose_boundary_condition_interface_from_simulation,
2703 const int& boundary_condition_end,
2704 const double& end_boundary_condition_value,
2705 const int& impose_user_boundary_condition_end_value)
2706{
2707 int boundary_condition_interface_local = boundary_condition_interface;
2708 int boundary_condition_end_local = boundary_condition_end;
2709
2712 boundary_condition_interface_local,
2713 interfacial_boundary_condition_value,
2714 impose_boundary_condition_interface_from_simulation,
2715 boundary_condition_end_local,
2716 end_boundary_condition_value,
2717 impose_user_boundary_condition_end_value);
2718
2720
2721 (*finite_difference_assembler_).impose_boundary_conditions_subproblem(thermal_subproblems_matrix_assembly_,
2724 boundary_condition_interface_local,
2726 boundary_condition_end_local,
2729 dr_inv_,
2736
2737 add_source_terms(boundary_condition_interface_local, boundary_condition_end_local);
2738 add_source_terms_temporal_tests(boundary_condition_interface_local, boundary_condition_end_local);
2739}
2740
2742{
2744 {
2745 // if (source_terms_type_ == tangential_conv_2D_tangential_diffusion_3D ||
2746 // source_terms_type_ == tangential_conv_3D_tangentual_diffusion_3D ||
2747 // !avoid_post_processing_all_terms_)
2748 // {
2752 // }
2753 }
2755 {
2756 /*
2757 * Compute at least the tangential convection
2758 */
2760 switch (source_terms_type_)
2761 {
2762 case tangential_conv_2D:
2765 break;
2766 case tangential_conv_3D:
2771 break;
2776 // Be careful to the sign
2778 break;
2784
2786 // Be careful to the sign
2787
2789 break;
2790 default:
2793 break;
2794 }
2795
2797 {
2798 source_terms_ *= (-1);
2799 source_terms_ *= (global_time_step_ * (*alpha_));
2801 // rhs_assembly_ = source_terms_;
2802 // rhs_assembly_ += temperature_previous_;
2803 }
2804
2806 {
2807 source_terms_ *= (-1);
2808 source_terms_ *= (local_time_step_overall_ * (*alpha_));
2810 {
2812 rhs_assembly_[0] = 0.;
2813 }
2814 else
2816 }
2817 }
2818}
2819
2829
2839
2847
2848void IJK_One_Dimensional_Subproblem::add_source_terms(const int& boundary_condition_interface, const int& boundary_condition_end)
2849{
2852 (*finite_difference_assembler_).add_source_terms(thermal_subproblems_rhs_assembly_,
2856 boundary_condition_interface,
2857 boundary_condition_end);
2858}
2859
2860void IJK_One_Dimensional_Subproblem::add_source_terms_temporal_tests(const int& boundary_condition_interface, const int& boundary_condition_end)
2861{
2863 {
2865 (*finite_difference_assembler_).add_source_terms(thermal_subproblems_temperature_solution_ini_,
2869 boundary_condition_interface,
2870 boundary_condition_end);
2871 else
2872 (*finite_difference_assembler_).add_source_terms(thermal_subproblems_rhs_assembly_,
2876 boundary_condition_interface,
2877 boundary_condition_end);
2878 }
2879}
2880
2886
2888{
2891 {
2892 // const double dt_iter = 0.;
2893 const double alpha_liq = *alpha_;
2894 for (int i=0; i<*points_per_thermal_subproblem_; i++)
2895 {
2897 y_velocity_(i) * grad_T_elem_interp_[1](i) +
2898 z_velocity_(i) * grad_T_elem_interp_[2](i)) +
2899 alpha_liq *
2903 }
2904 }
2905}
2906
2908{
2909 /*
2910 * Two frame reference calculations
2911 * Advected or not by the velocity tangentially
2912 * -> 4 cases
2913 */
2915 {
2952 }
2953}
2954
2956 const Vecteur3& first_tangential_vector_compo,
2957 const Vecteur3& second_tangential_vector_compo,
2958 const DoubleVect& radial_velocity_frame,
2959 const DoubleVect& first_tangential_velocity_frame,
2960 const DoubleVect& second_tangential_velocity_frame,
2961 const DoubleVect& temperature_time_increment,
2962 DoubleVect& convective_term,
2963 DoubleVect& material_derivative)
2964{
2965 material_derivative.resize(*points_per_thermal_subproblem_);
2966 convective_term.resize(*points_per_thermal_subproblem_);
2967 for (int i=0; i<*points_per_thermal_subproblem_; i++)
2968 {
2969 Vecteur3 cartesian_velocity = {x_velocity_(i), y_velocity_(i), z_velocity_(i)};
2970
2971 const double radial_velocity = radial_velocity_frame[i];
2972 const double first_tangential_velocity = first_tangential_velocity_frame[i];
2973 const double second_tangential_velocity = second_tangential_velocity_frame[i];
2974 Vecteur3 temperature_gradient = {grad_T_elem_interp_[0](i), grad_T_elem_interp_[1](i), grad_T_elem_interp_[2](i)};
2975 Vecteur3 radial_convection_frame = normal_vector_compo;
2976 radial_convection_frame *= -radial_velocity;
2977 Vecteur3 first_tangent_convection_frame = first_tangential_vector_compo;
2978 first_tangent_convection_frame *= -first_tangential_velocity;
2979 Vecteur3 second_tangent_convection_frame = second_tangential_vector_compo;
2980 second_tangent_convection_frame *= -second_tangential_velocity;
2981 radial_convection_frame += cartesian_velocity;
2982 first_tangent_convection_frame += cartesian_velocity;
2983 second_tangent_convection_frame += cartesian_velocity;
2984 convective_term[i] = Vecteur3::produit_scalaire(radial_convection_frame, temperature_gradient) +
2985 Vecteur3::produit_scalaire(first_tangent_convection_frame, temperature_gradient) +
2986 Vecteur3::produit_scalaire(second_tangent_convection_frame, temperature_gradient);
2987 material_derivative[i] = temperature_time_increment[i] + convective_term[i];
2988 }
2989}
2990
2991void IJK_One_Dimensional_Subproblem::correct_tangential_temperature_gradient(DoubleVect& tangential_convection_source_terms)
2992{
2993 DoubleVect tangential_convection_source_terms_tmp = tangential_convection_source_terms;
2994 for (int i=0; i<tangential_convection_source_terms.size(); i++)
2995 tangential_convection_source_terms[i] -= tangential_convection_source_terms_tmp[0];
2996}
2997
2998void IJK_One_Dimensional_Subproblem::correct_tangential_temperature_hessian(DoubleVect& tangential_diffusion_source_terms)
2999{
3000 DoubleVect tangential_diffusion_source_terms_tmp = tangential_diffusion_source_terms;
3001 for (int i=0; i<tangential_diffusion_source_terms_tmp.size(); i++)
3002 tangential_diffusion_source_terms[i] -= tangential_diffusion_source_terms_tmp[0];
3003}
3004
3023
3056
3058{
3061 normal_temperature_gradient_solution_integral_exact_ = (temperature_solution_[(*points_per_thermal_subproblem_)-1] -
3068
3070 {
3075 DoubleVect total_source_terms_local = tangential_convection_source_terms_first_;
3076 total_source_terms_local += tangential_convection_source_terms_second_;
3077 total_source_terms_local += tangential_diffusion_source_terms_;
3079 }
3082 // time_increment_from_energy_increment_ = (energy_temperature_solution_ - energy_temperature_interp_) / energy_increment_times_dt;
3083}
3084
3106
3108{
3109 const double flux_coeff = ((*lambda_) * surface_);
3116 const double grad_T_elem_gfm = (*eulerian_grad_T_interface_ns_)(index_i_, index_j_, index_k_);
3117 normal_temperature_gradient_solution_[0] = grad_T_elem_gfm;
3118 thermal_flux_[0] = grad_T_elem_gfm;
3119 thermal_flux_*= flux_coeff;
3122 const double sign_temp = signbit(*delta_temperature_) ? -1 : 1;
3125
3126 thermal_flux_gfm_ = grad_T_elem_gfm * flux_coeff;
3129
3130 const double sign_flux = signbit(thermal_flux_raw_) ? -1. : 1.;
3131 thermal_flux_max_raw_ = sign_flux * std::max(abs(thermal_flux_raw_), abs(thermal_flux_lrs_));
3132 thermal_flux_max_gfm_ = sign_flux * std::max(abs(thermal_flux_gfm_), abs(thermal_flux_lrs_));
3133 thermal_flux_max_ = sign_flux * std::max(std::max(abs(thermal_flux_gfm_), abs(thermal_flux_raw_)), abs(thermal_flux_lrs_));
3134}
3135
3142
3144{
3145 // for (int dir=0; dir<3; dir++)
3146 // temperature_gradient_solution_[dir].resize(temperature_solution_.size());
3148 (*finite_difference_assembler_).compute_operator(radial_first_order_operator_, temperature_solution_, normal_temperature_gradient_solution_);
3149
3152
3160 {
3161 DoubleVect dummy_tangential_deriv;
3162 dummy_tangential_deriv.resize(*points_per_thermal_subproblem_);
3164 project_basis_vector_onto_cartesian_dir(0, dummy_tangential_deriv, dummy_tangential_deriv, normal_temperature_gradient_solution_,
3168 project_basis_vector_onto_cartesian_dir(1, dummy_tangential_deriv, dummy_tangential_deriv, normal_temperature_gradient_solution_,
3172 project_basis_vector_onto_cartesian_dir(2, dummy_tangential_deriv, dummy_tangential_deriv, normal_temperature_gradient_solution_,
3175 }
3176 else
3177 {
3190 }
3191
3192
3195 {
3196 const double interfacial_gradient_solution = abs(normal_temperature_gradient_solution_[0]);
3197 const double interfacial_gradient_interp = abs(normal_temperature_gradient_interp_[0]);
3198 const double interfacial_gradient_gfm = abs((*eulerian_grad_T_interface_ns_)(index_i_, index_j_, index_k_));
3200 {
3201 if (interfacial_gradient_solution < interfacial_gradient_gfm)
3203 }
3204 else
3205 {
3206 if (interfacial_gradient_solution < interfacial_gradient_interp)
3208 }
3209 }
3210
3216
3220
3223 else
3225
3226 thermal_flux_[0] = (abs(thermal_flux_[0]) > MAX_FLUX_TEST) ? 0.: thermal_flux_[0];
3227
3228 const double grad_T_elem_gfm = (*eulerian_grad_T_interface_ns_)(index_i_, index_j_, index_k_);
3230 {
3231 normal_temperature_gradient_solution_[0] = grad_T_elem_gfm;
3232 thermal_flux_[0] = grad_T_elem_gfm;
3233 }
3235 thermal_flux_interp_gfm_[0] = grad_T_elem_gfm;
3236
3237 const double flux_coeff = ((*lambda_) * surface_);
3238 thermal_flux_*= flux_coeff;
3239 thermal_flux_interp_gfm_ *= flux_coeff;
3240 const double sign_temp = signbit(*delta_temperature_) ? -1 : 1;
3241
3242 thermal_flux_gfm_ = grad_T_elem_gfm * flux_coeff;
3245
3246 const double sign_flux = signbit(thermal_flux_raw_) ? -1. : 1.;
3247 thermal_flux_max_raw_ = sign_flux * std::max(abs(thermal_flux_raw_), abs(thermal_flux_lrs_));
3248 thermal_flux_max_gfm_ = sign_flux * std::max(abs(thermal_flux_gfm_), abs(thermal_flux_lrs_));
3249 thermal_flux_max_ = sign_flux * std::max(std::max(abs(thermal_flux_gfm_), abs(thermal_flux_raw_)), abs(thermal_flux_lrs_));
3250
3252 {
3255 }
3256 else
3259}
3260
3277
3285
3287{
3290
3295
3296 for (int dir = 0; dir < 3; dir++)
3297 {
3304 }
3305
3311
3314
3317
3321
3324
3330
3333}
3334
3339
3344
3370
3372{
3375 for (int i=0; i<(*points_per_thermal_subproblem_); i++)
3376 {
3377 Vecteur3 local_shear_stress = first_tangential_vector_compo_;
3378 Vecteur3 local_shear_stress_second = second_tangential_vector_compo_;
3379 local_shear_stress *= first_tangential_velocity_normal_gradient_(i);
3380 local_shear_stress_second *= second_tangential_velocity_normal_gradient_(i);
3381 local_shear_stress += local_shear_stress_second;
3382 shear_stress_(i) = local_shear_stress.length();
3383
3385 local_shear_stress_second = azymuthal_vector_compo_;
3387 local_shear_stress_second *= azymuthal_velocity_normal_gradient_(i);
3388 local_shear_stress += local_shear_stress_second;
3389 shear_stress_from_rising_dir_(i) = local_shear_stress.length();
3390 }
3391 const double mu_liquid = ref_ijk_ft_->milieu_ijk().get_mu_liquid();
3392 shear_stress_ *= mu_liquid;
3393 shear_stress_from_rising_dir_ *= mu_liquid;
3396}
3397
3406
3411
3416
3421
3426
3428 const DoubleVect& field,
3429 const DoubleVect& field_weak_gradient,
3430 const IJK_Field_double& eulerian_field,
3431 const int temp_bool,
3432 const int weak_gradient_variable,
3433 const int interp_eulerian) const
3434{
3435 double field_value = INVALID_TEMPERATURE;
3436 const DoubleVect * field_ref = &field;
3437 if (disable_probe_weak_gradient_local_ && weak_gradient_variable)
3438 {
3439 if (temp_bool)
3440 return temperature_cell_;
3441 field_ref = &field_weak_gradient;
3442 }
3443 if (debug_ && temp_bool)
3444 {
3445 Cerr << "Thermal subproblem index: " << sub_problem_index_ << finl;
3446 Cerr << "Radial ini: " << (*radial_coordinates_)[0] << finl;
3447 Cerr << "Radial coordinate end: " << (*radial_coordinates_)[*points_per_thermal_subproblem_-1] << finl;
3448 Cerr << "Field ini: " << field[0] << finl;
3449 Cerr << "Field end: " << field[*points_per_thermal_subproblem_-1] << finl;
3450 Cerr << "Field interp ini: " << temperature_interp_[0] << finl;
3451 Cerr << "Field interp end: " << temperature_interp_[*points_per_thermal_subproblem_-1] << finl;
3452 Cerr << "End_boundary_condition_value: " << end_boundary_condition_value_ << finl;
3453 Cerr << "Curvature: " << curvature_ << finl;
3454 Cerr << "Osculating radius: " << osculating_radius_ << finl;
3455 }
3457 {
3458 /*
3459 * Dummy dichotomy and linear interpolation along the probe
3460 */
3461 int left_interval = 0;
3462 int right_interval = *points_per_thermal_subproblem_-1;
3463 find_interval(dist, left_interval, right_interval);
3464 const double field_interp = ((*field_ref)[right_interval] - (*field_ref)[left_interval])
3465 / ((*radial_coordinates_)[right_interval] - (*radial_coordinates_)[left_interval]) *
3466 (dist-(*radial_coordinates_)[left_interval]) + (*field_ref)[left_interval];
3467 field_value = field_interp;
3468 }
3469 else if (dist < (*radial_coordinates_)[0])
3470 {
3471 if (temp_bool)
3472 {
3473 const double interfacial_temperature_gradient_solution = get_interfacial_gradient_corrected();
3474 const double interfacial_temperature_double_derivative_solution = get_interfacial_double_derivative_corrected();
3476 {
3477 case 1:
3478 field_value = interfacial_temperature_gradient_solution * dist;
3479 break;
3480 case 2:
3481 field_value = (interfacial_temperature_gradient_solution * dist
3482 + 0.5 * interfacial_temperature_double_derivative_solution * (dist * dist));
3483 break;
3484 default:
3485 field_value = interfacial_temperature_gradient_solution * dist;
3486 }
3487 }
3488 else
3489 field_value = field[0];
3490 }
3491 else
3492 {
3493 if(interp_eulerian)
3494 {
3495 DoubleTab coordinates_point;
3496 DoubleVect field_interp(1);
3497 coordinates_point.resize(1,3);
3498 Vecteur3 compo_xyz = normal_vector_compo_;
3499 compo_xyz *= dist;
3500 compo_xyz += facet_barycentre_;
3501 for (int c=0; c<3; c++)
3502 coordinates_point(0,c) = compo_xyz[c];
3503 ijk_interpolate_skip_unknown_points(eulerian_field, coordinates_point, field_interp, INVALID_INTERP);
3504 field_value = field_interp(0);
3505 }
3506 else
3507 field_value = field[*points_per_thermal_subproblem_ - 1];
3508 }
3509 return field_value;
3510}
3511
3512double IJK_One_Dimensional_Subproblem::get_field_profile_at_point(const double& dist, const DoubleVect& field, const int temp_bool) const
3513{
3514 double field_value = INVALID_TEMPERATURE;// temperature_solution_;
3515 if (debug_ && ((dist < 0 && indicator_>0.5) || (dist > (*radial_coordinates_)[*points_per_thermal_subproblem_-1] && indicator_>0.5)))
3516 {
3517 Cerr << "Probe length: " << probe_length_ << finl;
3518 Cerr << "Distance d: " << dist << finl;
3519 Cerr << "Indicator I: " << indicator_ << finl;
3520 }
3521 if (debug_ && temp_bool)
3522 {
3523 Cerr << "Thermal subproblem index: " << sub_problem_index_ << finl;
3524 Cerr << "Radial ini: " << (*radial_coordinates_)[0] << finl;
3525 Cerr << "Radial coordinate end: " << (*radial_coordinates_)[*points_per_thermal_subproblem_-1] << finl;
3526 Cerr << "Field ini: " << field[0] << finl;
3527 Cerr << "Field end: " << field[*points_per_thermal_subproblem_-1] << finl;
3528 Cerr << "Field interp ini: " << temperature_interp_[0] << finl;
3529 Cerr << "Field interp end: " << temperature_interp_[*points_per_thermal_subproblem_-1] << finl;
3530 Cerr << "End_boundary_condition_value: " << end_boundary_condition_value_ << finl;
3531 Cerr << "Curvature: " << curvature_ << finl;
3532 Cerr << "Osculating radius: " << osculating_radius_ << finl;
3533 }
3535 {
3536 /*
3537 * Dummy dichotomy and linear interpolation along the probe
3538 */
3539 int left_interval = 0;
3540 int right_interval = *points_per_thermal_subproblem_-1;
3541 find_interval(dist, left_interval, right_interval);
3542 const double field_interp = (field[right_interval] - field[left_interval])
3543 / ((*radial_coordinates_)[right_interval] - (*radial_coordinates_)[left_interval]) *
3544 (dist-(*radial_coordinates_)[left_interval]) + field[left_interval];
3545 field_value = field_interp;
3546 }
3547 else if (dist < (*radial_coordinates_)[0])
3548 {
3549 if (temp_bool)
3550 {
3552 field_value = 0.;
3553 else
3554 {
3555 const double interfacial_temperature_gradient_solution = get_interfacial_gradient_corrected();
3556 const double interfacial_temperature_double_derivative_solution = get_interfacial_double_derivative_corrected();
3558 {
3559 case 1:
3560 field_value = interfacial_temperature_gradient_solution * dist;
3561 break;
3562 case 2:
3563 field_value = (interfacial_temperature_gradient_solution * dist
3564 + 0.5 * interfacial_temperature_double_derivative_solution * (dist * dist));
3565 break;
3566 default:
3567 field_value = interfacial_temperature_gradient_solution * dist;
3568 }
3569 }
3570 }
3571 else
3572 field_value = 0.;
3573 }
3574 else
3575 {
3576 if (temp_bool)
3577 {
3579 {
3581 field_value = cell_temperature_;
3582 else
3583 field_value = delta_T_subcooled_overheated_;
3584 }
3585 else
3586 field_value = field[(*points_per_thermal_subproblem_) - 1];
3587 }
3588 else
3589 field_value = field[(*points_per_thermal_subproblem_) - 1];
3590 }
3591 return field_value;
3592}
3593
3595{
3597 // return get_field_profile_at_point(dist, temperature_solution_, 1);
3598}
3599
3601 const int& dir,
3602 const int& index_i,
3603 const int& index_j,
3604 const int& index_k) const
3605{
3606 double velocity = 0;
3608 velocity = get_velocity_cartesian_grid_value(dist,
3609 dir,
3610 signbit(normal_vector_compo_[dir]),
3611 index_i,
3612 index_j,
3613 index_k);
3614 else
3615 {
3616 switch(dir)
3617 {
3618 case 0:
3620 break;
3621 case 1:
3623 break;
3624 case 2:
3626 break;
3627 default:
3629 break;
3630 }
3631 }
3632 return velocity;
3633}
3634
3636 const int& dir,
3637 const int& sign_dir,
3638 const int& index_i,
3639 const int& index_j,
3640 const int& index_k) const
3641{
3642 /*
3643 * Access directly the value ?
3644 */
3645 double velocity = 0.;
3646 const int test_index_i = index_i != INVALID_INDEX;
3647 const int test_index_j = index_j != INVALID_INDEX;
3648 const int test_index_k = index_k != INVALID_INDEX;
3649 int i = test_index_i ? index_i: index_i_;
3650 int j = test_index_j ? index_j: index_j_;
3651 int k = test_index_k ? index_k: index_k_;
3652 // const double delta = (dist - cell_centre_distance_) * normal_vector_compo_[dir];
3653 // double incr_dir;
3654 // const Domaine_IJK& geom= ref_ijk_ft_->get_domaine();
3655 // double ddir = geom.get_constant_delta(dir);
3656 // incr_dir = (int) delta / ddir;
3657 if (!(test_index_i && test_index_j && test_index_k))
3658 {
3659 switch(dir)
3660 {
3661 case 0:
3662 if (!sign_dir)
3663 i += 1;
3664 break;
3665 case 1:
3666 if (!sign_dir)
3667 j += 1;
3668 break;
3669 case 2:
3670 if (!sign_dir)
3671 k += 1;
3672 break;
3673 default:
3674 if (!sign_dir)
3675 i += 1;
3676 break;
3677 }
3678 }
3679 velocity = (*velocity_)[dir](i,j,k);
3680
3681 /*
3682 * Use inteporlations
3683 */
3684 // DoubleTab coordinates_point;
3685 // DoubleVect field_interp(1);
3686 // coordinates_point.resize(1,3);
3687 // Vecteur3 bary_cell = ref_ijk_ft_->get_domaine().get_coords_of_dof(index_i_, index_j_, index_k_, Domaine_IJK::ELEM);
3688 // const Domaine_IJK& geom= ref_ijk_ft_->get_domaine();
3689 // double ddir = geom.get_constant_delta(dir) / 2.;
3690 // Vecteur3 compo_xyz = bary_cell;
3691 // ddir = sign_dir ? - ddir: ddir;
3692 // compo_xyz[dir] += bary_cell[dir] + ddir;
3693 // for (int c=0; c<3; c++)
3694 // coordinates_point(0,c) = compo_xyz[c];
3695 // ijk_interpolate_skip_unknown_points((*velocity_)[dir], coordinates_point, field_interp, INVALID_INTERP);
3696 // velocity = field_interp(0);
3697
3698 return velocity;
3699}
3700
3702{
3703 double temperature_gradient = 0;
3704 switch(dir)
3705 {
3706 case 0:
3707 temperature_gradient = get_field_profile_at_point(dist,
3710 (*grad_T_elem_)[0],
3711 0, 1,
3713 break;
3714 case 1:
3715 temperature_gradient = get_field_profile_at_point(dist,
3718 (*grad_T_elem_)[1],
3719 0, 1,
3721 break;
3722 case 2:
3723 temperature_gradient = get_field_profile_at_point(dist,
3726 (*grad_T_elem_)[2],
3727 0, 1,
3729 break;
3730 default:
3731 temperature_gradient = get_field_profile_at_point(dist,
3734 (*grad_T_elem_)[0],
3735 0, 1,
3737 break;
3738 }
3739 return temperature_gradient;
3740}
3741
3743 const int& dir,
3744 bool& valid_val,
3745 const int& l,
3746 const int& index_i,
3747 const int& index_j,
3748 const int& index_k,
3749 const int& temperature)
3750{
3752 1, 1, interp_eulerian_);
3753 if (abs(temperature_interp) > INVALID_INTERP_TEST)
3754 {
3755 temperature_interp = 0.;
3756 valid_val = false;
3757 }
3758 if (temperature)
3759 return temperature_interp;
3760 double velocity_interp = get_velocity_component_at_point(dist, dir, index_i, index_j, index_k);
3761
3763 {
3764 const double radial_corr_ = radial_velocity_[0] - radial_velocity_corrected_[0];
3765 const double first_tangential_corr = (*first_tangential_velocity_not_corrected_)[0] - (*first_tangential_velocity_solver_)[0];
3766 const double second_tangential_corr = (*second_tangential_velocity_not_corrected_)[0] - (*second_tangential_velocity_solver_)[0];
3767 velocity_interp -= (radial_corr_ * normal_vector_compo_[dir]);
3768 velocity_interp -= (first_tangential_corr * (*first_tangential_vector_compo_solver_)[dir]);
3769 velocity_interp -= (second_tangential_corr * (*second_tangential_vector_compo_solver_)[dir]);
3770 }
3771 const double temperature_interp_conv = temperature_interp_conv_flux_[dir];
3772 // temperature_interp_conv_flux_[dir] = (temperature_interp_conv + temperature_interp);
3773 if (l != -1)
3774 temperature_interp_conv_flux_[l] = (temperature_interp_conv + temperature_interp);
3775 return temperature_interp * velocity_interp;
3776}
3777
3778double IJK_One_Dimensional_Subproblem::get_temperature_gradient_times_conductivity_profile_at_point(const double& dist, const int& dir, bool& valid_val) const
3779{
3780 double diffusive_flux = 0;
3781 diffusive_flux = get_temperature_gradient_profile_at_point(dist, dir);
3782 if (abs(diffusive_flux) > INVALID_INTERP_TEST)
3783 {
3784 diffusive_flux = 0.;
3785 valid_val = false;
3786 }
3787 diffusive_flux *= (*lambda_);
3788 return diffusive_flux;
3789}
3790
3792 const int& levels,
3793 const int& dir,
3794 const DoubleVect& field,
3795 const DoubleVect& field_weak_gradient,
3796 const IJK_Field_double& eulerian_field,
3797 const int temp_bool,
3798 const int weak_gradient_variable,
3799 const int vel,
3800 const int& l)
3801{
3802 const int nb_values = (int) pow(4., (double) levels);
3803 DoubleVect discrete_values(nb_values);
3804 double surface = get_discrete_surface_at_level(dir, levels);
3805 double value;
3806 double velocity;
3807 int value_counter = 0;
3808 if (levels==0)
3809 {
3810 velocity = get_velocity_weighting(dist, dir, vel);
3811 value = get_field_profile_at_point(dist, field, field_weak_gradient, eulerian_field, temp_bool, weak_gradient_variable, interp_eulerian_);
3812 discrete_values(0) = value * surface * velocity;
3813 }
3814 else
3815 {
3816 double dl1_ini = 0.;
3817 double dl2_ini = 0.;
3818 Vecteur3 point_coords_ini = {0., 0., 0.};
3819 get_field_discrete_value_recursive(1, levels + 1, dir, dist, vel, surface,
3820 field, field_weak_gradient, eulerian_field,
3821 temp_bool, weak_gradient_variable,
3822 dl1_ini, dl2_ini,
3823 point_coords_ini, discrete_values, value_counter);
3824 }
3826 {
3827 for (int c=0; c<discrete_values.size(); c++)
3828 temperature_interp_conv_flux_[l] += discrete_values[c];
3829 }
3830 return discrete_values;
3831}
3832
3834 const int& dir, const double& dist,
3835 const int& vel,
3836 const double& surface,
3837 const DoubleVect& field,
3838 const DoubleVect& field_weak_gradient,
3839 const IJK_Field_double& eulerian_field,
3840 const int temp_bool,
3841 const int weak_gradient_variable,
3842 const double dl1_parent,
3843 const double dl2_parent,
3844 Vecteur3& point_coords_parent,
3845 DoubleVect& discrete_values,
3846 int& value_counter) const
3847{
3848 if (ilevel != max_level)
3849 {
3850 const double neighbours_first_dir[4] = NEIGHBOURS_FIRST_DIR;
3851 const double neighbours_second_dir[4] = NEIGHBOURS_SECOND_DIR;
3852 for(int i=ilevel; i<max_level; i++)
3853 {
3854 if (i==ilevel)
3855 {
3856 for(int l=0; l<4; l++)
3857 {
3858 const double first_dir = neighbours_first_dir[l];
3859 const double second_dir = neighbours_second_dir[l];
3860 double dl1;
3861 double dl2;
3862 Vecteur3 point_coords = {0., 0., 0.};
3863 get_discrete_two_dimensional_spacing(dir, ilevel, first_dir, second_dir, dl1, dl2, point_coords);
3864 dl1 += dl1_parent;
3865 dl2 += dl2_parent;
3866 point_coords += point_coords_parent;
3867 get_field_discrete_value_recursive(i+1, max_level, dir, dist, vel, surface,
3868 field, field_weak_gradient, eulerian_field,
3869 temp_bool, weak_gradient_variable,
3870 dl1, dl2, point_coords, discrete_values, value_counter);
3871 }
3872 }
3873 }
3874 }
3875 else
3876 {
3877 const double dist_increment = Vecteur3::produit_scalaire(point_coords_parent, normal_vector_compo_);
3878 const double dist_value = dist + dist_increment;
3879 // const double value = get_field_profile_at_point(dist_value, field, 0);
3880 const double value = get_field_profile_at_point(dist_value, field, field_weak_gradient, eulerian_field,
3881 temp_bool, weak_gradient_variable, interp_eulerian_);
3882 const double velocity = get_velocity_weighting(dist, dir, vel);
3883 discrete_values(value_counter) = value * surface * velocity;
3884 value_counter++;
3885 }
3886}
3887
3888double IJK_One_Dimensional_Subproblem::get_velocity_weighting(const double& dist, const int& dir, const int vel) const
3889{
3890 if (vel)
3891 return get_velocity_component_at_point(dist, dir);
3892 else
3893 return 1.;
3894}
3895
3897 const int& levels,
3898 const int& dir,
3899 const DoubleVect& field,
3900 const DoubleVect& field_weak_gradient,
3901 const IJK_Field_double& eulerian_field,
3902 const int temp_bool,
3903 const int weak_gradient_variable)
3904{
3906 field, field_weak_gradient,
3907 eulerian_field,
3908 temp_bool, weak_gradient_variable, 0);
3909}
3910
3912 const int& levels,
3913 const int& dir,
3914 const DoubleVect& field,
3915 const DoubleVect& field_weak_gradient,
3916 const IJK_Field_double& eulerian_field,
3917 const int& l)
3918{
3920 field, field_weak_gradient, eulerian_field,
3921 1, 1, 1, l);
3922}
3923
3925 const int& levels,
3926 const int& dir)
3927{
3929}
3930
3932 const int& levels,
3933 const int& dir,
3934 const int& l)
3935{
3937}
3938
3940 const int& levels,
3941 const int& dir)
3942{
3943 DoubleVect temperature_gradient;
3944 switch(dir)
3945 {
3946 case 0:
3947 temperature_gradient = get_field_discrete_integral_at_point(dist, levels, dir,
3949 (*grad_T_elem_)[0], 0, 1);
3950 break;
3951 case 1:
3952 temperature_gradient = get_field_discrete_integral_at_point(dist, levels, dir,
3954 (*grad_T_elem_)[1], 0, 1);
3955 break;
3956 case 2:
3957 temperature_gradient = get_field_discrete_integral_at_point(dist, levels, dir,
3959 (*grad_T_elem_)[2], 0, 1);
3960 break;
3961 default:
3962 temperature_gradient = get_field_discrete_integral_at_point(dist, levels, dir,
3964 (*grad_T_elem_)[0], 0, 1);
3965 break;
3966 }
3967 return temperature_gradient;
3968}
3969
3971{
3972 DoubleVect diffusive_flux = get_temperature_gradient_profile_discrete_integral_at_point(dist, levels, dir);
3973 diffusive_flux *= (*lambda_);
3974 return diffusive_flux;
3975}
3976
3977void IJK_One_Dimensional_Subproblem::find_interval(const double& dist, int& left_interval, int& right_interval) const
3978{
3979 int mid_interval = left_interval + (right_interval - left_interval) / 2;
3980 while ((right_interval - left_interval) != 1)
3981 {
3982 if (dist > (*radial_coordinates_)[mid_interval])
3983 left_interval = mid_interval;
3984 else
3985 right_interval = mid_interval;
3986 mid_interval = left_interval + (right_interval - left_interval) / 2;
3987 }
3988}
3989
3991 const double& first_dir, const double& second_dir,
3992 double& dl1, double& dl2,
3993 Vecteur3& point_coords) const
3994{
3995 const Domaine_IJK& geom = ref_ijk_ft_->get_domaine();
3996 const double dx = geom.get_constant_delta(DIRECTION_I);
3997 const double dy = geom.get_constant_delta(DIRECTION_J);
3998 const double dz = geom.get_constant_delta(DIRECTION_K);
3999 switch(dir)
4000 {
4001 case 0:
4002 dl1 = dy;
4003 dl2 = dz;
4004 point_coords[1] = dl1 * first_dir;
4005 point_coords[2] = dl2 * second_dir;
4006 break;
4007 case 1:
4008 dl1 = dx;
4009 dl2 = dz;
4010 point_coords[0] = dl1 * first_dir;
4011 point_coords[2] = dl2 * second_dir;
4012 break;
4013 case 2:
4014 dl1 = dx;
4015 dl2 = dy;
4016 point_coords[0] = dl1 * first_dir;
4017 point_coords[1] = dl2 * second_dir;
4018 break;
4019 default:
4020 dl1 = dx;
4021 dl2 = dy;
4022 point_coords[0] = dl1 * first_dir;
4023 point_coords[1] = dl2 * second_dir;
4024 break;
4025 }
4026 dl1 /= pow(2., (double) levels + 1.);
4027 dl2 /= pow(2., (double) levels + 1.);
4028 dl1 *= first_dir;
4029 dl2 *= second_dir;
4030 point_coords *= (1 / pow(2., (double) levels + 1.));
4031}
4032
4033double IJK_One_Dimensional_Subproblem::get_discrete_surface_at_level(const int& dir, const int& level) const
4034{
4035 const Domaine_IJK& geom = ref_ijk_ft_->get_domaine();
4036 const double dx = geom.get_constant_delta(DIRECTION_I);
4037 const double dy = geom.get_constant_delta(DIRECTION_J);
4038 const double dz = geom.get_constant_delta(DIRECTION_K);
4039 double surface = 0.;
4040 switch(dir)
4041 {
4042 case 0:
4043 surface = (dy*dz);
4044 break;
4045 case 1:
4046 surface = (dx*dz);
4047 break;
4048 case 2:
4049 surface = (dx*dy);
4050 break;
4051 default:
4052 surface = (dx*dy);
4053 break;
4054 }
4055 surface /= pow(pow(2., (double) level), 2.);
4056 return surface;
4057}
4058
4063
4065{
4066 double max_distance = distance;
4067 if (distance <= 0 || distance > probe_length_)
4068 max_distance = probe_length_;
4069 ArrOfDouble discrete_int_eval(*points_per_thermal_subproblem_ - 1);
4070 double integral_eval = 0.;
4071 const double radial_incr = max_distance / (*points_per_thermal_subproblem_ - 1);
4072 for (int i=0; i<(*points_per_thermal_subproblem_) - 1; i++)
4073 {
4074 discrete_int_eval(i) = get_temperature_profile_at_point(radial_incr * i);
4075 discrete_int_eval(i) += get_temperature_profile_at_point(radial_incr * (i + 1));
4076 discrete_int_eval(i) *= (radial_incr / 2.);
4077 integral_eval += discrete_int_eval(i);
4078 }
4079 integral_eval *= (1 / (radial_incr + 1e-20));
4080 return integral_eval;
4081}
4082
4084{
4087 nusselt_number_ *= ((2* (*radius_from_volumes_per_bubble_)(compo_connex_)) / (*delta_temperature_));
4088 nusselt_number_liquid_temperature_ *= ((2 * (*radius_from_volumes_per_bubble_)(compo_connex_)) / (*mean_liquid_temperature_));
4089 const double atan_theta_incr_ini = M_PI / 2;
4090 const double atan_incr_factor = -1;
4091 const double theta = (theta_sph_ * atan_incr_factor) + atan_theta_incr_ini;
4092 DoubleVect radius_squared = osculating_radial_coordinates_;
4093 radius_squared *= radius_squared;
4094 radius_squared *= (double) std::sin(theta);
4096 nusselt_number_integrand_ *= radius_squared;
4099}
4100
4101
4103 SFichier& fic_shell,
4104 const int rank,
4105 const Nom& local_quantities_thermal_probes_time_index_folder)
4106{
4109 post_process_radial_quantities(rank, local_quantities_thermal_probes_time_index_folder);
4110}
4111
4112void IJK_One_Dimensional_Subproblem::thermal_subresolution_outputs_parallel(const int rank, const Nom& local_quantities_thermal_probes_time_index_folder)
4113{
4114 post_process_radial_quantities(rank, local_quantities_thermal_probes_time_index_folder);
4115}
4116
4118 const int& itr,
4119 std::vector<std::string> key_results_int,
4120 std::vector<std::string> key_results_double,
4121 std::map<std::string, ArrOfInt>& results_probes_int,
4122 std::map<std::string, ArrOfDouble>& results_probes_double)
4123{
4125 key_results_int, key_results_double,
4126 results_probes_int, results_probes_double,
4128}
4129
4131 const int& itr,
4132 std::vector<std::string> key_results_int,
4133 std::vector<std::string> key_results_double,
4134 std::map<std::string, ArrOfInt>& results_probes_int,
4135 std::map<std::string, ArrOfDouble>& results_probes_double,
4136 const int& coord)
4137{
4138 const double last_time = ref_ijk_ft_->schema_temps_ijk().get_current_time() - ref_ijk_ft_->schema_temps_ijk().get_timestep();
4139 const int last_time_index = ref_ijk_ft_->schema_temps_ijk().get_tstep() + (*latastep_reprise_);
4140 std::vector<int> results_int =
4141 {
4143 };
4144
4145 std::vector<double> results_double =
4146 {
4147 last_time,
4148 (*radial_coordinates_)[coord],
4157 (*eulerian_grad_T_interface_ns_)(index_i_, index_j_, index_k_),
4171 surface_, thermal_flux_[coord],
4174 (*lambda_), (*alpha_), (*prandtl_number_),
4178 pressure_interp_[coord],
4179 x_velocity_[coord], y_velocity_[coord], z_velocity_[coord],
4195 (*bubbles_surface_)(compo_connex_), (*bubbles_volume_)(compo_connex_),
4197 (*delta_temperature_), (*mean_liquid_temperature_),
4198 (*bubbles_rising_vectors_per_bubble_)(compo_connex_, 0),
4205 };
4206 int i;
4207 assert(key_results_int.size() == results_int.size());
4208 int size_int = (int) key_results_int.size();
4209 for (i=0; i<size_int; i++)
4210 results_probes_int[key_results_int[i]](itr) = results_int[i];
4211 assert(key_results_double.size() == results_double.size());
4212 int size_double = (int) key_results_double.size();
4213 for (i=0; i<size_double; i++)
4214 results_probes_double[key_results_double[i]](itr) = results_double[i];
4215
4216}
4217
4218
4219void IJK_One_Dimensional_Subproblem::post_process_interfacial_quantities(SFichier& fic, const int rank, const int& coord) //SFichier& fic)
4220{
4221 // if (Process::je_suis_maitre())
4222 {
4223 if (is_updated_)
4224 {
4225 const double last_time = ref_ijk_ft_->schema_temps_ijk().get_current_time() - ref_ijk_ft_->schema_temps_ijk().get_timestep();
4226 const int last_time_index = ref_ijk_ft_->schema_temps_ijk().get_tstep() + (*latastep_reprise_);
4227 fic << last_time_index << " ";
4228 fic << rank << " " << index_post_processing_ << " " << global_subproblem_index_ << " " << sub_problem_index_ << " ";
4229 fic << last_time << " ";
4230 fic << (*radial_coordinates_)[coord] << " ";
4231 fic << normal_vector_compo_[0] << " " << normal_vector_compo_[1] << " " << normal_vector_compo_[2] << " ";
4235 fic << azymuthal_vector_compo_[0] << " " << azymuthal_vector_compo_[1] << " " << azymuthal_vector_compo_[2] << " ";
4236 fic << r_sph_ << " " << theta_sph_ << " " << phi_sph_ << " ";
4237 fic << temperature_interp_[coord] << " " << temperature_solution_[coord] << " " << temperature_previous_[coord] << " ";
4239 fic << (*eulerian_grad_T_interface_ns_)(index_i_, index_j_, index_k_) << " ";
4240 fic << hess_diag_T_elem_spherical_[0][coord] << " " << normal_temperature_double_derivative_solution_[coord] << " ";
4241 fic << tangential_temperature_gradient_first_[coord] << " ";
4242 fic << tangential_temperature_gradient_second_[coord] << " ";
4244 fic << azymuthal_temperature_gradient_[coord] << " ";
4246 fic << temperature_diffusion_hessian_trace_[coord] << " ";
4247 fic << radial_temperature_diffusion_[coord] << " ";
4248 fic << radial_temperature_diffusion_solution_[coord] << " ";
4249 fic << tangential_temperature_diffusion_[coord] << " ";
4250 fic << radial_scale_factor_interp_[coord] << " " << radial_scale_factor_solution_[coord] << " ";
4251 fic << radial_convection_interp_[coord] << " " << radial_convection_solution_[coord] << " ";
4253 fic << surface_ << " " << thermal_flux_[coord] << " ";
4254 fic << thermal_flux_gfm_ << " " << thermal_flux_raw_ << " ";
4255 fic << thermal_flux_lrs_ << " " << thermal_flux_max_ << " ";
4256 fic << *lambda_ << " " << *alpha_ << " " << *prandtl_number_ << " ";
4257 fic << nusselt_number_[coord] << " " << nusselt_number_liquid_temperature_[coord] << " ";
4258 fic << nusselt_number_integrand_[coord] << " " << nusselt_number_liquid_temperature_integrand_[coord] << " ";
4259 fic << velocity_shear_force_ << " " << velocity_shear_stress_ << " ";
4260 fic << pressure_interp_[coord] << " ";
4261 fic << x_velocity_[coord] << " " << y_velocity_[coord] << " " << z_velocity_[coord] << " ";
4262 fic << radial_velocity_[coord] << " " << radial_velocity_corrected_[coord] << " ";
4263 fic << radial_velocity_static_frame_[coord] << " " << radial_velocity_advected_frame_[coord] << " ";
4264 fic << first_tangential_velocity_[coord] << " " << first_tangential_velocity_corrected_[coord] << " ";
4266 fic << second_tangential_velocity_[coord] << " " << second_tangential_velocity_corrected_[coord] << " ";
4270 fic << azymuthal_velocity_[coord] << " " << azymuthal_velocity_corrected_[coord] << " ";
4271 fic << azymuthal_velocity_static_frame_[coord] << " " << azymuthal_velocity_advected_frame_[coord] << " ";
4272 fic << normal_velocity_normal_gradient_[coord] << " ";
4273 fic << first_tangential_velocity_normal_gradient_[coord] << " ";
4276 fic << azymuthal_velocity_normal_gradient_[coord] << " ";
4277 fic << (*bubbles_surface_)(compo_connex_) << " " << (*bubbles_volume_)(compo_connex_) << " ";
4278 fic << (*radius_from_surfaces_per_bubble_)(compo_connex_) << " " << (*radius_from_volumes_per_bubble_)(compo_connex_) << " ";
4279 fic << (*delta_temperature_) << " " << (*mean_liquid_temperature_) << " ";
4280 fic << (*bubbles_rising_vectors_per_bubble_)(compo_connex_, 0) << " ";
4281 fic << (*bubbles_rising_vectors_per_bubble_)(compo_connex_, 1) << " ";
4282 fic << (*bubbles_rising_vectors_per_bubble_)(compo_connex_, 2) << " ";
4283 fic << bubble_rising_velocity_compo_[0] << " ";
4284 fic << bubble_rising_velocity_compo_[1] << " ";
4285 fic << bubble_rising_velocity_compo_[2] << " ";
4286 fic << bubble_rising_velocity_ << " ";
4287 fic << finl;
4288 }
4289 }
4290}
4291
4292void IJK_One_Dimensional_Subproblem::post_process_radial_quantities(const int rank, const Nom& local_quantities_thermal_probes_time_index_folder)
4293{
4294 // if (Process::je_suis_maitre())
4295 {
4297 {
4298 const int reset = 1;
4299 const int max_digit = 8;
4300 const int last_time_index = (*latastep_reprise_) + ref_ijk_ft_->schema_temps_ijk().get_tstep();
4301 const int nb_digit_index_post_pro = index_post_processing_ < 1 ? 1 : (int) (log10(index_post_processing_) + 1);
4302 const int nb_digit_index_global = global_subproblem_index_ < 1 ? 1 : (int) (log10(global_subproblem_index_) + 1);
4303 const int nb_digit_tstep = last_time_index < 1 ? 1 : (int) (log10(last_time_index) + 1);
4304 const int max_digit_rank = 3;
4305 const int nb_digit_rank = rank < 1 ? 1 : (int) (log10(rank) + 1);
4306 Nom probe_name = Nom("_thermal_rank_") + Nom(std::string(max_digit_rank - nb_digit_rank, '0')) + Nom(rank) + Nom("_thermal_subproblem_") + Nom(std::string(max_digit - nb_digit_index_post_pro, '0'))
4308 + Nom("_global_") + Nom(std::string(max_digit - nb_digit_index_global, '0')) + Nom(global_subproblem_index_)
4309 + Nom("_radial_quantities_time_index_") +
4310 + Nom(std::string(max_digit - nb_digit_tstep, '0')) + Nom(last_time_index) + Nom(".out");
4311 Nom probe_header = Nom("tstep\tthermal_rank\tpost_pro_index\tglobal_subproblem\tlocal_subproblem\ttime"
4312 "\tnx\tny\tnz"
4313 "\tt1x\tt1y\tt1z"
4314 "\tt2x\tt2y\tt2z"
4315 "\ts1x\ts1y\ts1z"
4316 "\ts2x\ts2y\ts2z"
4317 "\tr_sph\ttheta_sph\tphi_sph"
4318 "\tradial_coord"
4319 "\ttemperature_interp\ttemperature_sol\ttemperature_prev"
4320 "\ttemperature_gradient\ttemperature_gradient_sol"
4321 "\ttemperature_double_deriv\ttemperature_double_deriv_sol"
4322 "\ttemperature_gradient_tangential\ttemperature_gradient_tangential2"
4323 "\ttemperature_gradient_tangential_rise\ttemperature_gradient_azymuthal"
4324 "\ttemperature_diffusion_hessian_cartesian_trace"
4325 "\ttemperature_diffusion_hessian_trace"
4326 "\tradial_temperature_diffusion"
4327 "\tradial_temperature_diffusion_sol"
4328 "\ttangential_temperature_diffusion"
4329 "\tradial_scale_factor_interp\tradial_scale_factor_sol"
4330 "\tradial_convection_interp\tradial_convection_sol"
4331 "\ttangential_convection_first\ttangential_convection_second"
4332 "\tsurface\tthermal_flux"
4333 "\tlambda_liq\talpha_liq\tprandtl_liq"
4334 "\tnusselt_number\tnusselt_number_liquid_temperature"
4335 "\tnusselt_number_integrand\tnusselt_number_liquid_temperature_integrand"
4336 "\tshear\tforce"
4337 "\tpressure"
4338 "\tu_x\tu_y\tu_z"
4339 "\tu_r\tu_r_corr\tu_r_static\tu_r_advected"
4340 "\tu_theta\tu_theta_corr\tu_theta_static\tu_theta_advected"
4341 "\tu_theta2\tu_theta2_corr\tu_theta2_static\tu_theta2_advected"
4342 "\tu_theta_rise\tu_theta_rise_corr\tu_theta_rise_static\tu_theta_rise_advected"
4343 "\tu_phi\tu_phi_corr\tu_phi_static\tu_phi_advected"
4344 "\tdu_r_dr\tdu_theta_dr\tdu_theta2_dr\tdu_theta_rise_dr\tdu_phi_dr"
4345 "\ttotal_surface\ttotal_volume\tradius_from_surface\tradius_from_volume"
4346 "\tdelta_temperature\tmean_liquid_temperature"
4347 "\trising_dir_x\trising_dir_y\trising_dir_z"
4348 "\trising_vel_x\trising_vel_y\trising_vel_z"
4349 "\trising_vel");
4350 SFichier fic = Open_file_folder(local_quantities_thermal_probes_time_index_folder, probe_name, probe_header, reset);
4351 const double last_time = ref_ijk_ft_->schema_temps_ijk().get_current_time() - ref_ijk_ft_->schema_temps_ijk().get_timestep();
4352 for (int i=0; i<(*points_per_thermal_subproblem_); i++)
4353 {
4354 fic << last_time_index << " ";
4355 fic << rank << " " << index_post_processing_ << " " << global_subproblem_index_ << " " << sub_problem_index_ << " ";
4356 fic << last_time << " ";
4357 fic << normal_vector_compo_[0] << " " << normal_vector_compo_[1] << " " << normal_vector_compo_[2] << " ";
4361 fic << azymuthal_vector_compo_[0] << " " << azymuthal_vector_compo_[1] << " " << azymuthal_vector_compo_[2] << " ";
4362 fic << r_sph_ << " " << theta_sph_ << " " << phi_sph_ << " ";
4363 fic << (*radial_coordinates_)[i] << " ";
4364 fic << temperature_interp_[i] << " " << temperature_solution_[i] << " " << temperature_previous_[i] << " ";
4370 fic << azymuthal_temperature_gradient_[i] << " ";
4372 fic << temperature_diffusion_hessian_trace_[i] << " ";
4373 fic << radial_temperature_diffusion_[i] << " ";
4375 fic << tangential_temperature_diffusion_[i] << " ";
4376 fic << radial_scale_factor_interp_[i] << " " << radial_scale_factor_solution_[i] << " ";
4377 fic << radial_convection_interp_[i] << " " << radial_convection_solution_[i] << " ";
4379 fic << surface_ << " " << thermal_flux_[i] << " ";
4380 // fic << << " " << << " ";
4381 // fic << << " " << << " ";
4382 fic << *lambda_ << " " << *alpha_ << " " << *prandtl_number_ << " ";
4383 fic << nusselt_number_[i] << " " << nusselt_number_liquid_temperature_[i] << " ";
4385 fic << shear_stress_[i] << " " << (shear_stress_[i] * surface_) << " ";
4386 fic << pressure_interp_[i] << " ";
4387 fic << x_velocity_[i] << " " << y_velocity_[i] << " " << z_velocity_[i] << " ";
4388 fic << radial_velocity_[i] << " " << radial_velocity_corrected_[i] << " ";
4396 fic << azymuthal_velocity_[i] << " " << azymuthal_velocity_corrected_[i] << " ";
4398 fic << normal_velocity_normal_gradient_[i] << " ";
4402 fic << azymuthal_velocity_normal_gradient_[i] << " ";
4403 fic << (*bubbles_surface_)(compo_connex_) << " " << (*bubbles_volume_)(compo_connex_) << " ";
4404 fic << (*radius_from_surfaces_per_bubble_)(compo_connex_) << " " << (*radius_from_volumes_per_bubble_)(compo_connex_) << " ";
4405 fic << (*delta_temperature_) << " " << (*mean_liquid_temperature_) << " ";
4406 fic << (*bubbles_rising_vectors_per_bubble_)(compo_connex_, 0) << " ";
4407 fic << (*bubbles_rising_vectors_per_bubble_)(compo_connex_, 1) << " ";
4408 fic << (*bubbles_rising_vectors_per_bubble_)(compo_connex_, 2) << " ";
4409 fic << bubble_rising_velocity_compo_[0] << " ";
4410 fic << bubble_rising_velocity_compo_[1] << " ";
4411 fic << bubble_rising_velocity_compo_[2] << " ";
4412 fic << bubble_rising_velocity_ << " ";
4413 fic << finl;
4414 }
4415 fic.close();
4416 }
4417 }
4418}
4419
4421{
4422 double min_temperature_value=1e20;
4423 for (int i=0; i<temperature_solution_.size(); i++)
4424 min_temperature_value = std::min(min_temperature_value, temperature_solution_[i]);
4425 return min_temperature_value;
4426}
4427
4429{
4430 double max_temperature_value=-1e20;
4431 for (int i=0; i<temperature_solution_.size(); i++)
4432 max_temperature_value = std::max(max_temperature_value, temperature_solution_[i]);
4433 return max_temperature_value;
4434}
4435
4437{
4438 double min_temperature_value = std::min(temperature_solution_[0], temperature_solution_[temperature_solution_.size()-1]);
4439 return min_temperature_value;
4440}
4441
4443{
4444 double max_temperature_value = std::max(temperature_solution_[0], temperature_solution_[temperature_solution_.size()-1]);
4445 return max_temperature_value;
4446}
4447
4449{
4451 {
4452 const Domaine_IJK& geom = ref_ijk_ft_->get_domaine();
4453 const int face_dir[6] = FACES_DIR;
4454 const int flux_out[6] = FLUXES_OUT;
4455 const double rho_cp = ref_ijk_ft_->milieu_ijk().get_rho_liquid() * (*cp_liquid_);
4456 FixedVector<double, 6> convective_term_frame_of_ref = temperature_interp_conv_flux_;
4457 for (int l=0; l<6; l++)
4458 convective_term_frame_of_ref[l] *= bubble_rising_velocity_compo_[face_dir[l]];
4459 convective_term_frame_of_ref *= (-1) * rho_cp;
4460 double surf_face;
4461 for (int l=0; l<6; l++)
4462 {
4463 surf_face = 1.;
4465 {
4466 for (int c = 0; c < 3; c++)
4467 if (c!=face_dir[l])
4468 surf_face *= geom.get_constant_delta(c);
4469 double flux_val = convective_term_frame_of_ref[face_dir[l]] * flux_out[l] * surf_face;
4470 const double sign_temp = signbit(*delta_temperature_) ? -1. : 1.;
4471 flux_val *= sign_temp;
4472 sum_convective_flux_op_lrs_ += flux_val;
4473 if (sign_temp * flux_val >= 0)
4475 else
4477 }
4478 }
4480 }
4481}
4482
4483//const double& IJK_One_Dimensional_Subproblem::get_sum_convective_diffusive_flux_op_value_lrs(const int flux_type)
4484
4485void IJK_One_Dimensional_Subproblem::set_pure_flux_corrected(const double& flux_face, const int& l, const int flux_type)
4486{
4487 /*
4488 * Positive contributions for flux outward
4489 */
4490 const double sign_temp = signbit(*delta_temperature_) ? -1. : 1.;
4491 if (flux_type==0)
4492 {
4493 const double rho_cp = ref_ijk_ft_->milieu_ijk().get_rho_liquid() * (*cp_liquid_);
4494 const double rho_cp_flux = rho_cp * flux_face * sign_temp;
4495 convective_flux_op_lrs_[l] = rho_cp_flux;
4496 sum_convective_flux_op_lrs_ += rho_cp_flux;
4497 if (rho_cp_flux >= 0)
4499 else
4501 }
4502 else
4503 {
4504 const double flux_face_sign = sign_temp * flux_face;
4505 diffusive_flux_op_lrs_[l] = flux_face_sign;
4506 sum_diffusive_flux_op_lrs_ += flux_face_sign;
4507 if (flux_face_sign >= 0)
4508 sum_diffusive_flux_op_leaving_lrs_ += flux_face_sign;
4509 else
4510 sum_diffusive_flux_op_entering_lrs_ += flux_face_sign;
4511 }
4512}
4513
4515{
4516 const double sign_temp = signbit(*delta_temperature_) ? -1. : 1.;
4517
4518 double total_flux_error = 0.;
4519 total_flux_error = (- thermal_flux_abs_);
4520 total_flux_error += (- sum_convective_flux_op_lrs_);
4521 total_flux_error += sum_diffusive_flux_op_lrs_;
4522
4523 double weight_tot = 0.;
4524 const int face_dir[6] = FACES_DIR;
4525 const int flux_out[6] = FLUXES_OUT;
4526
4527
4528 int counter_assert = 0;
4529 double weight = 0.;
4530 std::vector<int> mixed_neighbours;
4531 for (int l=0; l<6; l++)
4533 {
4534 double normal_compo = normal_vector_compo_[face_dir[l]];
4535 if (signbit(flux_out[l]) == signbit(normal_compo))
4536 {
4537 const int ii = NEIGHBOURS_I[l];
4538 const int jj = NEIGHBOURS_J[l];
4539 const int kk = NEIGHBOURS_K[l];
4540 const int isolated_mixed_neighbours = (*zero_liquid_neighbours_)(index_i_ + ii, index_j_ + jj, index_k_ + kk);
4541 if (!isolated_mixed_neighbours)
4542 {
4544 weight_tot += abs(weight);
4545 mixed_neighbours.push_back(l);
4546 counter_assert++;
4547 }
4548 else
4549 {
4550 if (debug_)
4551 Cerr << "The neighbour is isolated" << finl;
4552 }
4553 }
4554 }
4555
4556 for (int l=0; l<6; l++)
4558 {
4559 double normal_compo = normal_vector_compo_[face_dir[l]];
4560 if (signbit(flux_out[l]) == signbit(normal_compo))
4561 {
4563 corrective_flux_current_[l] = (total_flux_error * abs(weight) * flux_out[l] * sign_temp);
4564 weight_tot += abs(weight);
4565 counter_assert++;
4566 }
4567 }
4568
4569 if (debug_)
4570 Cerr << "counter_assert: " << counter_assert << finl;
4571 assert(counter_assert <= 3);
4572 if (counter_assert)
4573 {
4574 corrective_flux_current_ *= (1 / weight_tot);
4575 for (int m=0; m<(int) mixed_neighbours.size(); m++)
4576 {
4577 const int mixed_neighbour = mixed_neighbours[m];
4578 // const double normal_compo = abs(normal_vector_compo_[face_dir[mixed_neighbour]]);
4580 corrective_flux_to_neighbours_[mixed_neighbour] = (total_flux_error * abs(weight)) / weight_tot;
4581 // * flux_out[mixed_neighbour]
4582 }
4583 }
4584 else
4585 {
4586 Cerr << "Some fluxes contributions are not relocated !" << finl;
4587 }
4588
4589 for (int l=0; l<6; l++)
4590 diffusive_flux_op_lrs_[l] = 0.;
4594}
4595
4596void IJK_One_Dimensional_Subproblem::compute_weighting_coefficient(const int& l, double& weight, const int& weight_type)
4597{
4598 weight = 0.;
4599 const int face_dir[6] = FACES_DIR;
4600 const int dir = face_dir[l];
4601 if (weight_type == 0)
4602 weight = normal_vector_compo_[dir];
4603 else
4604 {
4605 const int flux_out[6] = FLUXES_OUT;
4606 const double kinematic_viscosity = ref_ijk_ft_->milieu_ijk().get_mu_liquid() / ref_ijk_ft_->milieu_ijk().get_rho_liquid();
4607 const double velocity = (*first_tangential_velocity_solver_)[0] * (*first_tangential_vector_compo_solver_)[dir]
4608 + (*second_tangential_velocity_solver_)[0] * (*second_tangential_vector_compo_solver_)[dir];
4609 Vecteur3 first_vel = (*first_tangential_vector_compo_solver_);
4610 first_vel *= (*first_tangential_velocity_solver_)[0];
4611 Vecteur3 second_vel = (*second_tangential_vector_compo_solver_);
4612 second_vel *= (*second_tangential_velocity_solver_)[0];
4613 Vecteur3 vel_vect = first_vel;
4614 vel_vect += second_vel;
4615 const double vel_vect_norm = vel_vect.length();
4616 if (vel_vect_norm > 1e-12)
4617 vel_vect *= (1 / vel_vect_norm);
4618 const int vel_sign = signbit(velocity);
4619 const int vel_effect = (vel_sign == signbit(flux_out[l])) ? 1. : 0.;
4620 if (weight_type == 1)
4621 weight = kinematic_viscosity * vel_effect * vel_vect[dir];
4622 else
4623 weight = (*alpha_) * normal_vector_compo_[dir] + kinematic_viscosity * vel_effect * vel_vect[dir];
4624 }
4625}
4626
4627void IJK_One_Dimensional_Subproblem::compare_flux_interface(std::vector<double>& radial_flux_error)
4628{
4629 const int flux_out[6] = FLUXES_OUT;
4632 double weight_tot = 0.;
4633 for (int l=0; l<3; l++)
4634 weight_tot += abs(normal_vector_compo_[l]);
4635 const int face_dir[6] = FACES_DIR;
4636 std::vector<double> thermal_flux_neighbour;
4637 for (int l=0; l<6; l++)
4638 {
4639 // FIXME: There are more than 3 faces sometimes !!!!!
4641 {
4642 const double weight = abs(normal_vector_compo_[face_dir[l]]);
4643 // const double flux_sum = convective_flux_op_lrs_[l] + diffusive_flux_op_lrs_[l];
4644 // const double weight = abs(flux_sum);
4645 // weight_tot += weight;
4646 const double radial_flux_contrib = (weight * radial_flux_error_lrs_ ) * flux_out[l];
4647 thermal_flux_neighbour.push_back(- thermal_flux_dir_[face_dir[l]] * flux_out[l]);
4648 radial_flux_error.push_back(radial_flux_contrib);
4649 }
4650 }
4651 for (int l=0; l<(int) radial_flux_error.size(); l++)
4652 {
4653 radial_flux_error[l] /= weight_tot;
4654 radial_flux_error[l] += thermal_flux_neighbour[l];
4655 }
4656 // sum_convective_diffusive_flux_op_lrs_ = thermal_flux_[0];
4657 // TODO: TMP for post-processing
4658 // sum_convective_flux_op_lrs_ = 0.;
4659 // sum_diffusive_flux_op_lrs_ = sum_convective_diffusive_flux_op_lrs_;
4660}
4661
4662void IJK_One_Dimensional_Subproblem::dispatch_interfacial_heat_flux_correction(IJK_Field_vector3_double& interfacial_heat_flux_dispatched,
4663 FixedVector<ArrOfInt, 4>& ijk_indices_out,
4664 ArrOfDouble& thermal_flux_out,
4665 IJK_Field_vector3_double& interfacial_heat_flux_current)
4666{
4669
4670 const int ni = ref_ijk_ft_->get_interface().I().ni();
4671 const int nj = ref_ijk_ft_->get_interface().I().nj();
4672 const int nk = ref_ijk_ft_->get_interface().I().nk();
4673
4674 const Domaine_IJK& geometry = ref_ijk_ft_->get_interface().I().get_domaine();
4675 const int offset_i = geometry.get_offset_local(0);
4676 const int offset_j = geometry.get_offset_local(1);
4677 const int offset_k = geometry.get_offset_local(2);
4678
4679 const int ni_tot = geometry.get_nb_elem_tot(0);
4680 const int nj_tot = geometry.get_nb_elem_tot(1);
4681 const int nk_tot = geometry.get_nb_elem_tot(2);
4682
4683 const int face_dir[6] = FACES_DIR;
4684 // const int flux_out[6] = FLUXES_OUT;
4685
4686 int index_i_neighbour_global, index_j_neighbour_global, index_k_neighbour_global;
4687 int index_i_procs, index_j_procs, index_k_procs;
4688 for (int l=0; l<6; l++)
4689 {
4690 interfacial_heat_flux_current[face_dir[l]](index_i_,index_j_,index_k_) += corrective_flux_current_[l];
4691 const double flux_corr = corrective_flux_to_neighbours_[l];
4692 if (abs(flux_corr) > 1e-16)
4693 {
4694 const int ii = NEIGHBOURS_I[l];
4695 const int jj = NEIGHBOURS_J[l];
4696 const int kk = NEIGHBOURS_K[l];
4697 const int i = index_i_ + ii;
4698 const int j = index_j_ + jj;
4699 const int k = index_k_ + kk;
4700 index_i_neighbour_global = compute_periodic_index((i + offset_i), ni_tot);
4701 index_j_neighbour_global = compute_periodic_index((j + offset_j), nj_tot);
4702 index_k_neighbour_global = compute_periodic_index((k + offset_k), nk_tot);
4703 index_i_procs = compute_periodic_index(i, ni);
4704 index_j_procs = compute_periodic_index(j, nj);
4705 index_k_procs = compute_periodic_index(k, nk);
4706 if (index_i_procs == i
4707 && index_j_procs == j
4708 && index_k_procs == k)
4709 {
4710 interfacial_heat_flux_dispatched[face_dir[l]](i,j,k) += flux_corr;
4711 }
4712 else
4713 {
4714 ijk_indices_out[0].append_array(index_i_neighbour_global);
4715 ijk_indices_out[1].append_array(index_j_neighbour_global);
4716 ijk_indices_out[2].append_array(index_k_neighbour_global);
4717 ijk_indices_out[3].append_array(face_dir[l]);
4718 thermal_flux_out.append_array(flux_corr);
4719 }
4720 }
4721 }
4722}
4723
4724void IJK_One_Dimensional_Subproblem::dispatch_interfacial_heat_flux(IJK_Field_vector3_double& interfacial_heat_flux_dispatched,
4725 FixedVector<ArrOfInt, 3>& ijk_indices_out,
4726 FixedVector<ArrOfDouble, 3>& thermal_flux_out)
4727{
4730
4731 const int ni = ref_ijk_ft_->get_interface().I().ni();
4732 const int nj = ref_ijk_ft_->get_interface().I().nj();
4733 const int nk = ref_ijk_ft_->get_interface().I().nk();
4734
4735 bool is_all_mix = true;
4736 double weight_tot = 0.;
4737 for (int l=0; l<3; l++)
4738 weight_tot += abs(normal_vector_compo_[l]);
4739 const int face_dir[6] = FACES_DIR;
4740 const int flux_out[6] = FLUXES_OUT;
4741 std::vector<int> mixed_neighbours;
4742 for (int l=0; l<6; l++)
4743 {
4745 is_all_mix = false;
4746 else if (!pure_vapour_neighbours_[l])
4747 {
4748 if (signbit(flux_out[l]) == signbit(normal_vector_compo_[face_dir[l]]))
4749 mixed_neighbours.push_back(l);
4750 // weight_tot += normal_vector_compo_[face_dir[l]];
4751 }
4752 }
4753 if (is_all_mix)
4754 for (int l=0; l<(int) mixed_neighbours.size(); l++)
4755 for (int m=0; m<(int) mixed_neighbours.size(); m++)
4756 if (m!=l)
4757 {
4758 const int mixed_neighbour = mixed_neighbours[l];
4759 const int neighbour_dir = mixed_neighbours[m];
4760 const int ii = NEIGHBOURS_I[mixed_neighbour];
4761 const int jj = NEIGHBOURS_J[mixed_neighbour];
4762 const int kk = NEIGHBOURS_K[mixed_neighbour];
4763 const int i = index_i_ + ii;
4764 const int j = index_j_ + jj;
4765 const int k = index_k_ + kk;
4766 const double weight = abs(normal_vector_compo_[face_dir[mixed_neighbour]]) * abs(normal_vector_compo_[face_dir[neighbour_dir]]);
4767 const double heat_flux_dispatch = thermal_flux_total_ * weight / (weight_tot * weight_tot);
4768 if ((i==ni || i==-1) || (j==nj || j==-1) || (k==nk || k==-1))
4769 {
4770 ijk_indices_out[0].append_array(i);
4771 ijk_indices_out[1].append_array(j);
4772 ijk_indices_out[2].append_array(k);
4773 thermal_flux_out[face_dir[neighbour_dir]].append_array(heat_flux_dispatch);
4774 for (int n=0; n<(int) mixed_neighbours.size(); n++)
4775 if (n != m)
4776 {
4777 const int neighbour_dir_tmp = mixed_neighbours[n];
4778 thermal_flux_out[face_dir[neighbour_dir_tmp]].append_array(0.);
4779 }
4780 }
4781 else
4782 interfacial_heat_flux_dispatched[face_dir[neighbour_dir]](i, j, k) += heat_flux_dispatch;
4783 }
4784}
4785
4786void IJK_One_Dimensional_Subproblem::add_interfacial_heat_flux_neighbours_correction(IJK_Field_vector3_double& interfacial_heat_flux_dispatched,
4787 IJK_Field_vector3_double& interfacial_heat_flux_current)
4788{
4789 const int isolated_mixed_cell = (*zero_liquid_neighbours_)(index_i_, index_j_, index_k_);
4790 if (!isolated_mixed_cell)
4791 {
4792 const double sign_temp = signbit(*delta_temperature_) ? -1. : 1.;
4793 const int flux_out[6] = FLUXES_OUT;
4794
4795 Vecteur3 flux_error = {0.,0.,0.};
4796 for (int c=0; c<3; c++)
4797 flux_error[c] = interfacial_heat_flux_dispatched[c](index_i_, index_j_, index_k_);
4798
4799 const int face_dir[6] = FACES_DIR;
4800 double weight_dir_tot;
4801 double weight = 0.;
4802 std::vector<int> pure_faces;
4803 std::vector<double> weight_dir;
4804 for (int c=0; c<3; c++)
4805 {
4806 weight_dir_tot = 0.;
4807 pure_faces.clear();
4808 weight_dir.clear();
4809 for (int l=0; l<6; l++)
4810 {
4811 double normal_compo = normal_vector_compo_[face_dir[l]];
4813 if (signbit(flux_out[l]) == signbit(normal_compo))
4814 if (pure_liquid_neighbours_[l] && face_dir[l] != c)
4815 {
4816 // normal_compo = abs(normal_compo);
4817 weight = abs(weight);
4818 pure_faces.push_back(l);
4819 weight_dir.push_back(weight);
4820 weight_dir_tot += weight;
4821 }
4822 }
4823 if (weight_dir.size() == 0)
4824 for (int l=0; l<6; l++)
4825 {
4826 double normal_compo = normal_vector_compo_[face_dir[l]];
4828 if (signbit(flux_out[l]) == signbit(normal_compo))
4830 {
4831 // normal_compo = abs(normal_compo);
4832 weight = abs(weight);
4833 pure_faces.push_back(l);
4834 weight_dir.push_back(weight);
4835 weight_dir_tot += weight;
4836 }
4837 }
4838 if (weight_dir.size() == 0)
4839 if (debug_)
4840 for (int l=0; l<6; l++)
4841 {
4842 Cerr << "Neighbour face index l: " << l << finl;
4843 Cerr << "Pure liquid neighbour:" << (int) pure_liquid_neighbours_[l] << finl;
4844 Cerr << "Normal vector compo:" << normal_vector_compo_[face_dir[l]] << finl;
4845 Cerr << "Flux value:" << flux_error[c] << finl;
4846 }
4847 assert(weight_dir.size() != 0);
4848 for (int m=0; m<(int) pure_faces.size(); m++)
4849 {
4850 const int pure_face = pure_faces[m];
4851 corrective_flux_from_neighbours_[pure_face] += ((sign_temp * flux_out[pure_face] * flux_error[c])
4852 * (weight_dir[m] / weight_dir_tot));
4853 }
4854 }
4855 for (int l=0; l<6; l++)
4856 interfacial_heat_flux_current[face_dir[l]](index_i_,index_j_,index_k_) += corrective_flux_from_neighbours_[l];
4857 }
4858}
4859
4860void IJK_One_Dimensional_Subproblem::add_interfacial_heat_flux_neighbours(IJK_Field_vector3_double& interfacial_heat_flux_dispatched)
4861{
4862 for (int c=0; c<3; c++)
4863 thermal_flux_dir_[c] = interfacial_heat_flux_dispatched[c](index_i_, index_j_, index_k_);
4864}
4865
4867{
4869 {
4870 for (int l=0; l<6; l++)
4871 {
4872 const int ii = NEIGHBOURS_I[l];
4873 const int jj = NEIGHBOURS_J[l];
4874 const int kk = NEIGHBOURS_K[l];
4875 const double indic_neighbour = ref_ijk_ft_->get_interface().I()(index_i_+ii, index_j_+jj, index_k_+kk);
4876 if (fabs(indic_neighbour) > LIQUID_INDICATOR_TEST)
4877 {
4880 }
4881 else
4882 {
4884 if (fabs(indic_neighbour) < VAPOUR_INDICATOR_TEST)
4886 else
4888 }
4889 }
4891 }
4892}
4893
4895{
4896 int liquid_faces = 0;
4897 for (int l=0; l<6; l++)
4899 liquid_faces++;
4900 if (!liquid_faces)
4901 (*zero_liquid_neighbours_)(index_i_, index_j_, index_k_) = 1;
4902}
4903
4904void IJK_One_Dimensional_Subproblem::compare_fluxes_thermal_subproblems(const IJK_Field_vector3_double& convective_diffusive_fluxes_raw,
4905 const int flux_type,
4906 const int inv_sign)
4907{
4908
4909 FixedVector<double, 6>& convective_diffusive_flux_op_value = selectxy(flux_type, convective_flux_op_value_, diffusive_flux_op_value_);
4910 FixedVector<double, 6>& convective_diffusive_flux_op_value_vap = selectxy(flux_type, convective_flux_op_value_vap_, diffusive_flux_op_value_vap_);
4911 FixedVector<double, 6>& convective_diffusive_flux_op_value_mixed = selectxy(flux_type, convective_flux_op_value_mixed_, diffusive_flux_op_value_mixed_);
4912 FixedVector<double, 6>& convective_diffusive_flux_op_value_normal_contrib = selectxy(flux_type, convective_flux_op_value_normal_contrib_, diffusive_flux_op_value_normal_contrib_);
4913 FixedVector<double, 6>& convective_diffusive_flux_op_value_leaving = selectxy(flux_type, convective_flux_op_leaving_value_, diffusive_flux_op_leaving_value_);
4914 FixedVector<double, 6>& convective_diffusive_flux_op_value_entering = selectxy(flux_type, convective_flux_op_entering_value_, diffusive_flux_op_entering_value_);
4915
4916 double& sum_convective_diffusive_flux_op_value = selectxy(flux_type, sum_convective_flux_op_value_, sum_diffusive_flux_op_value_);
4917 double& sum_convective_diffusive_flux_op_value_vap = selectxy(flux_type, sum_convective_flux_op_value_vap_, sum_diffusive_flux_op_value_vap_);
4918 double& sum_convective_diffusive_flux_op_value_mixed = selectxy(flux_type, sum_convective_flux_op_value_mixed_, sum_diffusive_flux_op_value_mixed_);
4919 double& sum_convective_diffusive_flux_op_value_normal_contrib = selectxy(flux_type, sum_convective_flux_op_value_normal_contrib_, sum_diffusive_flux_op_value_normal_contrib_);
4920 double& sum_convective_diffusive_flux_op_value_leaving = selectxy(flux_type, sum_convective_flux_op_leaving_value_, sum_diffusive_flux_op_leaving_value_);
4921 double& sum_convective_diffusive_flux_op_value_entering = selectxy(flux_type, sum_convective_flux_op_entering_value_, sum_diffusive_flux_op_entering_value_);
4922
4923 sum_convective_diffusive_flux_op_value = 0.;
4924 sum_convective_diffusive_flux_op_value_vap = 0.;
4925 sum_convective_diffusive_flux_op_value_mixed = 0.;
4926 sum_convective_diffusive_flux_op_value_normal_contrib = 0.;
4927 sum_convective_diffusive_flux_op_value_leaving = 0.;
4928 sum_convective_diffusive_flux_op_value_entering = 0.;
4929
4932
4933 const int flux_out[6] = FLUXES_OUT;
4934 const int face_dir[6] = FACES_DIR;
4935 for (int l=0; l<6; l++)
4936 {
4937 convective_diffusive_flux_op_value[l] = 0.;
4938 convective_diffusive_flux_op_value_vap[l] = 0.;
4939 convective_diffusive_flux_op_value_mixed[l] = 0.;
4940 convective_diffusive_flux_op_value_normal_contrib[l] = 0.;
4941 convective_diffusive_flux_op_value_leaving[l] = 0.;
4942 convective_diffusive_flux_op_value_entering[l] = 0.;
4943
4944 const int ii_f = NEIGHBOURS_FACES_I[l];
4945 const int jj_f = NEIGHBOURS_FACES_J[l];
4946 const int kk_f = NEIGHBOURS_FACES_K[l];
4947
4948 double flux_val = convective_diffusive_fluxes_raw[face_dir[l]](index_i_ + ii_f,
4949 index_j_ + jj_f,
4950 index_k_ + kk_f);
4951 if (inv_sign)
4952 flux_val = -flux_val;
4953 flux_val *= flux_out[l];
4954
4955 // flux_val = neighbours_ijk_sign[l] ? -flux_val: flux_val;
4956
4957 // Keep normals out
4958 // const double sign_conv = flux_type ? 1.: -1.;
4959 // flux_val *= sign_conv;
4960
4961 const double sign_temp = signbit(*delta_temperature_) ? -1 : 1;
4962 flux_val *= sign_temp;
4963
4964 /*
4965 * TODO: Count only positive contributions !
4966 */
4968 {
4969 // const bool sign_check_bool = (signbit(normal_vector_compo_[face_dir[l]]) == signbit(flux_out[l]));
4970 // const int sign_check = sign_check_bool ? 1: -1;
4971 // flux_val *= sign_check;
4972
4973 // if (!sign_check_bool && flux_type && debug_)
4974 // {
4975 // Cerr << "The diffusive flux is negative" << finl;
4976 // Cerr << "normal_vector_compo: " << normal_vector_compo_[0] << "; ";
4977 // Cerr << normal_vector_compo_[1] << "; " << normal_vector_compo_[2] << "; ";
4978 // Cerr << "l: " << l << finl;
4979 // Cerr << "flux_val: " << flux_val << finl;
4980 // }
4981
4982 convective_diffusive_flux_op_value[l] = flux_val;
4983 sum_convective_diffusive_flux_op_value += flux_val;
4984
4985 if (flux_val >= 0)
4986 {
4987 convective_diffusive_flux_op_value_leaving[l] = flux_val;
4988 sum_convective_diffusive_flux_op_value_leaving += flux_val;
4989 }
4990 else
4991 {
4992 /*
4993 * Some cases where there are more than 4 faces to correct !!!
4994 */
4995 convective_diffusive_flux_op_value_entering[l] = flux_val;
4996 sum_convective_diffusive_flux_op_value_entering += flux_val;
4997 }
4998
4999 convective_diffusive_flux_op_value_normal_contrib[l] = flux_val * normal_vector_compo_[face_dir[l]] * flux_out[l];
5000 sum_convective_diffusive_flux_op_value_normal_contrib += flux_val * normal_vector_compo_[face_dir[l]] * flux_out[l];
5001 }
5002 else if (pure_vapour_neighbours_[l])
5003 {
5004 convective_diffusive_flux_op_value_normal_contrib[l] = flux_val * normal_vector_compo_[face_dir[l]] * flux_out[l];
5005 sum_convective_diffusive_flux_op_value_normal_contrib += flux_val * normal_vector_compo_[face_dir[l]] * flux_out[l];
5006 }
5007 else
5008 {
5009 convective_diffusive_flux_op_value_mixed[l] = flux_val;
5010 sum_convective_diffusive_flux_op_value_mixed += flux_val;
5011 }
5012 }
5013}
5014
5016{
5017 switch (index_val)
5018 {
5019 case 0:
5020 return normal_temperature_gradient_solution_[0] * (*lambda_);
5021 // return thermal_flux_total_;
5022 case 1:
5023 return velocity_magnitude_[0];
5024 case 2:
5025 return temperature_solution_[0];
5026 case 3:
5028 case 4:
5029 return temperature_interp_[0];
5030 case 5:
5032 case 6:
5033 return normal_temperature_gradient_interp_[0] * (*lambda_);
5034 // return thermal_flux_total_;
5035 }
5036 return 0.;
5037}
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
Definition Domaine_IJK.h:47
int get_offset_local(int direction) const
Returns the local offset in requested direction.
double get_constant_delta(int direction) const
Returns the size of cells in a direction.
int get_nb_elem_tot(int direction) const
Returns the total (global) number of mesh cells in requested direction.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
: class IJK_Interfaces
double compute_temperature_integral_subproblem(const double &distance)
void project_cartesian_onto_basis_vector(const DoubleVect &compo_x, const DoubleVect &compo_y, const DoubleVect &compo_z, const Vecteur3 &basis, DoubleVect &projection)
void add_source_terms_temporal_tests(const int &boundary_condition_interface, const int &boundary_condition_end)
void project_matrix_on_basis(const Matrice33 &projection_matrix, const Matrice33 &inverse_projection_matrix, const Matrice33 &matrix, Matrice33 &projected_matrix)
void associate_thermal_subproblem_parameters(const int &reference_gfm_on_probes, const int &debug, const int &n_iter_distance, const double &delta_T_subcooled_overheated, const int &pre_initialise_thermal_subproblems_list, const int &use_sparse_matrix, const int &compute_normal_derivative_on_reference_probes, const int &latastep_reprise)
FixedVector< DoubleVect, 3 > hess_diag_T_elem_interp_
double get_discrete_surface_at_level(const int &dir, const int &level) const
IJK_Finite_Difference_One_Dimensional_Matrix_Assembler * finite_difference_assembler_
double get_velocity_component_at_point(const double &dist, const int &dir, const int &index_i=-100, const int &index_j=-100, const int &index_k=-100) const
std::vector< std::vector< std::vector< std::vector< double > > > > pure_neighbours_last_faces_corrected_colinearity_
int is_in_map_index_ijk(const std::map< int, std::map< int, std::map< int, int > > > &subproblem_to_ijk_indices, const int &index_i, const int &index_j, const int &index_k)
const IJK_Field_vector3_double * hess_cross_T_elem_
void compute_identity_matrix_local(Matrice &identity_matrix_explicit_implicit)
FixedVector< FixedVector< Vecteur3, 4 >, 6 > vertices_tangential_distance_vector_
void associate_varying_probes_params(const int &readjust_probe_length_from_vertices, const int &first_time_step_varying_probes, const int &probe_variations_priority, const int &disable_interpolation_in_mixed_cells)
double get_temperature_gradient_profile_at_point(const double &dist, const int &dir) const
void get_discrete_two_dimensional_spacing(const int &dir, const int &level, const double &first_dir, const double &second_dir, double &dl1, double &dl2, Vecteur3 &point_coords) const
FixedVector< Vecteur3, 6 > face_tangential_distance_vector_
FixedVector< double, 6 > diffusive_flux_op_value_mixed_
double get_field_profile_at_point(const double &dist, const DoubleVect &field, const int temp_bool) const
double get_temperature_gradient_times_conductivity_profile_at_point(const double &dist, const int &dir, bool &valid_val) const
void compute_second_order_operator_local(Matrice &second_first_order_operator)
void associer(const Probleme_FTD_IJK_base &ijk_ft)
std::vector< std::vector< std::vector< bool > > > pure_neighbours_to_correct_
void associate_flags_neighbours_correction(const int &correct_temperature_cell_neighbours, const int &correct_neighbours_rank, const int &neighbours_corrected_rank, const int &neighbours_colinearity_weighting, const int &neighbours_distance_weighting, const int &neighbours_colinearity_distance_weighting, const int &neighbours_last_faces_colinearity_weighting, const int &neighbours_last_faces_colinearity_face_weighting, const int &neighbours_last_faces_distance_weighting, const int &neighbours_last_faces_distance_colinearity_weighting, const int &neighbours_last_faces_distance_colinearity_face_weighting, const int &compute_reachable_fluxes, const int &find_cell_neighbours_for_fluxes_spherical_correction)
void get_ijk_indices(int &i, int &j, int &k) const
FixedVector< double, 6 > convective_flux_op_entering_value_
void dispatch_interfacial_heat_flux(IJK_Field_vector3_double &interfacial_heat_flux_dispatched, FixedVector< ArrOfInt, 3 > &ijk_indices_out, FixedVector< ArrOfDouble, 3 > &thermal_flux_out)
void correct_velocity(const DoubleVect &velocity, DoubleVect &velocity_corrected)
const IJK_Field_vector3_double * grad_T_elem_solver_
const IJK_Field_vector3_double * velocity_
void associate_collisions_parameters(const int &enable_probe_collision_detection, const int &enable_resize_probe_collision, const int &debug_probe_collision)
void associate_interface_related_parameters(double distance, double curvature, double interfacial_area, ArrOfDouble facet_barycentre, ArrOfDouble normal_vector)
const std::vector< Vecteur3 > * normal_vector_compo_probes_previous_
double compute_colinearity(const double &dx_contrib, const double &dy_contrib, const double &dz_contrib)
void compute_integral_quantity(DoubleVect &quantity, double &integrated_quantity)
void compute_modified_probe_length_condition(const int probe_length_condition)
FixedVector< double, 6 > convective_flux_op_value_normal_contrib_
void correct_tangential_temperature_hessian(DoubleVect &tangential_diffusion_source_terms)
const IJK_Field_vector3_double * grad_T_elem_smooth_
FixedVector< double, 6 > diffusive_flux_op_entering_value_
double find_cell_related_indicator_on_probes(const int &last_index)
double get_temperature_times_velocity_profile_at_point(const double &dist, const int &dir, bool &valid_val, const int &l, const int &index_i=INVALID_INDEX, const int &index_j=INVALID_INDEX, const int &index_k=INVALID_INDEX, const int &temperature=0)
FixedVector< DoubleVect, 3 > hess_cross_T_elem_spherical_from_rising_
void associate_finite_difference_solver_solution(IJK_Finite_Difference_One_Dimensional_Matrix_Assembler &finite_difference_assembler, Matrice &thermal_subproblems_matrix_assembly, DoubleVect &thermal_subproblems_rhs_assembly, DoubleVect &thermal_subproblems_temperature_solution, DoubleVect &thermal_subproblems_temperature_solution_ini)
DoubleVect get_temperature_profile_discrete_integral_at_point(const double &dist, const int &levels, const int &dir)
void associate_eulerian_field_values(int compo_connex, const double &indicator)
const IJK_Field_vector3_double * velocity_ft_
DoubleVect get_field_discrete_integral_velocity_weighting_at_point(const double &dist, const int &levels, const int &dir, const DoubleVect &field, const DoubleVect &field_weak_gradient, const IJK_Field_double &eulerian_field, const int temp_bool, const int weak_gradient_variable, const int vel, const int &l=-1)
void project_basis_vector_onto_cartesian_dir(const int &dir, const DoubleVect &compo_u, const DoubleVect &compo_v, const DoubleVect &compo_w, const Vecteur3 &basis_u, const Vecteur3 &basis_v, const Vecteur3 &basis_w, DoubleVect &projection)
void associate_temporal_parameters(const double &global_time_step, const double &current_time)
FixedVector< ArrOfInt, 6 > * first_indices_sparse_matrix_
void associate_thermal_subproblem_sparse_matrix(FixedVector< ArrOfInt, 6 > &first_indices_sparse_matrix)
DoubleVect get_field_times_velocity_discrete_integral_at_point(const double &dist, const int &levels, const int &dir, const DoubleVect &field, const DoubleVect &field_weak_gradient, const IJK_Field_double &eulerian_field, const int &l)
IJK_One_Dimensional_Subproblem(const Probleme_FTD_IJK_base &ijk_ft)
void retrieve_interfacial_quantities(const int rank, const int &itr, std::vector< std::string > key_results_int, std::vector< std::string > key_results_double, std::map< std::string, ArrOfInt > &results_probes_int, std::map< std::string, ArrOfDouble > &results_probes_double, const int &coord=0)
void compute_modified_probe_length(const int &probe_variations_enabled)
const std::vector< Vecteur3 > * velocities_probes_previous_
FixedVector< DoubleVect, 3 > hess_cross_T_elem_interp_
void post_process_radial_quantities(const int rank, const Nom &local_quantities_thermal_probes_time_index_folder)
void get_field_discrete_value_recursive(const int &ilevel, const int &max_level, const int &dir, const double &dist, const int &vel, const double &surface, const DoubleVect &field, const DoubleVect &field_weak_gradient, const IJK_Field_double &eulerian_field, const int temp_bool, const int weak_gradient_variable, const double dl1_parent, const double dl2_parent, Vecteur3 &point_coords_parent, DoubleVect &discrete_values, int &value_counter) const
void correct_velocity_rise(const DoubleVect &velocity, const Vecteur3 &basis, DoubleVect &velocity_corrected)
double get_temperature_profile_at_point(const double &dist) const
double get_velocity_cartesian_grid_value(const double &dist, const int &dir, const int &sign_dir, const int &index_i, const int &index_j, const int &index_k) const
void set_global_index(const int &global_subproblem_index)
void compute_second_order_operator_local_varying_probe_length(const Matrice *radial_second_order_operator)
void compute_first_order_operator_local_varying_probe_length(const Matrice *radial_first_order_operator)
double compute_cell_faces_weighting(const double &dx_contrib, const double &dy_contrib, const double &dz_contrib, const int &dir)
void thermal_subresolution_outputs_parallel(const int rank, const Nom &local_quantities_thermal_probes_time_index_folder)
std::vector< std::vector< std::vector< double > > > pure_neighbours_corrected_distance_
void retrieve_previous_temperature_on_probe_type(const int computation_type, const int &previous_rank, const double &best_indicator_prev, const double &colinearity, const double &velocity_eval, DoubleVect &temperature_previous, DoubleVect &temperature_previous_options, double &averaging_weight)
FixedVector< double, 6 > convective_flux_op_value_mixed_
FixedVector< double, 6 > face_centres_distance_corrected_
void associate_tweaked_parameters(const int &disable_probe_weak_gradient, const int &disable_probe_weak_gradient_gfm)
void associate_sub_problem_to_inputs(IJK_Thermal_Subresolution &ref_thermal_subresolution, IJK_One_Dimensional_Subproblems &ref_one_dimensional_subproblems, int i, int j, int k, int init, int sub_problem_index, double global_time_step, double current_time, int compo_connex, double distance, double curvature, double interfacial_area, ArrOfDouble facet_barycentre, ArrOfDouble normal_vector, double bubble_rising_velocity, ArrOfDouble bubble_rising_vector, ArrOfDouble bubble_barycentre, const double &indicator, const IJK_Interfaces &interfaces, const IJK_Field_vector3_double &velocity, const IJK_Field_vector3_double &velocity_ft, const IJK_Field_double &pressure)
void compute_vertex_position(const int &vertex_number, const int &face_dir, Vecteur3 &bary_vertex, double &distance_vertex_centre, double &tangential_distance_vertex_centre, Vecteur3 &tangential_distance_vector_vertex_centre)
const std::map< int, std::map< int, std::map< int, int > > > * subproblem_to_ijk_indices_previous_
DoubleVect get_temperature_gradient_profile_discrete_integral_at_point(const double &dist, const int &levels, const int &dir)
FixedVector< FixedVector< double, 4 >, 6 > vertices_centres_tangential_distance_
void compare_flux_interface(std::vector< double > &radial_flux_error)
void associate_eulerian_fields_references(const IJK_Interfaces &interfaces, const IJK_Field_double *eulerian_distance, const IJK_Field_double *eulerian_curvature, const IJK_Field_double *eulerian_interfacial_area, const IJK_Field_vector3_double *eulerian_normal_vect, const IJK_Field_vector3_double *eulerian_facets_barycentre, const IJK_Field_double &temperature, const IJK_Field_double &temperature_ft, const IJK_Field_double &temperature_before_extrapolation, const IJK_Field_vector3_double &velocity, const IJK_Field_vector3_double &velocity_ft, const IJK_Field_double &pressure, const IJK_Field_vector3_double &grad_T_elem, const IJK_Field_vector3_double &grad_T_elem_smooth, const IJK_Field_vector3_double &hess_diag_T_elem, const IJK_Field_vector3_double &hess_cross_T_elem, const IJK_Field_double &eulerian_grad_T_interface_ns, IJK_Field_double &probe_collision_debug_field, IJK_Field_int &zero_liquid_neighbours, const int &smooth_grad_T_elem)
const IJK_Field_vector3_double * eulerian_facets_barycentre_
FixedVector< DoubleVect, 3 > hess_cross_T_elem_spherical_
const std::vector< DoubleVect > * temperature_probes_previous_
void compute_weighting_coefficient(const int &l, double &weight, const int &weight_type=0)
double get_velocity_weighting(const double &dist, const int &dir, const int vel) const
FixedVector< double, 6 > diffusive_flux_op_leaving_value_
void compare_fluxes_thermal_subproblems(const IJK_Field_vector3_double &convective_diffusive_fluxes_raw, const int flux_type, const int inv_sign=0)
std::vector< std::vector< std::vector< double > > > pure_neighbours_corrected_colinearity_
FixedVector< DoubleVect, 3 > hess_diag_T_elem_spherical_from_rising_
std::vector< std::vector< std::vector< std::vector< double > > > > pure_neighbours_last_faces_corrected_distance_
std::vector< std::vector< std::vector< std::vector< bool > > > > pure_neighbours_last_faces_to_correct_
void prepare_boundary_conditions(DoubleVect *thermal_subproblems_rhs_assembly, DoubleVect *thermal_subproblems_temperature_solution_ini, int &boundary_condition_interface, const double &interfacial_boundary_condition_value, const int &impose_boundary_condition_interface_from_simulation, int &boundary_condition_end, const double &end_boundary_condition_value, const int &impose_user_boundary_condition_end_value)
FixedVector< double, 6 > convective_flux_op_leaving_value_
DoubleVect get_temperature_times_velocity_profile_discrete_integral_at_point(const double &dist, const int &levels, const int &dir, const int &l)
void correct_tangential_temperature_gradient(DoubleVect &tangential_convection_source_terms)
void retrieve_shell_quantities(const int rank, const int &itr, std::vector< std::string > key_results_int, std::vector< std::string > key_results_double, std::map< std::string, ArrOfInt > &results_probes_int, std::map< std::string, ArrOfDouble > &results_probes_double)
void compute_first_order_operator_local(Matrice &radial_first_order_operator)
const IJK_Field_vector3_double * eulerian_normal_vect_
const std::vector< double > * indicator_probes_previous_
const IJK_Field_vector3_double * hess_diag_T_elem_
const IJK_Field_vector3_double * grad_T_elem_
void associate_source_terms_parameters(const int &source_terms_type, const int &correct_tangential_temperature_gradient, const int &correct_tangential_temperature_hessian, const int &advected_frame_of_reference, const int &neglect_frame_of_reference_radial_advection, const int &compute_tangential_variables)
void add_interfacial_heat_flux_neighbours(IJK_Field_vector3_double &interfacial_heat_flux_dispatched)
FixedVector< double, 6 > corrective_flux_from_neighbours_
void associate_probe_parameters(const int &points_per_thermal_subproblem, const double &cp_liquid, const double &alpha, const double &lambda, const double &prandtl_number, const double &coeff_distance_diagonal, const double &cell_diagonal, const double &dr_base, const DoubleVect &radial_coordinates)
FixedVector< double, 6 > diffusive_flux_op_value_normal_contrib_
void associate_sub_problem_temporal_params(const bool &is_first_time_step, bool &first_time_step_temporal, const int &first_time_step_explicit, const double &local_fourier, const double &local_cfl, const double &min_delta_xyz, int max_u_radial)
void dispatch_interfacial_heat_flux_correction(IJK_Field_vector3_double &interfacial_heat_flux_dispatched, FixedVector< ArrOfInt, 4 > &ijk_indices_out, ArrOfDouble &thermal_flux_out, IJK_Field_vector3_double &interfacial_heat_flux_current)
const IJK_Field_double * temperature_before_extrapolation_
void add_interfacial_heat_flux_neighbours_correction(IJK_Field_vector3_double &interfacial_heat_flux_dispatched, IJK_Field_vector3_double &interfacial_heat_flux_current)
DoubleVect get_field_discrete_integral_at_point(const double &dist, const int &levels, const int &dir, const DoubleVect &field, const DoubleVect &field_weak_gradient, const IJK_Field_double &eulerian_field, const int weak_gradient_variable, const int temp_bool)
void interpolate_quantities_at_point(const IJK_Field_double &eulerian_field, const Vecteur3 &compo_xyz, double &field_value)
FixedVector< FixedVector< double, 4 >, 6 > vertices_centres_distance_
FixedVector< DoubleVect, 3 > hess_diag_T_elem_spherical_
FixedVector< double, 6 > face_centres_tangential_distance_
DoubleVect get_temperature_gradient_times_conductivity_profile_discrete_integral_at_point(const double &dist, const int &levels, const int &dir)
double compute_colinearity_cell_faces(const double &dx_contrib, const double &dy_contrib, const double &dz_contrib, const int &dir)
void associate_flux_correction_parameters(const int &correct_fluxes, const int &distance_cell_faces_from_lrs, const int &interp_eulerian, const int &use_corrected_velocity_convection, const int &use_velocity_cartesian_grid, const int &compute_radial_displacement, const int &fluxes_correction_conservations, const int &conserve_max_interfacial_fluxes, const int &fluxes_corrections_weighting, const int &use_normal_gradient_for_flux_corr)
void post_process_interfacial_quantities(SFichier &fic, const int rank, const int &coord=0)
void set_pure_flux_corrected(const double &flux_face, const int &l, const int flux_type)
void find_interval(const double &dist, int &left_interval, int &right_interval) const
FixedVector< double, 6 > face_centres_radius_difference_
void compute_source_terms_impose_boundary_conditions(const int &boundary_condition_interface, const double &interfacial_boundary_condition_value, const int &impose_boundary_condition_interface_from_simulation, const int &boundary_condition_end, const double &end_boundary_condition_value, const int &impose_user_boundary_condition_end_value)
void associate_rising_velocity(double bubble_rising_velocity, ArrOfDouble bubble_rising_vector, ArrOfDouble bubble_barycentre)
FixedVector< double, 6 > corrective_flux_to_neighbours_
double compute_cell_weighting(const double &dx_contrib, const double &dy_contrib, const double &dz_contrib)
FixedVector< DoubleVect, 3 > grad_T_elem_interp_
void thermal_subresolution_outputs(SFichier &fic, SFichier &fic_shell, const int rank, const Nom &local_quantities_thermal_probes_time_index_folder)
void associate_bubble_parameters(const ArrOfDouble &bubbles_surface, const ArrOfDouble &radius_from_surfaces_per_bubble, const ArrOfDouble &radius_from_volumes_per_bubble, const double &delta_temperature, const double &mean_liquid_temperature, const ArrOfDouble *bubbles_volume, const DoubleTab *rising_vectors)
const IJK_Field_double * eulerian_grad_T_interface_ns_
void add_source_terms(const int &boundary_condition_interface, const int &boundary_condition_end)
void associate_global_subproblems_parameters(const int &reconstruct_previous_probe_field, const int &implicit_solver_from_previous_probe_field, const std::map< int, std::map< int, std::map< int, int > > > &subproblem_to_ijk_indices_previous, const std::vector< DoubleVect > &temperature_probe_previous, const std::vector< double > &indicator_probes_previous, const std::vector< Vecteur3 > &velocities_probes_previous, const std::vector< Vecteur3 > &normal_vector_compo_probes_previous)
DoubleTab get_single_point_coordinates(const Vecteur3 &compo_xyz)
double compute_distance_cell_faces(const double &dx_contrib, const double &dy_contrib, const double &dz_contrib)
Vecteur3 compute_relative_vector_cell_faces(const double &dx_contrib, const double &dy_contrib, const double &dz_contrib)
void compute_integral_quantity_on_probe(DoubleVect &quantity, double &integrated_quantity)
void associate_finite_difference_operators(const Matrice &radial_first_order_operator_raw, const Matrice &radial_second_order_operator_raw, const Matrice &radial_first_order_operator, const Matrice &radial_second_order_operator, const Matrice &identity_matrix_explicit_implicit, Matrice &identity_matrix_subproblems, Matrice &radial_diffusion_matrix, Matrice &radial_convection_matrix)
std::vector< Vecteur3 > normal_vector_compo_probes_previous_
std::map< int, std::map< int, std::map< int, int > > > subproblem_to_ijk_indices_previous_
FixedVector< ArrOfInt, 6 > first_indices_sparse_matrix_
IJK_Finite_Difference_One_Dimensional_Matrix_Assembler finite_difference_assembler_
const IJK_Field_double * eulerian_interfacial_area_ns_
const IJK_Field_double * eulerian_curvature_ns_
IJK_Field_vector3_double grad_T_elem_smooth_
IJK_Field_double temperature_ft_
IJK_Field_vector3_double hess_diag_T_elem_
const IJK_Field_double * eulerian_distance_ns_
const IJK_Field_vector3_double * eulerian_facets_barycentre_ns_
IJK_Field_vector3_double grad_T_elem_
IJK_Field_vector3_double hess_cross_T_elem_
const DoubleTab * rising_vectors_
IJK_Field_double temperature_before_extrapolation_
IJK_Field_double eulerian_grad_T_interface_ns_
const ArrOfDouble * bubbles_volume_
bool disable_relative_velocity_energy_balance_
std::shared_ptr< IJK_Field_double > temperature_
const IJK_Field_vector3_double * eulerian_normal_vectors_ns_
une matrice 3x3.
Definition Matrice33.h:28
static void produit_matriciel(const Matrice33 &m1, const Matrice33 &m2, Matrice33 &res)
static double inverse(const Matrice33 &m, Matrice33 &resu, int exit_on_error=1)
calcul de l'inverse.
Classe Matrice Classe generique de la hierarchie des matrices.
Definition Matrice.h:34
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
classe Objet_U Cette classe est la classe de base des Objets de TRUST
Definition Objet_U.h:73
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
Objet_U()
Constructeur par defaut : attribue un numero d'identifiant unique a l'objet (object_id_),...
Definition Objet_U.cpp:55
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
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
Classe de base des flux de sortie.
Definition Sortie.h:52
void append_array(_TYPE_ valeur)
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469
_SIZE_ size() const
Definition TRUSTVect.tpp:45
void resize(_SIZE_, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTVect.tpp:91
static double produit_scalaire(const Vecteur3 &x, const Vecteur3 &y)
static void produit_vectoriel(const Vecteur3 &x, const Vecteur3 &y, Vecteur3 &resu)
double length() const
Definition Vecteur3.h:51