TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
IJK_Thermal_Subresolution.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_Thermal_Subresolution.h>
17#include <Param.h>
18#include <IJK_Navier_Stokes_tools.h>
19#include <DebogIJK.h>
20#include <Perf_counters.h>
21#include <Probleme_FTD_IJK.h>
22#include <Corrige_flux_FT_base.h>
23#include <OpConvDiscQuickIJKScalar.h>
24#include <IJK_Ghost_Fluid_tools.h>
25
26Implemente_instanciable_sans_constructeur( IJK_Thermal_Subresolution, "IJK_Thermal_Subresolution", IJK_Thermal_base ) ;
27
28IJK_Thermal_Subresolution::IJK_Thermal_Subresolution()
29{
31 {
35 }
36
38 {
39 boundary_condition_end_dict_[0] = "dirichlet";
40 boundary_condition_end_dict_[1] = "neumann";
41 }
42
43 source_terms_type_dict_ = Motcles(7);
44 {
45 source_terms_type_dict_[0] = "linear_diffusion";
46 source_terms_type_dict_[1] = "spherical_diffusion";
47 source_terms_type_dict_[2] = "spherical_diffusion_approx";
48 source_terms_type_dict_[3] = "tangential_conv_2D";
49 source_terms_type_dict_[4] = "tangential_conv_3D";
50 source_terms_type_dict_[5] = "tangential_conv_2D_tangential_diffusion_3D";
51 source_terms_type_dict_[6] = "tangential_conv_3D_tangentual_diffusion_3D";
52 }
53
54 fd_solver_type_ = "Solv_Gen";
55 fd_solvers_ = Motcles(4);
56 {
57 fd_solvers_[0] = "Solv_Gen";
58 fd_solvers_[1] = "Solv_GCP";
59 fd_solvers_[2] = "Solv_Cholesky";
60 fd_solvers_[3] = "Solv_Cholesky";
61 }
62 fd_solvers_jdd_ = Motcles(4);
63 {
64 fd_solvers_jdd_[0] = "thermal_fd_solver_1";
65 fd_solvers_jdd_[1] = "thermal_fd_solver_2";
66 fd_solvers_jdd_[2] = "thermal_fd_solver_3";
67 fd_solvers_jdd_[3] = "thermal_fd_solver_4";
68 }
69 // one_dimensional_advection_diffusion_thermal_solver_.nommer("finite_difference_solver");
70 // one_dimensional_advection_diffusion_thermal_solver_.typer("Solv_GCP");
71}
72
74{
75 Nom front_space = " ";
76 Nom end_space = " ";
77 Nom escape = "\n";
78
80
81 os << escape;
82 os << front_space << "# SUBRESOLUTION #" << escape;
83 os << escape;
84 /*
85 * Flags
86 */
87 os << escape;
88 os << front_space << "# SUBRESOLUTION FLAGS #" << escape;
89 os << escape;
90
92 os << front_space << "disable_probe_weak_gradient " << escape;
94 os << front_space << "disable_probe_weak_gradient_gfm " << escape;
96 os << front_space << "enable_probe_collision_detection " << escape;
98 os << front_space << "enable_resize_probe_collision " << escape;
100 os << front_space << "debug_probe_collision " << escape;
102 os << front_space << "reconstruct_previous_probe_field " << escape;
104 os << front_space << "implicit_solver_from_previous_probe_field " << escape;
106 os << front_space << "convective_flux_correction " << escape;
108 os << front_space << "diffusive_flux_correction " << escape;
110 os << front_space << "reference_gfm_on_probes " << escape;
112 os << front_space << "compute_normal_derivatives_on_reference_probes" << escape;
114 os << front_space << "disable_spherical_diffusion_start" << escape;
116 os << front_space << "disable_subresolution" << escape;
118 os << front_space << "disable_fo_flux_correction" << escape;
120 os << front_space << "override_vapour_mixed_values" << escape;
122 os << front_space << "enable_mixed_cells_increment" << escape;
124 os << front_space << "allow_temperature_correction_for_visu" << escape;
126 os << front_space << "impose_boundary_condition_interface_from_simulation" << escape;
128 os << front_space << "impose_user_boundary_condition_end_value" << escape;
130 os << front_space << "discrete_integral" << escape;
132 os << front_space << "advected_frame_of_reference" << escape;
134 os << front_space << "neglect_frame_of_reference_radial_advection" << escape;
136 os << front_space << "approximate_temperature_increment" << escape;
138 os << front_space << "first_time_step_temporal" << escape;
140 os << front_space << "first_time_step_implicit" << escape;
142 os << front_space << "local_diffusion_fourier_priority" << escape;
144 os << front_space << "first_time_step_varying_probes" << escape;
146 os << front_space << "probe_variations_priority" << escape;
147 if (max_u_radial_)
148 os << front_space << "max_u_radial" << escape;
150 os << front_space << "disable_distance_cell_faces_from_lrs" << escape;
152 os << front_space << "pre_initialise_thermal_subproblems_list" << escape;
154 os << front_space << "remove_append_subproblems" << escape;
156 os << front_space << "use_sparse_matrix" << escape;
158 os << front_space << "correct_temperature_cell_neighbours_first_iter" << escape;
160 os << front_space << "find_temperature_cell_neighbours" << escape;
162 os << front_space << "correct_neighbours_using_probe_length" << escape;
164 os << front_space << "neighbours_colinearity_weighting" << escape;
166 os << front_space << "neighbours_distance_weighting" << escape;
168 os << front_space << "neighbours_colinearity_distance_weighting" << escape;
170 os << front_space << "smooth_temperature_field" << escape;
172 os << front_space << "readjust_probe_length_from_vertices" << escape;
174 os << front_space << "use_temperature_cell_neighbours" << escape;
176 os << front_space << "clip_temperature_values" << escape;
178 os << front_space << "disable_post_processing_probes_out_files" << escape;
180 os << front_space << "enforce_periodic_boundary_value" << escape;
182 os << front_space << "disable_post_processing_probes_out_files" << escape;
184 os << front_space << "enforce_periodic_boundary_value" << escape;
186 os << front_space << "store_cell_faces_corrected" << escape;
188 os << front_space << "find_cell_neighbours_for_fluxes_spherical_correction" << escape;
190 os << front_space << "use_cell_neighbours_for_fluxes_spherical_correction" << escape;
192 os << front_space << "find_reachable_fluxes" << escape;
194 os << front_space << "use_reachable_fluxes" << escape;
196 os << front_space << "keep_first_reachable_fluxes" << escape;
198 os << front_space << "post_process_all_probes" << escape;
200 os << front_space << "interp_eulerian" << escape;
202 os << front_space << "first_step_thermals_post" << escape;
204 os << front_space << "neighbours_last_faces_colinearity_weighting" << escape;
206 os << front_space << "neighbours_last_faces_colinearity_face_weighting" << escape;
208 os << front_space << "neighbours_last_faces_distance_weighting" << escape;
210 os << front_space << "neighbours_last_faces_distance_weighting" << escape;
212 os << front_space << "neighbours_last_faces_distance_colinearity_face_weighting" << escape;
214 os << front_space << "post_process_thermal_slices" << escape;
216 os << front_space << "disable_slice_to_nearest_plane" << escape;
218 os << front_space << "thermal_slices_regions" << escape;
220 os << front_space << "post_process_thermal_lines" << escape;
222 os << front_space << "use_corrected_velocity_convection" << escape;
224 os << front_space << "use_velocity_cartesian_grid" << escape;
226 os << front_space << "compute_radial_displacement" << escape;
228 os << front_space << "fluxes_correction_conservations" << escape;
230 os << front_space << "conserve_max_interfacial_fluxes" << escape;
232 os << front_space << "keep_max_flux_correction" << escape;
234 os << front_space << "use_normal_gradient_for_flux_corr" << escape;
235
236 /*
237 * Values
238 */
239 os << escape;
240 os << front_space << "# SUBRESOLUTION PARAMS #" << escape;
241 os << escape;
242
243 os << front_space << "points_per_thermal_subproblem" << end_space << points_per_thermal_subproblem_ << escape;
244 os << front_space << "coeff_distance_diagonal" << end_space << coeff_distance_diagonal_ << escape;
245 os << front_space << "finite_difference_assembler" << end_space << finite_difference_assembler_ << escape;
247 os << front_space << "boundary_condition_interface" << end_space << boundary_condition_interface_dict_[boundary_condition_interface_] << escape;
248 os << front_space << "interfacial_boundary_condition_value" << end_space << interfacial_boundary_condition_value_ << escape;
249 if (boundary_condition_end_ != -1)
250 os << front_space << "boundary_condition_end" << end_space << boundary_condition_end_dict_[boundary_condition_end_] << escape;
251 os << front_space << "end_boundary_condition_value" << end_space << end_boundary_condition_value_ << escape;
252 if (source_terms_type_!= -1)
253 os << front_space << "source_terms_type" << end_space << source_terms_type_dict_[source_terms_type_] << escape;
254 os << front_space << "thermal_fd_solver" << end_space << one_dimensional_advection_diffusion_thermal_solver_ << escape;
255 os << front_space << "quadtree_levels" << end_space << quadtree_levels_ << escape;
256 os << front_space << "local_fourier" << end_space << local_fourier_ << escape;
257 os << front_space << "local_cfl" << end_space << local_cfl_ << escape;
258 os << front_space << "delta_T_subcooled_overheated" << end_space << delta_T_subcooled_overheated_ << escape;
259 os << front_space << "pre_factor_subproblems_number" << end_space << pre_factor_subproblems_number_ << escape;
260 os << front_space << "neighbours_corrected_rank" << end_space << neighbours_corrected_rank_ << escape;
261 os << front_space << "probes_end_value_coeff" << end_space << probes_end_value_coeff_ << escape;
262 os << front_space << "temperature_ini_type" << end_space << temperature_ini_type_ << escape;
263 os << front_space << "time_ini_user" << end_space << time_ini_user_ << escape;
264 os << front_space << "nb_theta_post_pro" << end_space << nb_theta_post_pro_ << escape;
265 os << front_space << "nb_phi_post_pro" << end_space << nb_phi_post_pro_ << escape;
266 os << front_space << "nb_probes_post_pro" << end_space << nb_probes_post_pro_ << escape;
267 os << front_space << "modified_time_init" << end_space << modified_time_init_ << escape;
268 os << front_space << "nb_slices" << end_space << nb_slices_ << escape;
269 os << front_space << "nb_diam_slice" << end_space << nb_diam_slice_ << escape;
270 os << front_space << "upstream_dir_slice" << end_space << upstream_dir_slice_ << escape;
271 os << front_space << "upstream_dir_line" << end_space << upstream_dir_line_ << escape;
272 os << front_space << "nb_thermal_lines" << end_space << nb_thermal_lines_ << escape;
273 os << front_space << "nb_thermal_concentric_circles" << end_space << nb_thermal_concentric_circles_ << escape;
274 os << front_space << "nb_thermal_line_points" << end_space << nb_thermal_line_points_ << escape;
275 os << front_space << "fluxes_corrections_weighting" << end_space << fluxes_corrections_weighting_ << escape;
276 os << "}" << escape;
277 return os;
278}
279
281{
283 if (ghost_fluid_)
285 if (!ghost_fluid_)
290 {
291 boundary_condition_interface_ = 0; // Dirichlet
293 }
295 {
296 boundary_condition_end_ = 0; // Dirichlet
298 }
299
300 return is;
301}
302
304{
306
307 param.ajouter("modified_time_init", &modified_time_init_);
308
309 param.ajouter_flag("reference_gfm_on_probes", &reference_gfm_on_probes_);
310 param.ajouter_flag("compute_normal_derivatives_on_reference_probes", &compute_normal_derivatives_on_reference_probes_);
311
312 param.ajouter_flag("disable_probe_weak_gradient", &disable_probe_weak_gradient_);
313 param.ajouter_flag("disable_probe_weak_gradient_gfm", &disable_probe_weak_gradient_gfm_);
314
315 param.ajouter_flag("enable_probe_collision_detection", &enable_probe_collision_detection_);
316 param.ajouter_flag("enable_resize_probe_collision", &enable_resize_probe_collision_);
317 param.ajouter_flag("debug_probe_collision", &debug_probe_collision_);
318
319 param.ajouter_flag("reconstruct_previous_probe_field", &reconstruct_previous_probe_field_);
320 param.ajouter_flag("implicit_solver_from_previous_probe_field", &implicit_solver_from_previous_probe_field_);
321
322 param.ajouter_flag("disable_spherical_diffusion_start", &disable_spherical_diffusion_start_);
323 param.ajouter_flag("disable_subresolution", &disable_subresolution_);
324 param.ajouter_flag("convective_flux_correction", &convective_flux_correction_);
325 param.ajouter_flag("diffusive_flux_correction", &diffusive_flux_correction_);
326 param.ajouter_flag("fluxes_correction_conservations", &fluxes_correction_conservations_);
327 param.ajouter_flag("conserve_max_interfacial_fluxes", &conserve_max_interfacial_fluxes_);
328 param.ajouter("fluxes_corrections_weighting", &fluxes_corrections_weighting_);
329
330 param.ajouter_flag("disable_fo_flux_correction", &disable_fo_flux_correction_);
331 param.ajouter_flag("override_vapour_mixed_values", &override_vapour_mixed_values_);
332 param.ajouter("points_per_thermal_subproblem", &points_per_thermal_subproblem_);
333 param.ajouter("coeff_distance_diagonal", &coeff_distance_diagonal_);
334 param.ajouter("finite_difference_assembler", &finite_difference_assembler_);
335 // param.ajouter_flag("disable_mixed_cells_increment", &disable_mixed_cells_increment_);
336 param.ajouter_flag("enable_mixed_cells_increment", &enable_mixed_cells_increment_);
337 param.ajouter_flag("disable_mixed_cells_increment", &disable_mixed_cells_increment_);
338 param.ajouter_flag("allow_temperature_correction_for_visu", &allow_temperature_correction_for_visu_);
339
340 param.ajouter("boundary_condition_interface", &boundary_condition_interface_);
341 param.dictionnaire("dirichlet", 0);
342 param.dictionnaire("neumann", 1);
343 param.dictionnaire("flux_jump", 2);
344
345 param.ajouter("interfacial_boundary_condition_value", &interfacial_boundary_condition_value_);
346 param.ajouter_flag("impose_boundary_condition_interface_from_simulation", &impose_boundary_condition_interface_from_simulation_);
347 param.ajouter("boundary_condition_end", &boundary_condition_end_);
348 param.dictionnaire("dirichlet", 0);
349 param.dictionnaire("neumann",1);
350 param.ajouter("end_boundary_condition_value", &end_boundary_condition_value_);
351 param.ajouter_flag("impose_user_boundary_condition_end_value", &impose_user_boundary_condition_end_value_);
352
353 param.ajouter("source_terms_type", &source_terms_type_);
354 param.dictionnaire("linear_diffusion", 0);
355 param.dictionnaire("spherical_diffusion",1);
356 param.dictionnaire("spherical_diffusion_approx",2);
357 param.dictionnaire("tangential_conv_2D", 3);
358 param.dictionnaire("tangential_conv_3D", 4);
359 param.dictionnaire("tangential_conv_2D_tangential_diffusion_3D", 5);
360 param.dictionnaire("tangential_conv_3D_tangentual_diffusion_3D", 6);
361 param.ajouter_flag("source_terms_correction", &source_terms_correction_);
362
363 // param.ajouter("thermal_fd_solver", &one_dimensional_advection_diffusion_thermal_solver_);
365
366 param.ajouter_flag("discrete_integral", &discrete_integral_);
367 param.ajouter("quadtree_levels", &quadtree_levels_);
368 param.ajouter_flag("advected_frame_of_reference", &advected_frame_of_reference_);
369 param.ajouter_flag("neglect_frame_of_reference_radial_advection", &neglect_frame_of_reference_radial_advection_);
370 param.ajouter_flag("approximate_temperature_increment", &approximate_temperature_increment_);
371
372 param.ajouter_flag("first_time_step_temporal", &first_time_step_temporal_);
373 param.ajouter_flag("first_time_step_implicit", &first_time_step_implicit_);
374 param.ajouter("local_fourier", &local_fourier_);
375 param.ajouter("local_cfl", &local_cfl_);
376 param.ajouter("delta_T_subcooled_overheated", &delta_T_subcooled_overheated_);
377 param.ajouter_flag("local_diffusion_fourier_priority", &local_diffusion_fourier_priority_);
378
379 param.ajouter_flag("first_time_step_varying_probes", &first_time_step_varying_probes_);
380 param.ajouter_flag("probe_variations_priority", &probe_variations_priority_);
381 param.ajouter_flag("max_u_radial", &max_u_radial_);
382
383 param.ajouter_flag("disable_distance_cell_faces_from_lrs", &disable_distance_cell_faces_from_lrs_);
384
385 param.ajouter_flag("pre_initialise_thermal_subproblems_list", &pre_initialise_thermal_subproblems_list_);
386 param.ajouter("pre_factor_subproblems_number", &pre_factor_subproblems_number_);
387 param.ajouter_flag("remove_append_subproblems", &remove_append_subproblems_);
388 param.ajouter_flag("use_sparse_matrix", &use_sparse_matrix_);
389
390 param.ajouter_flag("correct_temperature_cell_neighbours_first_iter", &correct_temperature_cell_neighbours_first_iter_);
391 param.ajouter_flag("find_temperature_cell_neighbours", &find_temperature_cell_neighbours_);
392 param.ajouter_flag("correct_neighbours_using_probe_length", &correct_neighbours_using_probe_length_);
393 param.ajouter("neighbours_corrected_rank", &neighbours_corrected_rank_);
394
395 param.ajouter_flag("neighbours_colinearity_weighting", &neighbours_colinearity_weighting_);
396 param.ajouter_flag("neighbours_distance_weighting", &neighbours_distance_weighting_);
397 param.ajouter_flag("neighbours_colinearity_distance_weighting", &neighbours_colinearity_distance_weighting_);
398 param.ajouter_flag("smooth_temperature_field", &smooth_temperature_field_);
399 param.ajouter_flag("readjust_probe_length_from_vertices", &readjust_probe_length_from_vertices_);
400 param.ajouter_flag("use_temperature_cell_neighbours", &use_temperature_cell_neighbours_);
401
402 param.ajouter_flag("clip_temperature_values", &clip_temperature_values_);
403 param.ajouter_flag("disable_post_processing_probes_out_files", &disable_post_processing_probes_out_files_);
404
405 param.ajouter_flag("enforce_periodic_boundary_value", &enforce_periodic_boundary_value_);
406 param.ajouter_flag("store_cell_faces_corrected", &store_cell_faces_corrected_);
407
408 param.ajouter_flag("find_cell_neighbours_for_fluxes_spherical_correction", &find_cell_neighbours_for_fluxes_spherical_correction_);
409 param.ajouter_flag("use_cell_neighbours_for_fluxes_spherical_correction", &use_cell_neighbours_for_fluxes_spherical_correction_);
410
411 param.ajouter_flag("find_reachable_fluxes", &find_reachable_fluxes_);
412 param.ajouter_flag("use_reachable_fluxes", &use_reachable_fluxes_);
413 param.ajouter_flag("keep_first_reachable_fluxes", &keep_first_reachable_fluxes_);
414
415 param.ajouter("probes_end_value_coeff", &probes_end_value_coeff_);
416 param.ajouter("temperature_ini_type", &temperature_ini_type_);
417 param.ajouter("time_ini_user", &time_ini_user_);
418
419 param.ajouter_flag("post_process_all_probes", &post_process_all_probes_);
420 param.ajouter("nb_theta_post_pro", &nb_theta_post_pro_);
421 param.ajouter("nb_phi_post_pro", &nb_phi_post_pro_);
422 param.ajouter("nb_probes_post_pro", &nb_probes_post_pro_);
423
424 param.ajouter_flag("interp_eulerian", &interp_eulerian_);
425
426 param.ajouter_flag("disable_first_step_thermals_post", &disable_first_step_thermals_post_);
427
428 param.ajouter_flag("neighbours_last_faces_colinearity_weighting", &neighbours_last_faces_colinearity_weighting_);
429 param.ajouter_flag("neighbours_last_faces_colinearity_face_weighting", &neighbours_last_faces_colinearity_face_weighting_);
430 param.ajouter_flag("neighbours_last_faces_distance_weighting", &neighbours_last_faces_distance_weighting_);
431 param.ajouter_flag("neighbours_last_faces_distance_colinearity_weighting", &neighbours_last_faces_distance_colinearity_weighting_);
432 param.ajouter_flag("neighbours_last_faces_distance_colinearity_face_weighting", &neighbours_last_faces_distance_colinearity_face_weighting_);
433
434
435 param.ajouter_flag("post_process_thermal_slices", &post_process_thermal_slices_);
436 param.ajouter_flag("disable_slice_to_nearest_plane", &disable_slice_to_nearest_plane_);
437 param.ajouter("nb_slices", &nb_slices_);
438 param.ajouter("nb_diam_slice", &nb_diam_slice_);
439 param.ajouter("upstream_dir_slice", &upstream_dir_slice_);
440 param.ajouter_flag("thermal_slices_regions", &thermal_slices_regions_);
441
442 param.ajouter_flag("post_process_thermal_lines", &post_process_thermal_lines_);
443 param.ajouter("nb_diam_thermal_line_length", &nb_diam_thermal_line_length_);
444 param.ajouter("upstream_dir_line", &upstream_dir_line_);
445 param.ajouter("nb_thermal_concentric_circles", &nb_thermal_concentric_circles_);
446 param.ajouter("nb_thermal_lines", &nb_thermal_lines_);
447 param.ajouter("nb_thermal_line_points", &nb_thermal_line_points_);
448
449 param.ajouter_flag("use_corrected_velocity_convection", &use_corrected_velocity_convection_);
450 param.ajouter_flag("use_velocity_cartesian_grid", &use_velocity_cartesian_grid_);
451 param.ajouter_flag("compute_radial_displacement", &compute_radial_displacement_);
452 param.ajouter_flag("use_normal_gradient_for_flux_corr", &use_normal_gradient_for_flux_corr_);
453
454 param.ajouter_flag("keep_max_flux_correction", &keep_max_flux_correction_);
455
456// param.ajouter_flag("copy_fluxes_on_every_procs", &copy_fluxes_on_every_procs_);
457// param.ajouter_flag("copy_temperature_on_every_procs", &copy_temperature_on_every_procs_);
458
459// param.ajouter_flag("enforce_periodic_boundary_value", &enforce_periodic_boundary_value_);
460// param.ajouter_non_std("enforce_periodic_boundary_value",(this));
461// for (int i=0; i<fd_solvers_jdd_.size(); i++)
462// param.ajouter_non_std(fd_solvers_jdd_[i], this);
463}
464
466{
467 if (mot == "enforce_periodic_boundary_value")
468 {
469
470 Nom accolade_ouverte("{");
471 Param param_bloc(que_suis_je());
472 Param param(que_suis_je());
473 Nom bloc_name_next;
474 param_bloc.ajouter("enforce_periodic_boundary_value",&bloc_name_next, Param::REQUIRED);
475 param_bloc.lire_sans_accolade(is);
476 if (bloc_name_next == accolade_ouverte)
477 {
479 param.ajouter("stencil_periodic_boundary_value", &stencil_periodic_boundary_value_);
481 }
482 else
484 }
485 return 1;
486}
487
488//int IJK_Thermal_Subresolution::lire_motcle_non_standard(const Motcle& mot, Entree& is)
489//{
490// read_fd_solver(mot, is);
491// return 1;
492//}
493//
494//void IJK_Thermal_Subresolution::read_fd_solver(const Motcle& mot, Entree& is)
495//{
496// Nom type = "";
497// fd_solver_rank_ = fd_solvers_jdd_.search(mot);
498// type += fd_solvers_[fd_solver_rank_];
499// Cerr << "Finite difference solver: " << type << finl;
500// fd_solver_type_ = fd_solvers_[fd_solver_rank_];
501// one_dimensional_advection_diffusion_thermal_solver_.typer(type);
502// // is >> one_dimensional_advection_diffusion_thermal_solver_;
503// // Cerr << "Finite difference solver: " << fd_solver_type_ << finl;
504//}
505
506
508{
509 Cout << que_suis_je() << "::initialize()" << finl;
510
512 uniform_alpha_ = lambda_liquid_ / (ref_ijk_ft_->milieu_ijk().get_rho_liquid() * cp_liquid_);
513 prandtl_number_ = (ref_ijk_ft_->milieu_ijk().get_mu_liquid() / ref_ijk_ft_->milieu_ijk().get_rho_liquid()) / uniform_alpha_;
514 // calulate_grad_T_ = 1;
516 /*
517 * Be careful, it plays a role for allocating the fields in
518 * IJK_Thermal_base::initialize
519 */
520 if (ghost_fluid_)
521 {
525 }
528
530 {
533 compute_hess_T_elem_ = false;
534 compute_grad_T_elem_ = false;
535 }
536 else
537 {
542 }
543
546
549
551 {
554 }
555
556
557 /*
558 * Call IJK_Thermal_base::initialize !
559 */
561 corrige_flux_.typer("Corrige_flux_FT_temperature_subresolution");
562
565
572 {
575 }
578 {
581 }
582
586
589
594
595 corrige_flux_->set_correction_cell_faces_neighbours(find_cell_neighbours_for_fluxes_spherical_correction_,
601
604
605 if (debug_)
606 Cerr << "Uniform lambda: " << temperature_diffusion_op_->get_uniform_lambda() << finl;
607
611
614 {
617 }
620
625
626 corrige_flux_->set_convection_diffusion_correction(convective_flux_correction_, diffusive_flux_correction_);
627 corrige_flux_->set_fluxes_feedback_params(discrete_integral_, quadtree_levels_);
628 corrige_flux_->set_debug(debug_);
629 corrige_flux_->set_distance_cell_faces_from_lrs(distance_cell_faces_from_lrs_);
630 corrige_flux_->set_correction_cell_neighbours(find_temperature_cell_neighbours_,
634 corrige_flux_->set_eulerian_normal_vectors_ns_normed(eulerian_normal_vectors_ns_normed_);
635 corrige_flux_->set_temperature_fluxes_periodic_sharing_strategy_on_processors(copy_fluxes_on_every_procs_,
637
638
640 {
641 // Use an operator that override compute_set() with corrige_flux;
642 temperature_diffusion_op_.typer("OpDiffUniformIJKScalarCorrection_double");
644 temperature_diffusion_op_.initialize(splitting);
645 temperature_diffusion_op_->set_corrige_flux(corrige_flux_);
646 }
647
649 {
650 // Use an operator that override compute_set() with corrige_flux;
651 temperature_convection_op_.typer("OpConvQuickInterfaceIJKScalar_double");
652 temperature_convection_op_.initialize(splitting);
653 temperature_convection_op_->set_corrige_flux(corrige_flux_);
654 }
655
657 {
658 allocate_cell_vector(cell_faces_corrected_convective_, splitting, 1);
659 allocate_cell_vector(cell_faces_corrected_diffusive_, splitting, 1);
660 allocate_cell_vector(cell_faces_corrected_bool_, splitting, 1);
661 for (int c=0; c<3; c++)
662 {
664 cell_faces_corrected_diffusive_[c].data() = 0.;
665 cell_faces_corrected_bool_[c].data() = 0;
666 }
667 cell_faces_corrected_convective_.echange_espace_virtuel();
668 cell_faces_corrected_diffusive_.echange_espace_virtuel();
669 cell_faces_corrected_bool_.echange_espace_virtuel();
670 }
671
673 {
674 d_temperature_uncorrected_.allocate(splitting, Domaine_IJK::ELEM, 2);
676 // Centre2
677 temperature_diffusion_op_.typer("standard");
678 temperature_diffusion_op_.initialize(splitting);
679 // Quick
680 temperature_convection_op_.typer("standard");
681 temperature_convection_op_.initialize(splitting);
682 }
683
684 thermal_local_subproblems_.associer(ref_ijk_ft_);
686
687
688 is_first_time_step_ = (!ref_ijk_ft_->get_reprise()) && (ref_ijk_ft_->schema_temps_ijk().get_tstep()==0);
697
699 one_dimensional_advection_diffusion_thermal_solver_.cast_direct_solver_by_default();
700
701 /*
702 * Considered constant values
703 */
704 corrige_flux_->set_physical_parameters(cp_liquid_ * ref_ijk_ft_->milieu_ijk().get_rho_liquid(),
705 cp_vapour_ * ref_ijk_ft_->milieu_ijk().get_rho_vapour(),
708 corrige_flux_->initialize_with_subproblems(
709 ref_ijk_ft_->get_domaine(),
711 ref_ijk_ft_->get_interface(),
712 ref_ijk_ft_,
713 ref_ijk_ft_->get_interface().get_set_intersection_ijk_face(),
714 ref_ijk_ft_->get_interface().get_set_intersection_ijk_cell(),
716 corrige_flux_->set_convection_negligible(!convective_flux_correction_);
717 corrige_flux_->set_diffusion_negligible(!diffusive_flux_correction_);
718
719 if (debug_)
720 {
721 debug_LRS_cells_.allocate(splitting, Domaine_IJK::ELEM, 0);
722 debug_LRS_cells_.data() = -1.;
723 }
724
726 {
728 temperature_cell_neighbours_.allocate(splitting, Domaine_IJK::ELEM, ghost_cells_); // , 1);
732 temperature_cell_neighbours_.echange_espace_virtuel(temperature_cell_neighbours_.ghost());
734 {
738 }
739 if (debug_)
740 {
744 }
745 }
746
748 {
749 allocate_cell_vector(cell_faces_neighbours_corrected_diag_bool_, splitting, ghost_cells_);
750 for (int c=0; c<3; c++)
752 cell_faces_neighbours_corrected_diag_bool_.echange_espace_virtuel();
753 corrige_flux_->set_cell_faces_neighbours_corrected_bool(cell_faces_neighbours_corrected_diag_bool_);
754 }
755
756
758 {
759 allocate_cell_vector(cell_faces_neighbours_corrected_all_bool_, splitting, ghost_cells_); // , 1);
760 for (int c=0; c<3; c++)
762 cell_faces_neighbours_corrected_all_bool_.echange_espace_virtuel();
763
764 allocate_cell_vector(cell_faces_neighbours_corrected_min_max_bool_, splitting, 2);
765 for (int c=0; c<3; c++)
767 cell_faces_neighbours_corrected_min_max_bool_.echange_espace_virtuel();
768
772 }
774 {
776 {
777 allocate_cell_vector(cell_faces_neighbours_corrected_convective_, splitting, 1);
778 for (int c=0; c<3; c++)
780 cell_faces_neighbours_corrected_convective_.echange_espace_virtuel();
782 {
783 allocate_cell_vector(cell_faces_neighbours_corrected_velocity_temperature_, splitting, 1);
784 for (int c=0; c<3; c++)
787
788 allocate_cell_vector(cell_faces_neighbours_corrected_convective_frame_of_reference_, splitting, 1);
789 for (int c=0; c<3; c++)
792 }
793 }
795 {
796 allocate_cell_vector(cell_faces_neighbours_corrected_diffusive_, splitting, 1);
797 for (int c=0; c<3; c++)
799 cell_faces_neighbours_corrected_diffusive_.echange_espace_virtuel();
800 }
802 {
803 allocate_cell_vector(neighbours_faces_weighting_colinearity_, splitting, 1);
804 for (int c=0; c<3; c++)
806 neighbours_faces_weighting_colinearity_.echange_espace_virtuel();
807 }
808 }
810 {
811 probe_collision_debug_field_.allocate(splitting, Domaine_IJK::ELEM, 0); // , 1);
813 }
814
816 {
817 zero_liquid_neighbours_.allocate(splitting, Domaine_IJK::ELEM, 1); // , 1);
818 zero_liquid_neighbours_.data() = 0.;
819 allocate_cell_vector(interfacial_heat_flux_dispatched_, splitting, 1);
820 for (int c=0; c<3; c++)
822 interfacial_heat_flux_dispatched_.echange_espace_virtuel();
823
824 allocate_cell_vector(interfacial_heat_flux_contrib_, splitting, 1);
825 allocate_cell_vector(interfacial_heat_flux_current_, splitting, 1);
826 for (int c=0; c<3; c++)
827 {
828 interfacial_heat_flux_contrib_[c].data() = 0.;
829 interfacial_heat_flux_current_[c].data() = 0.;
830 }
831 }
832
833 if (impose_fo_flux_correction_ || (diffusive_flux_correction_ && fo_ >= 1.)) // By default ?
834 fo_ = 0.95 * pow((sqrt(2) / 2), 2); // squared or not?
835
837
838 Cout << "End of " << que_suis_je() << "::initialize()" << finl;
839}
840
842{
844 return modified_time_init_; // ref_ijk_ft_->schema_temps_ijk().get_current_time();
845 else
846 return ref_ijk_ft_->schema_temps_ijk().get_current_time();
847}
848
849static int decoder_numero_bulle(const int code)
850{
851 const int num_bulle = code >> 6;
852 return num_bulle;
853}
854
856{
857 /*
858 * Theses Thiam et Euzenat
859 */
860 if (!ref_ijk_ft_->get_reprise() || ref_ijk_ft_->schema_temps_ijk().get_current_time() > 0.)
861 {
863 {
865 {
866 double time_ini = 0.;
867 const double rho_l = ref_ijk_ft_->milieu_ijk().get_rho_liquid();
868 const double alpha_liq = lambda_liquid_ / (rho_l * cp_liquid_);
870 {
871 case local_criteria:
872 {
875 double erf_inv_val = 1.;
876 approx_erf_inverse(erf_val, erf_inv_val);
877 const double time_local = pow((R-single_centred_bubble_radius_ini_),2) / (pow(erf_inv_val,2) * 4. * alpha_liq) ;
878 time_ini = time_local;
879 }
880 break;
882 {
883 const int max_attempt = 50;
884 int attempt_counter = 0;
885 double temperature_end_prev = delta_T_subcooled_overheated_;
886 double time_integral = 0.;
887 double temperature_end_next = 2 * temperature_end_prev;
888 while (abs(temperature_end_next - temperature_end_prev) > 0.01 && (attempt_counter < max_attempt))
889 {
890 const double temperature_integral = compute_spherical_steady_dirichlet_left_right_integral(temperature_end_prev);
891 time_integral = find_time_dichotomy_integral(temperature_integral, temperature_end_next);
892 temperature_end_prev = 0.5 * (temperature_end_prev + temperature_end_next);
893 attempt_counter++;
894 }
895 time_ini = time_integral;
896 }
897 break;
899 {
900 double time_derivative=0.;
901 const int max_attempt = 100;
902 int attempt_counter = 0;
904 double error = 1.;
905 double temperature_end_min = 0.;
906 get_time_inflection_derivative(temperature_end_min);
907 double temperature_limit_left = temperature_end_min;
908 double temperature_limit_right = temperature_end_min + 0.25 * abs(temperature_end_min);
909 double temperature_middle = 0.5 * (temperature_limit_left + temperature_limit_right);
910 while (error > 1e-2 && (attempt_counter < max_attempt))
911 {
912 const double temperature_derivative = compute_spherical_steady_dirichlet_left_right_derivative_value(R, temperature_middle);
913 time_derivative = find_time_dichotomy_derivative(temperature_derivative, temperature_limit_left, temperature_limit_right);
914 error = abs(temperature_limit_right - temperature_limit_left);
915 if (debug_)
916 Cerr << "error: " << error << finl;
917 temperature_middle = 0.5 * (temperature_limit_right + temperature_limit_right);
918 attempt_counter++;
919 }
920 time_ini = time_derivative;
921 }
922 break;
923 case time_criteria:
924 {
925 time_ini = time_ini_user_;
926 }
927 break;
928 default:
929 break;
930 }
931 if (debug_)
932 Cerr << "Time ini: " << time_ini << finl;
933 const int nb_bubble_tot = ref_ijk_ft_->get_interface().get_ijk_compo_connex().get_bubbles_barycentre().dimension(0);
934 const int nb_bubbles_real = ref_ijk_ft_->get_interface().get_nb_bulles_reelles();
935 for (int index_bubble=0; index_bubble<nb_bubble_tot; index_bubble++)
936 {
937 int index_bubble_real = index_bubble;
938 if (index_bubble>=nb_bubbles_real)
939 {
940 const int ighost = ref_ijk_ft_->get_interface().ghost_compo_converter(index_bubble-nb_bubbles_real);
941 index_bubble_real = decoder_numero_bulle(-ighost);
942 }
943 Nom expression_T_ini = compute_quasi_static_spherical_diffusion_expression(time_ini, index_bubble, index_bubble_real);
944 set_field_data(temperature_for_ini_per_bubble_, expression_T_ini);
946 }
948 modified_time_init_ = time_ini;
949 }
950 }
951 else
953 }
954}
955
956
961
963 const int index_bubble,
964 const int index_bubble_real)
965{
966
968 {
969 const DoubleTab& bubbles_centres = ref_ijk_ft_->get_interface().get_ijk_compo_connex().get_bubbles_barycentre();
970 double x,y,z;
971 x = bubbles_centres(index_bubble,0);
972 y = bubbles_centres(index_bubble,1);
973 z = bubbles_centres(index_bubble,2);
974 if (index_bubble != index_bubble_real)
975 {
976 const double x_real = bubbles_centres(index_bubble_real,0);
977 const double y_real = bubbles_centres(index_bubble_real,1);
978 const double z_real = bubbles_centres(index_bubble_real,2);
979 const double lx = temperature_->get_domaine().get_domain_length(0);
980 const double ly = temperature_->get_domaine().get_domain_length(0);
981 const double lz = temperature_->get_domaine().get_domain_length(0);
982 x = (abs(x - x_real)< (lx / 2.)) ? x_real : ((x_real < (lx / 2.)) ? x_real + lx : x_real - lx);
983 y = (abs(y - y_real)< (ly / 2.)) ? y_real : ((y_real < (ly / 2.)) ? y_real + ly : y_real - ly);
984 z = (abs(z - z_real)< (lz / 2.)) ? z_real : ((z_real < (lz / 2.)) ? z_real + lz : z_real - lz);
985 }
986 return generate_expression_temperature_ini(time_scope, x, y, z);
987 }
988 return generate_expression_temperature_ini(time_scope, 0., 0., 0.);
989}
990
992{
993 if (!index_bubble)
995
996 IJK_Field_double& temperature = *temperature_;
997
998 const int sign_delta = signbit(delta_T_subcooled_overheated_);
999 const int ni = temperature_->ni();
1000 const int nj = temperature_->nj();
1001 const int nk = temperature_->nk();
1002 for (int k = 0; k < nk; k++)
1003 for (int j = 0; j < nj; j++)
1004 for (int i = 0; i < ni; i++)
1005 {
1006 const double indic = ref_ijk_ft_->get_interface().I()(i,j,k);
1007 if (indic > VAPOUR_INDICATOR_TEST)
1008 {
1009 if (sign_delta)
1010 {
1011 if (temperature(i,j,k) <= (1 - probes_end_value_coeff_) * delta_T_subcooled_overheated_)
1012 {
1013 const double temperature_per_bubble = temperature_for_ini_per_bubble_(i,j,k);
1014 temperature(i,j,k) = temperature_per_bubble;
1015 }
1016 }
1017 else
1018 {
1019 if (temperature(i,j,k) >= (1 - probes_end_value_coeff_) * delta_T_subcooled_overheated_)
1020 {
1021 const double temperature_per_bubble = temperature_for_ini_per_bubble_(i,j,k);
1022 temperature(i,j,k) = temperature_per_bubble;
1023 }
1024 }
1025 }
1026 }
1027}
1028
1029void reinit_streamObj(std::ostringstream& streamObj, const double& param)
1030{
1031 streamObj.str("");
1032 streamObj.clear();
1033 streamObj << (double) param;
1034}
1035
1036Nom IJK_Thermal_Subresolution::generate_expression_temperature_ini(const double& time_scope, const double x, const double y, const double z)
1037{
1038 const double rho_l = ref_ijk_ft_->milieu_ijk().get_rho_liquid();
1039 const double alpha_liq = lambda_liquid_ / (rho_l * cp_liquid_);
1040 std::ostringstream streamObj;
1041 Nom expression_T = "(";
1042 streamObj << delta_T_subcooled_overheated_;
1043 expression_T += streamObj.str().c_str();
1044 expression_T += ")-(";
1045 expression_T += streamObj.str().c_str();
1046 expression_T += ")*(";
1047 reinit_streamObj(streamObj, single_centred_bubble_radius_ini_);
1048 expression_T += streamObj.str().c_str();
1049 Nom expression_tmp = "sqrt((x-(";
1050 reinit_streamObj(streamObj, (signbit(x) ? x-1e-16 : x+1e-16));
1051 expression_tmp += streamObj.str().c_str();
1052 expression_tmp += "))^2+(y-(";
1053 reinit_streamObj(streamObj, (signbit(y) ? y-1e-16 : y+1e-16));
1054 expression_tmp += streamObj.str().c_str();
1055 expression_tmp += "))^2+(z-(";
1056 reinit_streamObj(streamObj, (signbit(z) ? z-1e-16 : z+1e-16));
1057 expression_tmp += streamObj.str().c_str();
1058 expression_tmp += "))^2)";
1059 expression_T += "/";
1060 expression_T += expression_tmp;
1061 expression_T += "*(1-erf((";
1062 expression_T += expression_tmp;
1063 expression_T += "-";
1064 reinit_streamObj(streamObj, single_centred_bubble_radius_ini_);
1065 expression_T += streamObj.str().c_str();
1066 expression_T += ")/(2.*sqrt(";
1067 streamObj.str("");
1068 streamObj.clear();
1069 reinit_streamObj(streamObj, ((alpha_liq * time_scope) + 1e-16));
1070 expression_T += streamObj.str().c_str();
1071 expression_T += ")))))";
1072 return expression_T;
1073}
1074
1075void IJK_Thermal_Subresolution::approx_erf_inverse(const double& x, double& res)
1076{
1077 // https://www.had2know.org/academics/error-function-calculator-erf.html
1078 const double a = 18.75537;
1079 const double b = 2.47197;
1080 const double c = 0.25;
1081 const double d = 4.33074;
1082 const double e = 0.5;
1083 const double w = log(1-pow(x,2));
1084 res = sqrt(sqrt(a - b * w + c * pow(w,2)) - d - e * w);
1085 const double sign = signbit(x) ? -1. : 1.;
1086 res *= sign;
1087}
1088
1090{
1091 double temperature_value;
1092 const double T1 = delta_T_subcooled_overheated_;
1093 const double R0 = single_centred_bubble_radius_ini_;
1094 const double R1 = get_probes_length() + R0;
1095 temperature_value = T1 + T1 * (r * R0 - R1 * R0) / (r * (R1 - R0));
1096 return temperature_value;
1097}
1098
1100{
1101 double temperature_derivative;
1102 const double T1 = temperature_end_prev;
1103 const double R0 = single_centred_bubble_radius_ini_;
1104 const double R1 = get_probes_length() + R0;
1105 temperature_derivative = T1 * (R1 * R0) / (pow(r, 2) * (R1 - R0));
1106 return temperature_derivative;
1107}
1108
1110{
1111 double temperature_integral;
1112 const double T1 = temperature_end_prev;
1113 const double R0 = single_centred_bubble_radius_ini_;
1114 const double R1 = get_probes_length() + R0;
1115 const double Delta_R = R1 - R0;
1116 temperature_integral = (T1 * R1) / (R1 - R0) * (Delta_R - R0 * (log(R1) - log(R0)));
1117 temperature_integral /= Delta_R;
1118 return temperature_integral;
1119}
1120
1121double IJK_Thermal_Subresolution::find_time_dichotomy_integral(const double& temperature_integral,
1122 double& temperature_end_prev)
1123{
1124 // Arbitrary large time
1125 const double time_integral = 100.;
1126 const double T1 = delta_T_subcooled_overheated_;
1127 const double R0 = single_centred_bubble_radius_ini_;
1128 const double R1 = get_probes_length() + R0;
1129 const double rho_l = ref_ijk_ft_->milieu_ijk().get_rho_liquid();
1130 const double Delta_R = R1 - R0;
1131 const double alpha_liq = lambda_liquid_ / (rho_l * cp_liquid_);
1132 double time_tmp = time_integral / 2.;
1133 double left_time = 0.;
1134 double right_time = time_integral;
1135 double temperature_integral_eval = 1.e20;
1136 // const int sign_temperature_integral = signbit(temperature_integral);
1137 auto fflambda = [](const double& r, const double& R, const double& alpha, const double& t)
1138 { return R / r * (1 - erf( (r - R)/(2 * sqrt(alpha * t)))) ; };
1139 while(abs(temperature_integral_eval - temperature_integral) > 1e-6)
1140 {
1141 temperature_integral_eval = 0.;
1142 time_tmp = (right_time + left_time) / 2;
1143
1144 const int max_unknowns = 100;
1145 const double radial_incr = Delta_R / (max_unknowns - 1);
1146 for (int i=0; i<max_unknowns-1; i++)
1147 temperature_integral_eval += (fflambda(R0 + radial_incr * i, R0, alpha_liq, time_tmp)
1148 + fflambda(R0 + radial_incr * (i+1), R0, alpha_liq, time_tmp))
1149 * (radial_incr / 2);
1150 temperature_integral_eval = T1 - T1 * temperature_integral_eval / Delta_R;
1151 // temperature_integral_eval is positive
1152 if (temperature_integral_eval > temperature_integral)
1153 right_time = time_tmp;
1154 else
1155 left_time = time_tmp;
1156 }
1157 auto flambda = [](const double& r, const double& R, const double& alpha, const double& t, const double& Tinfty)
1158 { return Tinfty - Tinfty * R / r * (1- erf( (r - R)/(2 * sqrt(alpha * t)))) ; };
1159 auto glambda = [](const double& r, const double& R, const double& alpha, const double& t, const double& Tinfty)
1160 { return Tinfty * R / pow(r,2) * (1- erf( (r - R)/(2 * sqrt(alpha * t)))) ; };
1161 auto hlambda = [](const double& r, const double& R, const double& alpha, const double& t, const double& Tinfty)
1162 { return Tinfty * R / r / (2 * sqrt(alpha * t)) * (2 / sqrt(M_PI)) * (exp(-pow((r - R)/(2 * sqrt(alpha * t)),2))) ; };
1163
1164 const double temperature_end = flambda(R1, R0, alpha_liq, time_tmp, T1);
1165 temperature_end_prev = temperature_end;
1166 const double temperature_derivative_end = glambda(R1, R0, alpha_liq, time_tmp, T1)
1167 + hlambda(R1, R0, alpha_liq, time_tmp, T1);
1168 if (debug_)
1169 {
1170 Cerr << "Temperature at the probes end: " << temperature_end_prev << finl;
1171 Cerr << "Temperature at the probes end: " << temperature_end << finl;
1172 Cerr << "Temperature derivative at the probes end: " << temperature_derivative_end << finl;
1173 }
1174 return time_tmp;
1175}
1176
1178{
1179 const double T1 = delta_T_subcooled_overheated_;
1180 const double R0 = single_centred_bubble_radius_ini_;
1181 const double rho_l = ref_ijk_ft_->milieu_ijk().get_rho_liquid();
1182 const double alpha_liq = lambda_liquid_ / (rho_l * cp_liquid_);
1183 auto glambda = [](const double& r, const double& R, const double& alpha, const double& t, const double& Tinfty)
1184 { return Tinfty * R / pow(r,2) * (1- erf( (r - R)/(2 * sqrt(alpha * (t + 1e-16))))) ; };
1185 auto hlambda = [](const double& r, const double& R, const double& alpha, const double& t, const double& Tinfty)
1186 { return Tinfty * R / r / (2 * sqrt(alpha * (t + 1e-16))) * (2 / sqrt(M_PI)) * (exp(-pow((r - R)/(2 * sqrt(alpha * (t + 1e-16))),2))) ; };
1187 const double temperature_derivative_interface = glambda(R0, R0, alpha_liq, ref_ijk_ft_->schema_temps_ijk().get_current_time(), T1)
1188 + hlambda(R0, R0, alpha_liq, ref_ijk_ft_->schema_temps_ijk().get_current_time(), T1);
1189 heat_flux_spherical_ = lambda_liquid_ * temperature_derivative_interface;
1190 nusselt_spherical_diffusion_ = abs(temperature_derivative_interface * (2 * single_centred_bubble_radius_ini_) / T1);
1191 const double temperature_derivative_interface_liquid = glambda(R0, R0, alpha_liq, ref_ijk_ft_->schema_temps_ijk().get_current_time(), mean_liquid_temperature_)
1192 + hlambda(R0, R0, alpha_liq, ref_ijk_ft_->schema_temps_ijk().get_current_time(), mean_liquid_temperature_);
1193 nusselt_spherical_diffusion_liquid_ = abs(temperature_derivative_interface_liquid * (2 * single_centred_bubble_radius_ini_)
1195}
1196
1197
1199{
1200 const double T1 = delta_T_subcooled_overheated_;
1201 const double R0 = single_centred_bubble_radius_ini_;
1202 const double R1 = get_probes_length() + R0;
1203 const double rho_l = ref_ijk_ft_->milieu_ijk().get_rho_liquid();
1204 const double alpha_liq = lambda_liquid_ / (rho_l * cp_liquid_);
1205 // Solve dphidt(dphidr(T)) == 0
1206 const double inflection_time_temperature_derivative = 0.5 * (pow(R0,2) * R1 - 2 * R0 * pow(R1,2) + pow(R1,3)) / (R0*alpha_liq);
1207 auto glambda = [](const double& r, const double& R, const double& alpha, const double& t, const double& Tinfty)
1208 { return - (-Tinfty) * R / pow(r,2) * (1- erf( (r - R)/(2 * sqrt(alpha * t)))) ; };
1209 auto hlambda = [](const double& r, const double& R, const double& alpha, const double& t, const double& Tinfty)
1210 { return - (-Tinfty) * R / r / (2 * sqrt(alpha * t)) * (2 / sqrt(M_PI)) * (exp(-pow((r - R)/(2 * sqrt(alpha * t)),2))) ; };
1211 const double inflection_temperature_derivative = glambda(R1, R0, alpha_liq, inflection_time_temperature_derivative, T1)
1212 + hlambda(R1, R0, alpha_liq, inflection_time_temperature_derivative, T1);
1213 temperature_end_min = (inflection_temperature_derivative * R1 * (R1 - R0)) / (R0);
1214 return inflection_time_temperature_derivative;
1215}
1216
1217double IJK_Thermal_Subresolution::find_time_dichotomy_derivative(const double& temperature_derivative,
1218 double& temperature_limit_left,
1219 double& temperature_limit_right)
1220{
1221 const double time_max = 1000.;
1222 const double T1 = delta_T_subcooled_overheated_;
1223 const double R0 = single_centred_bubble_radius_ini_;
1224 const double R1 = get_probes_length() + R0;
1225 const double rho_l = ref_ijk_ft_->milieu_ijk().get_rho_liquid();
1226 const double alpha_liq = lambda_liquid_ / (rho_l * cp_liquid_);
1227 double temperature_end_min = 0.;
1228 // Solve dphidt(dphidr(T)) == 0
1229 const double inflection_time_temperature_derivative = get_time_inflection_derivative(temperature_end_min);
1230
1231 double time_tmp = 0.;
1232 double left_time = inflection_time_temperature_derivative;
1233 double right_time = time_max;
1234 double temperature_derivative_eval = 1.e20;
1235 auto flambda = [](const double& r, const double& R, const double& alpha, const double& t, const double& Tinfty)
1236 { return Tinfty - Tinfty * R / r * (1- erf( (r - R)/(2 * sqrt(alpha * t)))) ; };
1237 auto glambda = [](const double& r, const double& R, const double& alpha, const double& t, const double& Tinfty)
1238 { return - (-Tinfty) * R / pow(r,2) * (1- erf( (r - R)/(2 * sqrt(alpha * t)))) ; };
1239 auto hlambda = [](const double& r, const double& R, const double& alpha, const double& t, const double& Tinfty)
1240 { return - (-Tinfty) * R / r / (2 * sqrt(alpha * t)) * (2 / sqrt(M_PI)) * (exp(-pow((r - R)/(2 * sqrt(alpha * t)),2))) ; };
1241 const double inflection_temperature_derivative = glambda(R1, R0, alpha_liq, inflection_time_temperature_derivative, T1)
1242 + hlambda(R1, R0, alpha_liq, inflection_time_temperature_derivative, T1);
1243 const double inflection_temperature = flambda(R1, R0, alpha_liq, inflection_time_temperature_derivative, T1);
1244 if (debug_)
1245 {
1246 Cerr << "Inflection temperature derivative init: " << inflection_temperature_derivative << finl;
1247 Cerr << "Temperature at the inflection point: " << inflection_temperature << finl;
1248 Cerr << "Temperature derivative: " << temperature_derivative << finl;
1249 }
1250 while(abs(temperature_derivative_eval - temperature_derivative) > 1e-6)
1251 {
1252 temperature_derivative_eval = 0.;
1253 time_tmp = (right_time + left_time) / 2;
1254 temperature_derivative_eval = glambda(R1, R0, alpha_liq, time_tmp, T1)
1255 + hlambda(R1, R0, alpha_liq, time_tmp, T1);
1256 if (abs(temperature_derivative_eval) > abs(inflection_temperature_derivative))
1257 {
1258 time_tmp = inflection_time_temperature_derivative;
1259 break;
1260 }
1261 if (abs(temperature_derivative_eval - temperature_derivative) > 1e-2 && abs(left_time-right_time) < 1e-2)
1262 right_time = 2 * right_time;
1263 // temperature_integral_eval is positive
1264 if (abs(temperature_derivative_eval) < abs(temperature_derivative))
1265 right_time = time_tmp;
1266 else
1267 left_time = time_tmp;
1268 }
1269 const double temperature_end = flambda(R1, R0, alpha_liq, time_tmp, T1);
1270 double temperature_middle = 0.5 * (temperature_limit_right + temperature_limit_left);
1271 if (debug_)
1272 {
1273 Cerr << "Temperature at the probes end: " << temperature_end << finl;
1274 Cerr << "Temperature left limit: " << temperature_limit_left << finl;
1275 Cerr << "Temperature right limit: " << temperature_limit_right << finl;
1276 Cerr << "Temperature middle: " << temperature_middle << finl;
1277 }
1278 if (abs(temperature_end) > abs(temperature_middle))
1279 temperature_limit_left = temperature_middle;
1280 else
1281 temperature_limit_right = temperature_middle;
1282 const double temperature_derivative_end = glambda(R1, R0, alpha_liq, time_tmp, T1)
1283 + hlambda(R1, R0, alpha_liq, time_tmp, T1);
1284 if (debug_)
1285 {
1286 Cerr << "Temperature left limit: " << temperature_limit_left << finl;
1287 Cerr << "Temperature right limit: " << temperature_limit_right << finl;
1288 }
1289
1290 Cerr << "Temperature derivative at the probes end: " << temperature_derivative_end << finl;
1291 return time_tmp;
1292}
1293
1316
1321
1323{
1325 if (debug_)
1326 Cerr << "Compute mean liquid temperature" << finl;
1328 if (debug_)
1329 Cerr << "Compute Nusselt spherical diffusion" << finl;
1331}
1332
1334{
1335 /*
1336 * Update d_temperature
1337 * d_temperature_ += div_lambda_grad_T_volume_;
1338 * It depends on the nature of the properties (one-fluid or single-fluid)
1339 */
1340 IJK_Field_double& div_coeff_grad_T_volume = *div_coeff_grad_T_volume_;
1341 IJK_Field_double& d_temperature = *d_temperature_;
1342
1343 const int post_pro_div_lambda_grad_T = liste_post_instantanes_.contient_("DIV_LAMBDA_GRAD_T");
1344 const int ni = div_coeff_grad_T_volume.ni();
1345 const int nj = div_coeff_grad_T_volume.nj();
1346 const int nk = div_coeff_grad_T_volume.nk();
1347 const double rhocp_l = ref_ijk_ft_->milieu_ijk().get_rho_liquid() * cp_liquid_;
1348 const double rhocpVol = rhocp_l * vol_;
1349 for (int k = 0; k < nk; k++)
1350 for (int j = 0; j < nj; j++)
1351 for (int i = 0; i < ni; i++)
1352 {
1353 const double ope = div_coeff_grad_T_volume(i,j,k);
1354 const double resu = ope / rhocpVol;
1355 div_coeff_grad_T_volume(i,j,k) = ope / rhocp_l;
1356 d_temperature(i,j,k) += resu;
1357 if (post_pro_div_lambda_grad_T)
1358 div_coeff_grad_T_(i,j,k) = resu;
1359 }
1360 if (debug_)
1361 Cerr << "Uniform lambda: " << temperature_diffusion_op_->get_uniform_lambda() << finl;
1362}
1363
1365{
1366 const int ni = temperature.ni();
1367 const int nj = temperature.nj();
1368 const int nk = temperature.nk();
1369 for (int k = 0; k < nk; k++)
1370 for (int j = 0; j < nj; j++)
1371 for (int i = 0; i < ni; i++)
1372 {
1373 const double indic = ref_ijk_ft_->get_interface().I(i,j,k);
1374 if (fabs(indic) < LIQUID_INDICATOR_TEST) // Mixed cells and pure vapour cells
1375 temperature(i,j,k) = 0.;
1376 }
1377 temperature.echange_espace_virtuel(temperature.ghost());
1378}
1379
1385
1387{
1388 const IJK_Field_double& temperature = *temperature_;
1389
1392 const int ni = temperature.ni();
1393 const int nj = temperature.nj();
1394 const int nk = temperature.nk();
1395 for (int k = 0; k < nk; k++)
1396 for (int j = 0; j < nj; j++)
1397 for (int i = 0; i < ni; i++)
1398 {
1399 const double indic = ref_ijk_ft_->get_interface().I(i,j,k);
1400 if (fabs(indic) > VAPOUR_INDICATOR_TEST)
1401 {
1402 if (ref_ijk_ft_->schema_temps_ijk().get_current_time() == 0 && !ref_ijk_ft_->get_reprise())
1404 else
1405 {
1406 temperature_before_extrapolation_(i,j,k) = temperature(i,j,k);
1407 }
1408 }
1409 else
1411 }
1413}
1414
1416{
1417 /*
1418 * Correct only if we have not extended the temperature field across the interface (no fluxes calculation)
1419 */
1420 IJK_Field_double& d_temperature = *d_temperature_;
1421
1422 const int ni = d_temperature.ni();
1423 const int nj = d_temperature.nj();
1424 const int nk = d_temperature.nk();
1426 {
1427 for (int k = 0; k < nk; k++)
1428 for (int j = 0; j < nj; j++)
1429 for (int i = 0; i < ni; i++)
1430 {
1431 const double indic = ref_ijk_ft_->get_interface().I(i,j,k);
1432 if (fabs(indic)<LIQUID_INDICATOR_TEST) // Mixed cells and pure vapour cells
1433 { d_temperature(i,j,k) = 0; }
1434 }
1435 }
1436}
1437
1438void IJK_Thermal_Subresolution::compare_temperature_fields(const IJK_Field_double& temperature,
1439 const IJK_Field_double& temperature_ana,
1440 IJK_Field_double& error_temperature_ana,
1441 IJK_Field_double& error_temperature_ana_rel)
1442{
1443 const int ni = temperature.ni();
1444 const int nj = temperature.nj();
1445 const int nk = temperature.nk();
1446 error_temperature_ana.data() = 0.;
1447 for (int k = 0; k < nk; k++)
1448 for (int j = 0; j < nj; j++)
1449 for (int i = 0; i < ni; i++)
1450 {
1451 error_temperature_ana(i,j,k) = (temperature(i,j,k) - temperature_ana(i,j,k));
1452 error_temperature_ana_rel(i,j,k) = error_temperature_ana(i,j,k) / (temperature_ana(i,j,k) + 1.e-16) * 100.;
1453 }
1454}
1455
1457 double& total_parameter)
1458{
1459 const int ni = field.ni();
1460 const int nj = field.nj();
1461 const int nk = field.nk();
1462 total_parameter = 0;
1463 double liquid_volume = 0.;
1464 for (int k = 0; k < nk; k++)
1465 for (int j = 0; j < nj; j++)
1466 for (int i = 0; i < ni; i++)
1467 {
1468 const double indic = ref_ijk_ft_->get_interface().I(i,j,k);
1469 liquid_volume += (vol_ * indic);
1470 total_parameter += abs(field(i,j,k)) * (vol_ * indic);
1471 }
1472 total_parameter = mp_sum(total_parameter);
1473 liquid_volume = mp_sum(liquid_volume);
1474 total_parameter = total_parameter / liquid_volume;
1475}
1476
1478 double& total_parameter)
1479{
1480 const int ni = field.ni();
1481 const int nj = field.nj();
1482 const int nk = field.nk();
1483 total_parameter = 0;
1484 double liquid_volume = 0.;
1485 for (int k = 0; k < nk; k++)
1486 for (int j = 0; j < nj; j++)
1487 for (int i = 0; i < ni; i++)
1488 {
1489 const double indic = ref_ijk_ft_->get_interface().I(i,j,k);
1490 liquid_volume += (vol_ * indic);
1491 total_parameter += pow(field(i,j,k) * (vol_ * indic), 2);
1492 }
1493 total_parameter = mp_sum(total_parameter);
1494 liquid_volume = mp_sum(liquid_volume);
1495 total_parameter = total_parameter / pow(liquid_volume, 2);
1496}
1497
1499{
1500 const int ni = temperature.ni();
1501 const int nj = temperature.nj();
1502 const int nk = temperature.nk();
1503 for (int k = 0; k < nk; k++)
1504 for (int j = 0; j < nj; j++)
1505 for (int i = 0; i < ni; i++)
1506 {
1507 const double indic = ref_ijk_ft_->get_interface().I(i,j,k);
1508 // if (temperature > 0)
1509 if (indic < VAPOUR_INDICATOR_TEST)
1510 temperature(i,j,k) = 0;
1511 }
1512 temperature.echange_espace_virtuel(temperature.ghost());
1513}
1514
1516{
1517 /*
1518 * Correct only if the temperature gradient is post-processed
1519 * If not we may want to reconstruct the gradient field in Python
1520 * using the ghost temperature !
1521 */
1524 if (liste_post_instantanes_.contient_("U_T_CONVECTIVE") && allow_temperature_correction_for_visu_)
1526 if (liste_post_instantanes_.contient_("U_T_CONVECTIVE_VOLUME") && allow_temperature_correction_for_visu_)
1528 if (liste_post_instantanes_.contient_("DIV_LAMBDA_GRAD_T") && allow_temperature_correction_for_visu_)
1530 if (liste_post_instantanes_.contient_("DIV_LAMBDA_GRAD_T_VOLUME") && allow_temperature_correction_for_visu_)
1532}
1533
1535{
1536 // const int delta_pos = (delta_T_subcooled_overheated_ > 0) ? 1: 0;
1537 // const int mean_temp_pos = (mean_liquid_temperature_ > 0) ? 1: 0;
1538 // min_liquid_temperature_;
1539 // max_liquid_temperature_;
1540 // mean_liquid_temperature_;
1542 {
1543 IJK_Field_double& temperature = *temperature_;
1544
1545 const double clip_threshold = 0.98;
1546 const int ni = temperature.ni();
1547 const int nj = temperature.nj();
1548 const int nk = temperature.nk();
1549 for (int k = 0; k < nk; k++)
1550 for (int j = 0; j < nj; j++)
1551 for (int i = 0; i < ni; i++)
1552 {
1553 if (temperature(i,j,k) < delta_T_subcooled_overheated_)
1554 temperature(i,j,k) = delta_T_subcooled_overheated_ * clip_threshold;
1555 }
1556 temperature.echange_espace_virtuel(temperature.ghost());
1557 }
1558}
1559
1561{
1562 // const int delta_pos = (delta_T_subcooled_overheated_ > 0) ? 1: 0;
1563 // const int mean_temp_pos = (mean_liquid_temperature_ > 0) ? 1: 0;
1564 // min_liquid_temperature_;
1565 // max_liquid_temperature_;
1566 // mean_liquid_temperature_;
1567 const double clip_threshold = 1.e-5;
1569 {
1570 IJK_Field_double& temperature = *temperature_;
1571
1572 const int ni = temperature.ni();
1573 const int nj = temperature.nj();
1574 const int nk = temperature.nk();
1575 for (int k = 0; k < nk; k++)
1576 for (int j = 0; j < nj; j++)
1577 for (int i = 0; i < ni; i++)
1578 {
1579 const double indic = ref_ijk_ft_->get_interface().I(i,j,k);
1580 // Work only with bubble at zero, temperature liquid negative
1581 if ((temperature(i,j,k) + clip_threshold) > 0 && indic > LIQUID_INDICATOR_TEST)
1582 temperature(i,j,k) = 0;
1583 }
1584 temperature.echange_espace_virtuel(temperature.ghost());
1585 }
1586}
1587
1589{
1590 const IJK_Field_double& temperature = *temperature_;
1591
1592 double vol_liq = 0.;
1594 const int ni = temperature.ni();
1595 const int nj = temperature.nj();
1596 const int nk = temperature.nk();
1597 for (int k = 0; k < nk; k++)
1598 for (int j = 0; j < nj; j++)
1599 for (int i = 0; i < ni; i++)
1600 {
1601 const double indic = ref_ijk_ft_->get_interface().I(i,j,k);
1602 if (indic > VAPOUR_INDICATOR_TEST)
1603 {
1604 vol_liq += (indic * vol_);
1605 mean_liquid_temperature_ += (temperature(i,j,k) * indic * vol_);
1606 }
1607 }
1608 vol_liq = Process::mp_sum(vol_liq);
1609 mean_liquid_temperature_ /= vol_liq;
1611}
1612
1614{
1615 //static Stat_Counter_ID cnt_lrs_ini = //statistiques().new_counter(3, "Thermal Subresolution LRS - Initialisation");
1616 //static Stat_Counter_ID cnt_readjust = //statistiques().new_counter(3, "Thermal Subresolution LRS - Readjustement");
1617 //static Stat_Counter_ID cnt_lrs_matrix_op = //statistiques().new_counter(3, "Thermal Subresolution LRS - Matrix computation");
1618 //static Stat_Counter_ID cnt_lrs_temporal_scheme = //statistiques().new_counter(3, "Thermal Subresolution LRS - Temporal scheme");
1619 //static Stat_Counter_ID cnt_lrs_source_terms = //statistiques().new_counter(3, "Thermal Subresolution LRS - Source terms");
1620 //static Stat_Counter_ID cnt_lrs_solver = //statistiques().new_counter(3, "Thermal Subresolution LRS - Solver");
1621 //static Stat_Counter_ID cnt_lrs_post = //statistiques().new_counter(3, "Thermal Subresolution LRS - Miscellaneous post");
1622 //static Stat_Counter_ID cnt_lrs_prepare_corr = //statistiques().new_counter(3, "Thermal Subresolution LRS - Prepare temp-flux correction");
1623
1624 is_first_time_step_ = (!ref_ijk_ft_->get_reprise()) && (ref_ijk_ft_->schema_temps_ijk().get_tstep()==0);
1625 first_step_thermals_post_ = (first_step_thermals_post_ && !ref_ijk_ft_->schema_temps_ijk().get_tstep());
1628
1630 probe_collision_debug_field_.data() = 0.;
1631
1632 if (debug_)
1633 debug_LRS_cells_.data() = -1.;
1634
1635 if (debug_)
1636 Cerr << "Initialise thermal subproblems" << finl;
1637
1638 //statistiques().begin_count(cnt_lrs_ini);
1640 //statistiques().end_count(cnt_lrs_ini);
1641
1642 //statistiques().begin_count(cnt_readjust);
1644
1645 int varying_probes_length = 1;
1646 const int varying_probes = first_time_step_varying_probes_;
1650 do
1651 {
1652 if (debug_)
1653 Cerr << "Interpolate the velocities on probes and compute local cfl fourier conditions" << finl;
1655 if (varying_probes_length)
1657 else
1659 varying_probes_length--;
1660 }
1662
1663 if (debug_)
1664 if(varying_probes && !first_time_step_varying_probes_)
1665 Cerr << "Probes length is now fixed" << finl;
1666 //statistiques().end_count(cnt_readjust);
1667
1668 //statistiques().begin_count(cnt_lrs_matrix_op);
1670
1672
1673 if (debug_)
1674 Cerr << "Compute radial subresolution convection and diffusion operators" << finl;
1676 //statistiques().end_count(cnt_lrs_matrix_op);
1677
1678 //statistiques().begin_count(cnt_lrs_temporal_scheme);
1679 if (debug_)
1680 Cerr << "Compute local substep for the first iter" << finl;
1683 //statistiques().end_count(cnt_lrs_temporal_scheme);
1684
1685 //statistiques().begin_count(cnt_lrs_source_terms);
1686 if (debug_)
1687 Cerr << "Prepare boundary conditions, compute source terms and impose boundary conditions" << finl;
1688 temperature_->echange_espace_virtuel(temperature_->ghost());
1690 //statistiques().end_count(cnt_lrs_source_terms);
1691
1692 //statistiques().begin_count(cnt_lrs_solver);
1693 if (debug_)
1694 Cerr << "Solve thermal subproblems" << finl;
1696 //statistiques().end_count(cnt_lrs_solver);
1697
1698 //statistiques().begin_count(cnt_lrs_post);
1699 if (debug_)
1700 Cerr << "Compute material derivative (modelling)" << finl;
1702
1703 if (debug_)
1704 Cerr << "Store probe temperature" << finl;
1706 //statistiques().end_count(cnt_lrs_post);
1707
1708 //statistiques().begin_count(cnt_lrs_prepare_corr);
1709 if (debug_)
1710 Cerr << "Prepare thermal flux correction" << finl;
1713 //statistiques().end_count(cnt_lrs_prepare_corr);
1714}
1715
1717{
1718 int ghost_cells;
1720 const double dx = geom.get_constant_delta(DIRECTION_I);
1721 const double dy = geom.get_constant_delta(DIRECTION_J);
1722 const double dz = geom.get_constant_delta(DIRECTION_K);
1723 double maximum_distance = cell_diagonal_ * coeff_distance_diagonal_;
1724 const int max_dx = (int) trunc(maximum_distance / dx + 1);
1725 const int max_dy = (int) trunc(maximum_distance / dy + 1);
1726 const int max_dz = (int) trunc(maximum_distance / dz + 1);
1727 ghost_cells = std::max(max_dx, std::max(max_dy, max_dz));
1728 // Add one or more cell ??
1729 if (ghost_cells < ghost_init)
1730 ghost_cells = ghost_init;
1731 ghost_cells_ = ghost_cells;
1732}
1733
1738
1740{
1742 {
1746 for (int i=0; i < points_per_thermal_subproblem_; i++)
1747 radial_coordinates_(i) = i * dr_;
1748
1749 /*
1750 * Compute the matrices for Finite-Differences (first iteration only)
1751 */
1755 {
1756 int check_nb_elem;
1758 if (debug_)
1759 Cerr << "Check_nb_elem: " << check_nb_elem << finl;
1760 }
1761
1762 if (!use_sparse_matrix_)
1763 {
1766 }
1767 }
1768}
1769
1771 Matrice& radial_second_order_operator_raw,
1772 Matrice& radial_first_order_operator,
1773 Matrice& radial_second_order_operator)
1774{
1775 /*
1776 * Compute the matrices for Finite-Differences
1777 */
1778 compute_first_order_operator_raw(radial_first_order_operator_raw);
1779 compute_second_order_operator_raw(radial_second_order_operator_raw);
1780 radial_first_order_operator = Matrice(radial_first_order_operator_raw);
1781 radial_second_order_operator = Matrice(radial_second_order_operator_raw);
1782 compute_first_order_operator(radial_first_order_operator, dr_);
1783 compute_second_order_operator(radial_second_order_operator, dr_);
1784}
1785
1786/*
1787 * TODO : Should be moved to a class of tools ?
1788 */
1790{
1791 /*
1792 * Compute the first-order matrix for Finite-Differences
1793 */
1794 // TODO: Replace with matrice morse
1795 int check_nb_elem;
1796 check_nb_elem = finite_difference_assembler_.build(radial_first_order_operator, points_per_thermal_subproblem_, 0);
1797 if (debug_)
1798 Cerr << "Check_nb_elem: " << check_nb_elem << finl;
1799
1800}
1801
1802void IJK_Thermal_Subresolution::compute_first_order_operator(Matrice& radial_first_order_operator, double dr)
1803{
1804 const double dr_inv = 1 / dr;
1805 radial_first_order_operator *= dr_inv;
1806}
1807
1809{
1810 /*
1811 * Compute the second-order matrix for Finite-Differences
1812 */
1813 // TODO: Replace with matrice morse
1814 int check_nb_elem;
1815 check_nb_elem = finite_difference_assembler_.build(radial_second_order_operator, points_per_thermal_subproblem_, 1);
1816 Cerr << "Check_nb_elem: " << check_nb_elem << finl;
1817}
1818
1819void IJK_Thermal_Subresolution::compute_second_order_operator(Matrice& radial_second_order_operator, double dr)
1820{
1821 const double dr_squared_inv = 1 / pow(dr, 2);
1822 radial_second_order_operator *= dr_squared_inv;
1823}
1824
1832
1834{
1836 {
1838 zero_liquid_neighbours_.data() = 0.;
1839 const IJK_Field_double& indicator = ref_ijk_ft_->get_interface().I();
1840 const int ni = temperature_->ni();
1841 const int nj = temperature_->nj();
1842 const int nk = temperature_->nk();
1843 int counter = 0;
1844 for (int k = 0; k < nk; k++)
1845 for (int j = 0; j < nj; j++)
1846 for (int i = 0; i < ni; i++)
1847 if (fabs(indicator(i,j,k)) > VAPOUR_INDICATOR_TEST && fabs(indicator(i,j,k)) < LIQUID_INDICATOR_TEST)
1848 {
1849 if (debug_)
1850 {
1851 Cerr << "Liquid Indicator (Old): " << indicator(i,j,k) << finl;
1852 Cerr << "Liquid Indicator (Next): " << ref_ijk_ft_->get_interface().In()(i,j,k) << finl;
1853 debug_LRS_cells_(i,j,k) = indicator(i,j,k);
1854 }
1855 thermal_local_subproblems_.associate_sub_problem_to_inputs((*this),
1856 i,j,k,
1857 indicator(i,j,k),
1858 ref_ijk_ft_->schema_temps_ijk().get_timestep(),
1859 ref_ijk_ft_->schema_temps_ijk().get_current_time(),
1860 ref_ijk_ft_->get_interface(),
1861 ref_ijk_ft_->eq_ns().get_velocity(),
1862 ref_ijk_ft_->eq_ns().get_velocity_ft(),
1863 ref_ijk_ft_->eq_ns().get_pressure_ghost_cells());
1864 counter++;
1865 }
1867 thermal_local_subproblems_.compute_global_indices();
1868 if (!counter)
1869 thermal_local_subproblems_.associate_variables_for_post_processing((*this));
1870
1872 zero_liquid_neighbours_.echange_espace_virtuel(zero_liquid_neighbours_.ghost());
1873 }
1874}
1875
1885
1890
1892{
1893 if (ref_ijk_ft_->schema_temps_ijk().get_tstep()==0 && pre_initialise_thermal_subproblems_list_)
1894 {
1896 {
1897 // int nb_subproblems_ini = thermal_local_subproblems_.get_subproblems_counter();
1898 int nb_subproblems_ini = thermal_local_subproblems_.get_effective_subproblems_counter();
1899 if (!(ref_ijk_ft_->eq_ns().get_disable_convection_qdm() && ref_ijk_ft_->eq_ns().get_disable_diffusion_qdm()))
1900 nb_subproblems_ini = Process::check_int_overflow(Process::mp_sum(nb_subproblems_ini));
1901 const int max_subproblems_predicted = (int) ((double) nb_subproblems_ini * pre_factor_subproblems_number_);
1904 max_subproblems_predicted);
1905 finite_difference_assembler_.pre_initialise_matrix_subproblems(radial_convection_matrix_,
1907 max_subproblems_predicted);
1908 finite_difference_assembler_.pre_initialise_matrix_subproblems(radial_diffusion_matrix_,
1910 max_subproblems_predicted);
1912 finite_difference_assembler_.pre_initialise_matrix_subproblems(identity_matrix_subproblems_,
1914 max_subproblems_predicted);
1915 finite_difference_assembler_.complete_empty_matrices_initialisation(thermal_subproblems_matrix_assembly_,
1917 nb_subproblems_ini, max_subproblems_predicted);
1918 finite_difference_assembler_.complete_empty_matrices_initialisation(radial_convection_matrix_,
1920 nb_subproblems_ini, max_subproblems_predicted);
1921 finite_difference_assembler_.complete_empty_matrices_initialisation(radial_diffusion_matrix_,
1923 nb_subproblems_ini, max_subproblems_predicted);
1925 finite_difference_assembler_.complete_empty_matrices_initialisation(identity_matrix_subproblems_,
1927 nb_subproblems_ini, max_subproblems_predicted);
1928 }
1929 }
1930}
1931
1933{
1938
1939 // For a constant number of points (we can just change the probe size)
1940 // const int nb_points = points_per_thermal_subproblem_ * thermal_local_subproblems_.get_subproblems_counter();
1941 const int nb_points = points_per_thermal_subproblem_ * thermal_local_subproblems_.get_effective_subproblems_counter();
1942 thermal_subproblems_rhs_assembly_.resize(nb_points);
1946}
1947
1953
1959
1965
1975
1991
2023
2025 Matrice& identity_matrix_subproblems)
2026{
2027 /*
2028 * Compute the convection matrices for Finite-Differences
2029 */
2030 if (debug_)
2031 Cerr << "Initialise the Identity matrix" << finl;
2032 // const int nb_subproblems = thermal_local_subproblems_.get_subproblems_counter();
2033 const int nb_subproblems = thermal_local_subproblems_.get_effective_subproblems_counter();
2034 finite_difference_assembler_.initialise_matrix_subproblems(identity_matrix_subproblems,
2035 identity_matrix,
2036 nb_subproblems,
2038 if (debug_)
2039 Cerr << "Identity matrix has been initialised." << finl;
2040}
2041
2043 Matrice& identity_matrix_subproblems)
2044{
2045 /*
2046 * Compute the convection matrices for Finite-Differences
2047 */
2048 const int first_initialisation = (ref_ijk_ft_->schema_temps_ijk().get_tstep() == 0);
2049 if (debug_)
2050 Cerr << "Initialise the Identity sparse matrix" << finl;
2051 // const int nb_subproblems = thermal_local_subproblems_.get_subproblems_counter();
2052 const int nb_subproblems = thermal_local_subproblems_.get_effective_subproblems_counter();
2053 finite_difference_assembler_.initialise_sparse_matrix_subproblems(identity_matrix_subproblems,
2054 identity_matrix,
2055 nb_subproblems,
2058 first_initialisation,
2060 if (debug_)
2061 Cerr << "Identity sparse matrix has been initialised." << finl;
2062}
2063
2065 Matrice& radial_convection_matrix)
2066{
2067 /*
2068 * Compute the convection matrices for Finite-Differences
2069 */
2070 if (debug_)
2071 Cerr << "Initialise the Radial convection operator" << finl;
2072 // const int nb_subproblems = thermal_local_subproblems_.get_subproblems_counter();
2073 const int nb_subproblems = thermal_local_subproblems_.get_effective_subproblems_counter();
2074 finite_difference_assembler_.initialise_matrix_subproblems(radial_convection_matrix,
2075 radial_first_order_operator,
2076 nb_subproblems,
2078 if (debug_)
2079 Cerr << "Radial convection operator has been initialised." << finl;
2080}
2081
2083 Matrice& radial_convection_matrix)
2084{
2085 /*
2086 * Compute the convection matrices for Finite-Differences
2087 */
2088 const int first_initialisation = (ref_ijk_ft_->schema_temps_ijk().get_tstep() == 0);
2089 if (debug_)
2090 Cerr << "Initialise the Radial convection sparse operator" << finl;
2091 // const int nb_subproblems = thermal_local_subproblems_.get_subproblems_counter();
2092 const int nb_subproblems = thermal_local_subproblems_.get_effective_subproblems_counter();
2093 finite_difference_assembler_.initialise_sparse_matrix_subproblems(radial_convection_matrix,
2094 radial_first_order_operator,
2095 nb_subproblems,
2098 first_initialisation,
2100 if (debug_)
2101 Cerr << "Radial convection sparse operator has been initialised." << finl;
2102}
2103
2104
2106 Matrice& radial_diffusion_matrix)
2107{
2108 /*
2109 * Compute the diffusion matrices for Finite-Differences
2110 */
2111 if (debug_)
2112 Cerr << "Initialise the Radial diffusion operator" << finl;
2113 // const int nb_subproblems = thermal_local_subproblems_.get_subproblems_counter();
2114 const int nb_subproblems = thermal_local_subproblems_.get_effective_subproblems_counter();
2115 finite_difference_assembler_.initialise_matrix_subproblems(radial_diffusion_matrix, radial_second_order_operator, nb_subproblems, first_time_step_varying_probes_);
2116 if (debug_)
2117 Cerr << "Radial diffusion operator has been initialised." << finl;
2118}
2119
2121 Matrice& radial_diffusion_matrix)
2122{
2123 /*
2124 * Compute the diffusion matrices for Finite-Differences
2125 */
2126 const int first_initialisation = (ref_ijk_ft_->schema_temps_ijk().get_tstep() == 0);
2127 if (debug_)
2128 Cerr << "Initialise the Radial diffusion sparse operator" << finl;
2129 // const int nb_subproblems = thermal_local_subproblems_.get_subproblems_counter();
2130 const int nb_subproblems = thermal_local_subproblems_.get_effective_subproblems_counter();
2131 finite_difference_assembler_.initialise_sparse_matrix_subproblems(radial_diffusion_matrix,
2132 radial_second_order_operator,
2133 nb_subproblems,
2136 first_initialisation,
2139 if (debug_)
2140 Cerr << "Radial diffusion sparse operator has been initialised." << finl;
2141}
2142
2144{
2147 {
2148 const double local_time_step = thermal_local_subproblems_.get_min_euler_time_step(nb_iter_explicit_local_);
2149 if (debug_)
2150 {
2151 Cerr << "Local timestep: " << local_time_step << finl;
2152 Cerr << "Number of sub-steps: " << nb_iter_explicit_local_ << finl;
2153 }
2154 thermal_local_subproblems_.set_local_time_step(local_time_step);
2155 local_fourier_time_step_probe_length_ = thermal_local_subproblems_.get_local_min_fourier_time_step_probe_length();
2156 local_cfl_time_step_probe_length_ = thermal_local_subproblems_.get_local_min_cfl_time_step_probe_length();
2157 local_dt_cfl_ = thermal_local_subproblems_.get_local_dt_cfl();
2158 local_dt_cfl_min_delta_xyz_ = thermal_local_subproblems_.get_local_dt_cfl_min_delta_xyz();
2159 local_dt_cfl_counter_ += (ref_ijk_ft_->schema_temps_ijk().get_timestep() / local_dt_cfl_min_delta_xyz_);
2160 local_dt_fourier_counter_ += (ref_ijk_ft_->schema_temps_ijk().get_timestep() / local_fourier_time_step_probe_length_);
2161 if (debug_)
2162 {
2163 Cerr << "Compare the thermal time-steps" << finl;
2164 Cerr << "Current time: "<< ref_ijk_ft_->schema_temps_ijk().get_current_time() << finl;
2165 Cerr << "local_fourier_time_step_probe_length: " << local_fourier_time_step_probe_length_ << finl;
2166 Cerr << "local_cfl_time_step_probe_length: " << local_cfl_time_step_probe_length_ << finl;
2167 Cerr << "local_dt_cfl: " << local_dt_cfl_ << finl;
2168 Cerr << "local_dt_cfl_min_delta_xyz: " << local_dt_cfl_min_delta_xyz_ << finl;
2169 Cerr << "local_dt_cfl_counter: " << local_dt_cfl_counter_ << finl;
2170 Cerr << "local_dt_fourier_counter: " << local_dt_fourier_counter_ << finl;
2171 Cerr << "dt_cfl: " << ref_ijk_ft_->schema_temps_ijk().get_dt_cfl_liq() << finl;
2172 }
2173 /*
2174 * Activate Quasi-static when convection is significant
2175 */
2178 else if (local_dt_fourier_counter_ > 1.)
2180 }
2181}
2182
2195
2208
2214
2216{
2217 //static Stat_Counter_ID cnt_lrs_solv_lin = //statistiques().new_counter(4, "Thermal Subresolution LRS - Solver - Linear");
2218 //static Stat_Counter_ID cnt_lrs_solv_retrieve_temp = //statistiques().new_counter(4, "Thermal Subresolution LRS - Solver - Retrieve temperature");
2220 {
2223
2225 {
2226 Cerr << "Finite-difference Explicit thermal sub-resolution !" << finl;
2227 DoubleVect thermal_subproblems_temperature_solution_tmp = thermal_subproblems_temperature_solution_ini_;
2228 for (int i=0; i<nb_iter_explicit_local_; i++)
2229 {
2230 thermal_subproblems_temperature_solution_ = (*thermal_subproblems_matrix_assembly_for_solver_ref_) * thermal_subproblems_temperature_solution_tmp;
2232 thermal_subproblems_temperature_solution_tmp = thermal_subproblems_temperature_solution_;
2233 }
2234 Cerr << "Finite-difference Explicit thermal sub-resolution has finished in "<< nb_iter_explicit_local_ << "iterations!" << finl;
2235 }
2236 else
2237 {
2238
2241 {
2244 Cerr << "Finite-difference thermal sub-resolution has started (Implicit)!" << finl;
2245 one_dimensional_advection_diffusion_thermal_solver_implicit_.resoudre_systeme((*thermal_subproblems_matrix_assembly_for_solver_ref_).valeur(),
2248 Cerr << "Finite-difference thermal sub-resolution has finished (Implicit)!" << finl;
2249 }
2250 else
2251 {
2252 //statistiques().begin_count(cnt_lrs_solv_lin);
2253 Cerr << "Finite-difference thermal sub-resolution has started !" << finl;
2254 one_dimensional_advection_diffusion_thermal_solver_.resoudre_systeme((*thermal_subproblems_matrix_assembly_for_solver_ref_).valeur(),
2257 Cerr << "Finite-difference thermal sub-resolution has finished !" << finl;
2258 //statistiques().end_count(cnt_lrs_solv_lin);
2259 }
2260 }
2261 }
2262 //statistiques().begin_count(cnt_lrs_solv_retrieve_temp);
2264 //statistiques().end_count(cnt_lrs_solv_retrieve_temp);
2265}
2266
2268{
2269 /*
2270 * Convert into a huge sparse matrix
2271 */
2272 // const int nb_points = points_per_thermal_subproblem_ * thermal_local_subproblems_.get_subproblems_counter();
2273 const int nb_points = points_per_thermal_subproblem_ * thermal_local_subproblems_.get_effective_subproblems_counter();
2274 if (!use_sparse_matrix_)
2275 {
2276 Matrice_Morse& sparse_matrix_solver = ref_cast(Matrice_Morse, thermal_subproblems_matrix_assembly_for_solver_.valeur());
2277 Matrice_Bloc& bloc_matrix_solver = ref_cast(Matrice_Bloc, thermal_subproblems_matrix_assembly_.valeur());
2278 bloc_matrix_solver.block_to_morse(sparse_matrix_solver);
2280 {
2281 Matrice_Morse& sparse_matrix_solver_reduced = ref_cast(Matrice_Morse, thermal_subproblems_matrix_assembly_for_solver_reduced_.valeur());
2282 finite_difference_assembler_.reduce_solver_matrix(sparse_matrix_solver,
2283 sparse_matrix_solver_reduced,
2284 nb_points,
2287 }
2288 else
2290
2291 }
2292 else
2293 {
2295 }
2296}
2297
2299{
2301
2302 ArrOfInt pe_voisins_dummy;
2303 ArrsOfInt items_to_send_dummy;
2304 ArrsOfInt items_to_recv_dummy;
2305 ArrsOfInt blocs_to_recv_dummy;
2306 pe_voisins_dummy.resize(0);
2307 items_to_send_dummy.resize(0);
2308 items_to_recv_dummy.resize(0);
2309 blocs_to_recv_dummy.resize(0);
2310
2311 const int subproblems_vector_size = thermal_subproblems_rhs_assembly_.size();
2312 MD_Vector_std md_std = MD_Vector_std(subproblems_vector_size, subproblems_vector_size,
2313 pe_voisins_dummy, items_to_send_dummy,
2314 items_to_recv_dummy, blocs_to_recv_dummy);
2315 md_.copy(md_std);
2318}
2319
2321{
2322 /*
2323 * Retrieve the overall vector
2324 */
2326 thermal_local_subproblems_.retrieve_radial_quantities();
2327}
2328
2335
2337{
2338 if (debug_)
2339 {
2340 Cerr << "Check the modified RHS: INI" << finl;
2341 const double fd_second_order_magnitude = 1 / pow(dr_,2) * 1e3;
2342 for (int i=0; i<thermal_subproblems_rhs_assembly_.size(); i++)
2343 if (fabs(thermal_subproblems_rhs_assembly_[i]) > fd_second_order_magnitude)
2344 Cerr << "Check the modified RHS values: " << thermal_subproblems_rhs_assembly_[i] << finl;
2345 Cerr << "Check the modified RHS: END" << finl;
2346 }
2347}
2348
2350{
2352 corrige_flux_->update_intersections();
2353}
2354
2356{
2358 corrige_flux_->update();
2359}
2360
2362{
2363 // if (fluxes_correction_conservations_)
2364 // thermal_local_subproblems_.dispatch_interfacial_heat_flux(interfacial_heat_flux_dispatched_,
2365 // ijk_indices_flux_out_,
2366 // thermal_flux_out_);
2367 //static Stat_Counter_ID cnt_lrs_conv_flux_corr = //statistiques().new_counter(3, "Compute convective flux correction from LRS");
2368 //static Stat_Counter_ID cnt_lrs_diff_flux_corr = //statistiques().new_counter(3, "Compute diffusive flux correction from LRS");
2369 //static Stat_Counter_ID cnt_lrs_dispatch_flux_corr = //statistiques().new_counter(3, "Dispatch flux correction from LRS");
2370 //static Stat_Counter_ID cnt_lrs_complete_flux_cons = //statistiques().new_counter(3, "Complete flux conservation from LRS");
2371 //static Stat_Counter_ID cnt_lrs_min_max_flux = //statistiques().new_counter(3, "Compute far fluxes correction from LRS");
2372
2373 //statistiques().begin_count(cnt_lrs_conv_flux_corr);
2376 //statistiques().end_count(cnt_lrs_conv_flux_corr);
2377
2378 //statistiques().begin_count(cnt_lrs_diff_flux_corr);
2381 //statistiques().end_count(cnt_lrs_diff_flux_corr);
2382
2383 //statistiques().begin_count(cnt_lrs_dispatch_flux_corr);
2385 thermal_local_subproblems_.dispatch_interfacial_heat_flux_correction(interfacial_heat_flux_contrib_,
2389 //statistiques().end_count(cnt_lrs_dispatch_flux_corr);
2390
2391 //statistiques().begin_count(cnt_lrs_complete_flux_cons);
2393 //statistiques().end_count(cnt_lrs_complete_flux_cons);
2394
2395 corrige_flux_->initialise_cell_neighbours_indices_to_correct();
2396 corrige_flux_->compute_cell_neighbours_faces_indices_for_spherical_correction(n_iter_distance_);
2397
2398 //statistiques().begin_count(cnt_lrs_min_max_flux);
2400 //statistiques().end_count(cnt_lrs_min_max_flux);
2401}
2402
2408
2414
2415void IJK_Thermal_Subresolution::complete_thermal_fluxes_face_centre(const int& fluxes_correction_conservations)
2416{
2418 corrige_flux_->complete_thermal_fluxes_face_centre(fluxes_correction_conservations_);
2419}
2420
2422{
2423 corrige_flux_->compute_cell_neighbours_faces_indices_to_correct(cell_faces_neighbours_corrected_all_bool_,
2428 /*
2429 * TODO: Should we put this in the jdd (just for test)
2430 */
2431 const int discontinous_min_max_neighbours_faces = 1;
2432 const int remove_external_neighbour_values = 1;
2433 const int check_neighbour_cell_centre = !remove_external_neighbour_values;
2434 corrige_flux_->compute_min_max_ijk_any_reachable_fluxes(cell_faces_neighbours_corrected_all_bool_,
2437 discontinous_min_max_neighbours_faces,
2438 check_neighbour_cell_centre,
2439 remove_external_neighbour_values,
2441 corrige_flux_->replace_cell_neighbours_thermal_convective_diffusive_fluxes_faces(cell_faces_neighbours_corrected_min_max_bool_,
2444 0);
2445 corrige_flux_->replace_cell_neighbours_thermal_convective_diffusive_fluxes_faces(cell_faces_neighbours_corrected_min_max_bool_,
2448 1);
2450}
2451
2453{
2455 {
2457 {
2461 const double rho_cp = ref_ijk_ft_->milieu_ijk().get_rho_liquid() * cp_liquid_;
2462 for (int c=0; c<3; c++)
2463 {
2464 const int ni_max = (c==0) ? ni + 1: ni;
2465 const int nj_max = (c==1) ? nj + 1: nj;
2466 const int nk_max = (c==2) ? nk + 1: nk;
2467 for (int k = 0; k < nk_max; k++)
2468 for (int j = 0; j < nj_max; j++)
2469 for (int i = 0; i < ni_max; i++)
2470 {
2472 u_T *= (*rising_velocity_overall_)[c];
2473 const double rho_cp_u_T = u_T * rho_cp;
2476 cell_faces_neighbours_corrected_convective_[c](i,j,k) - rho_cp_u_T;
2477 }
2478 }
2479 }
2480 }
2481}
2482
2484{
2486 {
2487 switch(first_corr)
2488 {
2489 case 0:
2491 break;
2492 case 1:
2494 break;
2495 default:
2497 break;
2498 }
2499 }
2500}
2501
2503{
2504 int correct_first_iter = (correct_temperature_cell_neighbours_first_iter_
2505 && ref_ijk_ft_->schema_temps_ijk().get_tstep() == 1
2506 && !ref_ijk_ft_->get_reprise());
2507 if (debug_)
2508 Cerr << "Set correction cell neighbours" << finl;
2509 if (correct_first_iter_deactivate_cell_neighbours_ && correct_first_iter)
2510 {
2511
2514 corrige_flux_->set_correction_cell_neighbours(find_temperature_cell_neighbours_,
2518 }
2519
2520
2521 if (debug_)
2522 Cerr << "Compute temperature cell centre" << finl;
2523 corrige_flux_->compute_temperature_cell_centre(*temperature_);
2524
2525 if (debug_)
2526 Cerr << "Compute temperature cell centre neighbours" << finl;
2527 corrige_flux_->compute_temperature_cell_centre_neighbours(temperature_cell_neighbours_,
2530 if (debug_)
2531 {
2533 corrige_flux_->replace_temperature_cell_centre_neighbours(temperature_cell_neighbours_debug_,
2537 }
2538
2539 if (debug_)
2540 Cerr << "Replace temperature cell centres neighbours" << finl;
2542}
2543
2553
2554void IJK_Thermal_Subresolution::replace_temperature_cell_centres_neighbours(const int& use_neighbours_temperature_to_correct_trimmed)
2555{
2556 int correct_first_iter = (correct_temperature_cell_neighbours_first_iter_
2557 && ref_ijk_ft_->schema_temps_ijk().get_tstep() == 0
2558 && !ref_ijk_ft_->get_reprise());
2560 {
2562 {
2563 if (correct_first_iter)
2564 {
2565 corrige_flux_->replace_temperature_cell_centre_neighbours(*temperature_,
2569 }
2570 else
2571 corrige_flux_->compute_temperature_cell_centre(*temperature_);
2572 }
2573 else
2574 {
2575 if (correct_temperature_cell_neighbours_first_iter_ == correct_first_iter)
2576 {
2577 if (use_neighbours_temperature_to_correct_trimmed)
2578 corrige_flux_->replace_temperature_cell_centre_neighbours(*temperature_,
2582
2583 else
2584 corrige_flux_->replace_temperature_cell_centre_neighbours(*temperature_,
2588 }
2589 else
2590 corrige_flux_->compute_temperature_cell_centre(*temperature_);
2591 }
2592 }
2593 else
2594 corrige_flux_->compute_temperature_cell_centre(*temperature_);
2595}
2596
2597
2599{
2601 {
2602 IJK_Field_double& temperature = *temperature_;
2603
2604 const int ni = temperature.ni();
2605 const int nj = temperature.nj();
2606 const int nk = temperature.nk();
2607 const int offset_i = temperature.get_domaine().get_offset_local(0);
2608 const int offset_j = temperature.get_domaine().get_offset_local(1);
2609 const int offset_k = temperature.get_domaine().get_offset_local(2);
2610 const int ni_tot = temperature.get_domaine().get_nb_elem_tot(0);
2611 const int nj_tot = temperature.get_domaine().get_nb_elem_tot(1);
2612 const int nk_tot = temperature.get_domaine().get_nb_elem_tot(2);
2613 std::vector<double> indices_i_to_correct;
2614 std::vector<double> indices_j_to_correct;
2615 std::vector<double> indices_k_to_correct;
2616 int stencil_to_correct = stencil_periodic_boundary_value_;
2617 for (int i=0; i<stencil_to_correct; i++)
2618 {
2619 indices_i_to_correct.push_back(i);
2620 indices_j_to_correct.push_back(i);
2621 indices_k_to_correct.push_back(i);
2622 indices_i_to_correct.push_back(ni_tot-1-i);
2623 indices_j_to_correct.push_back(nj_tot-1-i);
2624 indices_k_to_correct.push_back(nk_tot-1-i);
2625 }
2626 int i,j,k;
2627 for (k = 0; k < nk; k++)
2628 if (std::find(indices_k_to_correct.begin(), indices_k_to_correct.end(), k+offset_k) != indices_k_to_correct.end())
2629 for (j = 0; j < nj; j++)
2630 for (i = 0; i < ni; i++)
2631 {
2632 const double indic = ref_ijk_ft_->get_interface().I(i,j,k);
2633 if (fabs(indic)>LIQUID_INDICATOR_TEST) // Mixed cells and pure vapour cells
2634 { temperature(i,j,k) = delta_T_subcooled_overheated_; }
2635 }
2636 for (j = 0; j < nj; j++)
2637 if (std::find(indices_j_to_correct.begin(), indices_j_to_correct.end(), j+offset_j) != indices_j_to_correct.end())
2638 for (k = 0; k < nk; k++)
2639 for (i = 0; i < ni; i++)
2640 {
2641 const double indic = ref_ijk_ft_->get_interface().I(i,j,k);
2642 if (fabs(indic)>LIQUID_INDICATOR_TEST) // Mixed cells and pure vapour cells
2643 { temperature(i,j,k) = delta_T_subcooled_overheated_; }
2644 }
2645 for (i = 0; i < ni; i++)
2646 if (std::find(indices_i_to_correct.begin(), indices_i_to_correct.end(), i+offset_i) != indices_i_to_correct.end())
2647 for (k = 0; k < nk; k++)
2648 for (j = 0; j < nj; j++)
2649 {
2650 const double indic = ref_ijk_ft_->get_interface().I(i,j,k);
2651 if (fabs(indic)>LIQUID_INDICATOR_TEST) // Mixed cells and pure vapour cells
2652 { temperature(i,j,k) = delta_T_subcooled_overheated_; }
2653 }
2654 }
2655}
2656
2658{
2660 {
2661 IJK_Field_double& div_coeff_grad_T_volume = *div_coeff_grad_T_volume_;
2662
2663 const int ni = div_coeff_grad_T_volume_->ni();
2664 const int nj = div_coeff_grad_T_volume_->nj();
2665 const int nk = div_coeff_grad_T_volume_->nk();
2666 for (int k = 0; k < nk; k++)
2667 for (int j = 0; j < nj; j++)
2668 for (int i = 0; i < ni; i++)
2669 {
2670 const double indic = ref_ijk_ft_->get_interface().I(i,j,k);
2671 if (fabs(indic)<LIQUID_INDICATOR_TEST) // Mixed cells and pure vapour cells
2672 { div_coeff_grad_T_volume(i,j,k) = 0; }
2673 }
2674 }
2676 {
2677 const int ni = u_T_convective_volume_.ni();
2678 const int nj = u_T_convective_volume_.nj();
2679 const int nk = u_T_convective_volume_.nk();
2680 for (int k = 0; k < nk; k++)
2681 for (int j = 0; j < nj; j++)
2682 for (int i = 0; i < ni; i++)
2683 {
2684 const double indic = ref_ijk_ft_->get_interface().I(i,j,k);
2685 if (fabs(indic)<LIQUID_INDICATOR_TEST) // Mixed cells and pure vapour cells
2686 { u_T_convective_volume_(i,j,k) = 0; }
2687 }
2688 }
2689}
2690
2692{
2694 {
2696 {
2697 corrige_flux_->compute_ijk_pure_faces_indices();
2698 corrige_flux_->sort_ijk_intersections_subproblems_indices_by_k_layers();
2699 }
2701 {
2702 corrige_flux_->store_cell_faces_corrected(cell_faces_corrected_bool_,
2705 }
2706 }
2707}
2708
2710{
2712 {
2714 corrige_flux_->set_zero_temperature_increment(*d_temperature_);
2715 }
2716 else
2718}
2719
2721{
2722 if (ref_ijk_ft_->schema_temps_ijk().get_tstep() > 0)
2723 {
2727 corrige_flux_->clear_vectors();
2728 }
2729}
2730
2732{
2734 corrige_flux_->clean();
2735}
2736
2737void IJK_Thermal_Subresolution::set_thermal_subresolution_outputs(const Nom& interfacial_quantities_thermal_probes,
2738 const Nom& shell_quantities_thermal_probes,
2739 const Nom& overall_bubbles_quantities,
2740 const Nom& local_quantities_thermal_probes_time_index_folder)
2741{
2743 {
2744 if (debug_)
2745 Cerr << "Compute bubbles quantities" << finl;
2746 thermal_local_subproblems_.compute_overall_bubbles_quantities((*this));
2747 if (debug_)
2748 Cerr << "Sort spherical coords" << finl;
2749 thermal_local_subproblems_.sort_limited_probes_spherical_coords_post_processing(post_process_all_probes_,
2751 (int) 1, (int) 1);
2752 if (debug_)
2753 Cerr << "Write post-processings" << finl;
2754 thermal_local_subproblems_.thermal_subresolution_outputs_parallel(rank_,
2755 interfacial_quantities_thermal_probes,
2756 shell_quantities_thermal_probes,
2757 overall_bubbles_quantities,
2758 local_quantities_thermal_probes_time_index_folder);
2759 }
2760}
2761
2763{
2766 {
2768 {
2771 (int) 0);
2772 else
2773 thermal_local_subproblems_.compare_fluxes_thermal_subproblems(rho_cp_u_T_convective_raw_,
2774 (int) 0);
2775 }
2777 {
2780 (int) 0,
2781 (int) 1);
2782 else
2783 thermal_local_subproblems_.compare_fluxes_thermal_subproblems(div_coeff_grad_T_raw_,
2784 (int) 1);
2785 }
2786 }
2787}
2788
2789void IJK_Thermal_Subresolution::post_process_thermal_downstream_lines(const Nom& local_quantities_thermal_lines_time_index_folder)
2790{
2791 const int nb_real_bubbles = ref_ijk_ft_->get_interface().get_nb_bulles_reelles();
2792 if (post_process_thermal_lines_ && nb_real_bubbles==1)
2793 {
2794 int line_dir = ref_ijk_ft_->milieu_ijk().get_direction_gravite();
2795 if (upstream_dir_line_ > 0)
2796 line_dir = upstream_dir_line_;
2797
2798 int nb_thermal_lines = nb_thermal_lines_;
2799 if (nb_thermal_lines_ != 1)
2800 nb_thermal_lines += (nb_thermal_lines % 2);
2801
2802 int nb_thermal_circles = nb_thermal_concentric_circles_;
2803
2804
2805 /*
2806 * Do something for oscillating bubble ?
2807 */
2808 // (*rising_vectors_(0, line_dir));
2809 ArrOfDouble linear_coord;
2810 FixedVector<ArrOfDouble,3> coordinates_line;
2811 std::vector<std::vector<FixedVector<ArrOfInt,3>>> indices_ijk;
2812 linear_coord.resize(nb_thermal_line_points_);
2813 for (int c=0; c<3; c++)
2814 {
2815 coordinates_line[c].resize(nb_thermal_line_points_);
2816 }
2817 double diameter_approx = 0.;
2818 std::vector<std::vector<FixedVector<ArrOfDouble,2>>> coordinates_sides;
2819 std::vector<std::vector<ArrOfInt>> is_point_on_proc;
2820 // std::vector<std::vector<ArrOfDouble>> temperature_line;
2821 // std::vector<std::vector<ArrOfDouble>> velocity_line;
2822 // std::vector<std::vector<ArrOfDouble>> convective_flux_line;
2823 // std::vector<std::vector<ArrOfDouble>> diffusive_flux_line;
2824 // std::vector<std::vector<ArrOfDouble>> temperature_increment_line;
2826 nb_thermal_circles,
2827 nb_thermal_lines);
2829 nb_thermal_circles,
2830 nb_thermal_lines);
2831 // initialise_thermal_dowstreamlines_tabs(temperature_line,
2832 // nb_thermal_circles,
2833 // nb_thermal_lines);
2834 // initialise_thermal_dowstreamlines_tabs(velocity_line,
2835 // nb_thermal_circles,
2836 // nb_thermal_lines);
2837 // initialise_thermal_dowstreamlines_tabs(convective_flux_line,
2838 // nb_thermal_circles,
2839 // nb_thermal_lines);
2840 // initialise_thermal_dowstreamlines_tabs(diffusive_flux_line,
2841 // nb_thermal_circles,
2842 // nb_thermal_lines);
2843 // initialise_thermal_dowstreamlines_tabs(temperature_increment_line,
2844 // nb_thermal_circles,
2845 // nb_thermal_lines);
2847 linear_coord,
2848 coordinates_line,
2849 diameter_approx);
2850 find_cocentric_line_coordinates(nb_thermal_circles,
2851 nb_thermal_lines,
2852 diameter_approx,
2853 coordinates_sides);
2854 find_points_on_proc(is_point_on_proc,
2855 indices_ijk,
2856 coordinates_line,
2857 coordinates_sides,
2858 line_dir);
2859
2860 int linear_circle_line_index = 0;
2861 for (int circle=0; circle<nb_thermal_circles; circle++)
2862 {
2863 for (int line=0; line<(int) nb_thermal_lines; line++)
2864 {
2865 DoubleVect temperature_line(nb_thermal_line_points_);
2867 nb_thermal_circles,
2868 circle,
2869 line,
2870 is_point_on_proc,
2871 coordinates_line,
2872 coordinates_sides,
2873 temperature_line);
2874
2875
2876 DoubleVect velocity_line(nb_thermal_line_points_);
2878 nb_thermal_circles,
2879 circle,
2880 line,
2881 is_point_on_proc,
2882 coordinates_line,
2883 coordinates_sides,
2884 velocity_line);
2885
2886 DoubleVect convective_term_line(nb_thermal_line_points_);
2888 nb_thermal_circles,
2889 circle,
2890 line,
2891 is_point_on_proc,
2892 coordinates_line,
2893 coordinates_sides,
2894 convective_term_line);
2895 DoubleVect diffusive_term_line(nb_thermal_line_points_);
2897 nb_thermal_circles,
2898 circle,
2899 line,
2900 is_point_on_proc,
2901 coordinates_line,
2902 coordinates_sides,
2903 diffusive_term_line);
2904
2905 DoubleVect temperature_incr_line(nb_thermal_line_points_);
2907 nb_thermal_circles,
2908 circle,
2909 line,
2910 is_point_on_proc,
2911 coordinates_line,
2912 coordinates_sides,
2913 temperature_incr_line);
2914
2915 post_processed_fields_on_downstream_line(local_quantities_thermal_lines_time_index_folder,
2916 line_dir,
2917 linear_circle_line_index,
2918 circle,
2919 line,
2920 diameter_approx,
2921 is_point_on_proc,
2922 indices_ijk,
2923 linear_coord,
2924 coordinates_line,
2925 coordinates_sides,
2926 temperature_line,
2927 velocity_line,
2928 convective_term_line,
2929 diffusive_term_line,
2930 temperature_incr_line);
2931 linear_circle_line_index++;
2932 if (circle == 0)
2933 break;
2934 }
2935 }
2936 }
2937}
2938
2940 const int& nb_thermal_circles,
2941 const int& nb_thermal_lines)
2942{
2943 parameters.resize(nb_thermal_circles);
2944 for (int circle=0; circle<nb_thermal_circles; circle++)
2945 {
2946 if (circle == 0)
2947 parameters[circle].resize(1);
2948 else
2949 parameters[circle].resize(nb_thermal_lines);
2950 for (int line=0; line< (int) parameters[circle].size(); line++)
2951 {
2952 for (int c=0; c<3; c++)
2953 {
2954 parameters[circle][line][c].resize(nb_thermal_line_points_);
2955 }
2956 }
2957 }
2958}
2959
2961 const int& nb_thermal_circles,
2962 const int& nb_thermal_lines)
2963{
2964 parameters.resize(nb_thermal_circles);
2965 for (int circle=0; circle<nb_thermal_circles; circle++)
2966 {
2967 if (circle == 0)
2968 parameters[circle].resize(1);
2969 else
2970 parameters[circle].resize(nb_thermal_lines);
2971 for (int line=0; line< (int) parameters[circle].size(); line++)
2972 {
2973 for (int c=0; c<2; c++)
2974 {
2975 parameters[circle][line][c].resize(nb_thermal_line_points_);
2976 }
2977 }
2978 }
2979}
2980
2981void IJK_Thermal_Subresolution::initialise_thermal_dowstreamlines_tabs(std::vector<std::vector<ArrOfInt>>& parameters,
2982 const int& nb_thermal_circles,
2983 const int& nb_thermal_lines)
2984{
2985 parameters.resize(nb_thermal_circles);
2986 for (int circle=0; circle<nb_thermal_circles; circle++)
2987 {
2988 if (circle == 0)
2989 parameters[circle].resize(1);
2990 else
2991 parameters[circle].resize(nb_thermal_lines);
2992 for (int line=0; line< (int) parameters[circle].size(); line++)
2993 {
2994 parameters[circle][line].resize(nb_thermal_line_points_);
2995 }
2996 }
2997}
2998
2999void IJK_Thermal_Subresolution::initialise_thermal_dowstreamlines_tabs(std::vector<std::vector<ArrOfDouble>>& parameters,
3000 const int& nb_thermal_circles,
3001 const int& nb_thermal_lines)
3002{
3003 parameters.resize(nb_thermal_circles);
3004 for (int circle=0; circle<nb_thermal_circles; circle++)
3005 {
3006 if (circle == 0)
3007 parameters[circle].resize(1);
3008 else
3009 parameters[circle].resize(nb_thermal_lines);
3010 for (int line=0; line< (int) parameters[circle].size(); line++)
3011 {
3012 parameters[circle][line].resize(nb_thermal_line_points_);
3013 }
3014 }
3015}
3016
3018 ArrOfDouble& linear_coord,
3019 FixedVector<ArrOfDouble,3>& coordinates_line,
3020 double& diameter)
3021{
3022 const Domaine_IJK& geom = temperature_->get_domaine();
3023 bool perio = geom.get_periodic_flag(line_dir);
3024 assert(ref_ijk_ft_->get_interface().get_nb_bulles_reelles() == 1);
3025
3026 DoubleTab bounding_box;
3027 bounding_box = ref_ijk_ft_->get_interface().get_ijk_compo_connex().get_bounding_box();
3028 const double Dbdir = bounding_box(0, line_dir, 1) - bounding_box(0, line_dir, 0);
3029 const double dirb = (*bubbles_barycentre_)(0, line_dir);
3030 const double ldir = geom.get_domain_length(line_dir);
3031
3032 const double origin_dir = geom.get_origin(line_dir) ;
3033
3034 double maximum_probe_length = 0.;
3035 if (perio)
3036 maximum_probe_length = ldir - Dbdir;
3037 else
3038 maximum_probe_length = dirb - origin_dir - Dbdir/2;
3039
3040 double usr_probe_length = abs(Dbdir * nb_diam_thermal_line_length_);
3041 if (usr_probe_length > maximum_probe_length)
3042 {
3043 usr_probe_length = int(maximum_probe_length / Dbdir) * Dbdir;
3044 usr_probe_length = signbit(nb_diam_thermal_line_length_) ? -usr_probe_length : usr_probe_length;
3045 }
3046
3047 const double dx = abs(usr_probe_length / (nb_thermal_line_points_ - 1));
3048 const double Dbdir_sign = signbit(nb_diam_thermal_line_length_) ? -abs(Dbdir) : abs(Dbdir);
3049 for (int point = 0; point<nb_thermal_line_points_; point++)
3050 {
3051 linear_coord[point] = dx * point;
3052 for (int c=0; c<3; c++)
3053 {
3054 if (c!=line_dir)
3055 coordinates_line[c][point] = (*bubbles_barycentre_)(0, c);
3056 else
3057 coordinates_line[c][point] = dirb + Dbdir_sign / 2.;
3058 }
3059 }
3060 ArrOfDouble linear_coord_tmp = linear_coord;
3061 if (signbit(nb_diam_thermal_line_length_))
3062 linear_coord_tmp *= (-1);
3063 coordinates_line[line_dir] += linear_coord_tmp;
3064
3065 for (int point = 0; point<nb_thermal_line_points_; point++)
3066 {
3067 if (coordinates_line[line_dir][point] < origin_dir)
3068 coordinates_line[line_dir][point] += ldir;
3069 if (coordinates_line[line_dir][point] > origin_dir + ldir)
3070 coordinates_line[line_dir][point] -= ldir;
3071 }
3072
3073 diameter = 0.;
3074 for (int c=0; c<3; c++)
3075 if (c!=line_dir)
3076 diameter += (bounding_box(0, c, 1) - bounding_box(0, c, 0));
3077 diameter *= 0.5;
3078}
3079
3081 const int& nb_thermal_lines,
3082 const double& diameter_approx,
3083 std::vector<std::vector<FixedVector<ArrOfDouble,2>>>& coordinates_sides)
3084{
3085 if (nb_thermal_circles == 1)
3086 return;
3087}
3088
3089void IJK_Thermal_Subresolution::find_points_on_proc(std::vector<std::vector<ArrOfInt>>& is_point_on_proc,
3090 std::vector<std::vector<FixedVector<ArrOfInt,3>>>& ijk_indices,
3091 const FixedVector<ArrOfDouble,3>& coordinates_line,
3092 const std::vector<std::vector<FixedVector<ArrOfDouble,2>>>& coordinates_sides,
3093 const int& line_dir)
3094{
3095 const Domaine_IJK& geom = temperature_->get_domaine();
3096
3097 double min_dir_x, max_dir_x;
3098 min_max_ldir(0, geom, min_dir_x, max_dir_x);
3099 double min_dir_y, max_dir_y;
3100 min_max_ldir(1, geom, min_dir_y, max_dir_y);
3101 double min_dir_z, max_dir_z;
3102 min_max_ldir(2, geom, min_dir_z, max_dir_z);
3103
3104 const int offset_i = geom.get_offset_local(0);
3105 const int offset_j = geom.get_offset_local(1);
3106 const int offset_k = geom.get_offset_local(2);
3107
3108 const int nb_i = temperature_->ni();
3109 const int nb_j = temperature_->nj();
3110 const int nb_k = temperature_->nk();
3111 const int nb_i_max = offset_i + nb_i;
3112 const int nb_j_max = offset_j + nb_j;
3113 const int nb_k_max = offset_k + nb_k;
3114
3115 const double lx = geom.get_domain_length(0);
3116 const double ly = geom.get_domain_length(1);
3117 const double lz = geom.get_domain_length(2);
3118
3119 const double dx = geom.get_constant_delta(0);
3120 const double dy = geom.get_constant_delta(1);
3121 const double dz = geom.get_constant_delta(2);
3122
3123 const int nb_thermal_circles = (int) is_point_on_proc.size();
3124 for (int circle=0; circle<nb_thermal_circles; circle++)
3125 {
3126 const int nb_thermal_lines = (int) is_point_on_proc[circle].size();
3127 for (int line=0; line<(int) nb_thermal_lines; line++)
3128 {
3129 Cerr << "nb_thermal_lines:" << nb_thermal_lines << finl;
3130 const int nb_points = (int) is_point_on_proc[circle][0].size_array();
3131 assert(nb_points == coordinates_line[0].size_array());
3132 Cerr << "nb_points:" << nb_points << finl;
3133 for (int point=0; point<nb_points; point++)
3134 {
3135 double x = coordinates_line[0][point];
3136 double y = coordinates_line[1][point];
3137 double z = coordinates_line[2][point];
3138 if (x > max_dir_x)
3139 x -= lx;
3140 if (x < min_dir_x)
3141 x += lx;
3142 if (y > max_dir_y)
3143 y -= ly;
3144 if (y < min_dir_y)
3145 y += ly;
3146 if (z > max_dir_z)
3147 z -= lz;
3148 if (z < min_dir_z)
3149 z += lz;
3150 const int ndx = (int) ((x - min_dir_x) / dx);
3151 const int ndy = (int) ((y - min_dir_y) / dy);
3152 const int ndz = (int) ((z - min_dir_z) / dz);
3153 // const int ndx_round = (int) round((x - min_dir_x) / dx);
3154 // const int ndy_round = (int) round((y - min_dir_y) / dy);
3155 // const int ndz_round = (int) round((z - min_dir_z) / dz);
3156 const int ndx_ceil = (int) ceil((x - min_dir_x) / dx);
3157 const int ndy_ceil = (int) ceil((y - min_dir_y) / dy);
3158 const int ndz_ceil = (int) ceil((z - min_dir_z) / dz);
3159 // const int in_x = (ndx >= offset_i && ndx_ceil >= offset_i
3160 // && ndx <= nb_i_max && ndx_round <= nb_i_max);
3161 // const int in_y = (ndy >= offset_j && ndy_ceil >= offset_j
3162 // && ndy <= nb_j_max && ndy_round <= nb_j_max);
3163 // const int in_z = (ndz >= offset_k && ndz_ceil >= offset_k
3164 // && ndz <= nb_k_max && ndz_round <= nb_k_max);
3165 const int in_x = (ndx_ceil > offset_i && ndx < nb_i_max);
3166 const int in_y = (ndy_ceil > offset_j && ndy < nb_j_max);
3167 const int in_z = (ndz_ceil > offset_k && ndz < nb_k_max);
3168 if (in_x && in_y && in_z)
3169 {
3170 is_point_on_proc[circle][0][point] = 1;
3171 ijk_indices[circle][line][0][point] = ndx - offset_i;
3172 ijk_indices[circle][line][1][point] = ndy - offset_j;
3173 ijk_indices[circle][line][2][point] = ndz - offset_k;
3174 }
3175 }
3176 ArrOfInt i_indices = ijk_indices[circle][line][0];
3177 ArrOfInt j_indices = ijk_indices[circle][line][1];
3178 ArrOfInt k_indices = ijk_indices[circle][line][2];
3179 mp_sum_for_each_item(ijk_indices[circle][line][0]);
3180 mp_sum_for_each_item(ijk_indices[circle][line][1]);
3181 mp_sum_for_each_item(ijk_indices[circle][line][2]);
3182 for (int l=0; l<nb_points; l++)
3183 if (is_point_on_proc[circle][line][l])
3184 {
3185 ijk_indices[circle][line][0][l] = i_indices[l];
3186 ijk_indices[circle][line][1][l] = j_indices[l];
3187 ijk_indices[circle][line][2][l] = k_indices[l];
3188 }
3189
3190 }
3191 }
3192}
3193
3195 const Domaine_IJK& geom,
3196 double& min_dir,
3197 double& max_dir)
3198{
3199 // const double ddir = geom.get_constant_delta(dir);
3200 const double ldir = geom.get_domain_length(dir);
3201 const double origin_dir = geom.get_origin(dir);
3202 min_dir = origin_dir;
3203 max_dir = origin_dir + ldir;
3204}
3205
3207 const int& nb_thermal_circles,
3208 const int& index_circle,
3209 const int& index_line,
3210 const std::vector<std::vector<ArrOfInt>>& is_point_on_proc,
3211 const FixedVector<ArrOfDouble,3>& coordinates_line,
3212 const std::vector<std::vector<FixedVector<ArrOfDouble,2>>>& coordinates_sides,
3213 const IJK_Field_double& field,
3214 const IJK_Field_vector3_double& field_gradient,
3215 const IJK_Field_vector3_double& velocity,
3216 DoubleVect& values,
3217 const int field_type)
3218{
3219 const int nb_points = coordinates_line[0].size_array();
3220 DoubleTab ijk_coords_interp(nb_points, 3);
3221 DoubleVect field_interp(nb_points);
3222 for (int l=0; l<nb_points; l++)
3223 for (int c=0; c<3; c++)
3224 ijk_coords_interp(l, c) = coordinates_line[c][l];
3225
3226 if (index_circle > 0)
3227 {
3228 switch(dir)
3229 {
3230 case 0:
3231 for (int l=0; l<nb_points; l++)
3232 {
3233 ijk_coords_interp(l, 1) = coordinates_sides[index_circle-1][index_line][0][l];
3234 ijk_coords_interp(l, 2) = coordinates_sides[index_circle-1][index_line][1][l];
3235 }
3236 break;
3237 case 1:
3238 for (int l=0; l<nb_points; l++)
3239 {
3240 ijk_coords_interp(l, 0) = coordinates_sides[index_circle-1][index_line][0][l];
3241 ijk_coords_interp(l, 2) = coordinates_sides[index_circle-1][index_line][1][l];
3242 }
3243 break;
3244 case 2:
3245 for (int l=0; l<nb_points; l++)
3246 {
3247 ijk_coords_interp(l, 0) = coordinates_sides[index_circle-1][index_line][0][l];
3248 ijk_coords_interp(l, 1) = coordinates_sides[index_circle-1][index_line][1][l];
3249 }
3250 break;
3251 default:
3252 break;
3253 }
3254 }
3255
3256 switch(field_type)
3257 {
3258 case 0:
3259 ijk_interpolate_skip_unknown_points(field, ijk_coords_interp, field_interp, INVALID_INTERP);
3260 break;
3261 case 1:
3262 ijk_interpolate_skip_unknown_points(field_gradient[dir], ijk_coords_interp, field_interp, INVALID_INTERP);
3263 break;
3264 case 2:
3265 ijk_interpolate_skip_unknown_points(velocity[dir], ijk_coords_interp, field_interp, INVALID_INTERP);
3266 break;
3267 default:
3268 break;
3269 }
3270
3271 values = field_interp;
3272 for (int l=0; l<nb_points; l++)
3273 if (!is_point_on_proc[index_circle][index_line][l])
3274 values[l] = 0.;
3275 mp_sum_for_each_item(values);
3276}
3277
3279 const int& nb_thermal_circles,
3280 const int& index_circle,
3281 const int& index_line,
3282 const std::vector<std::vector<ArrOfInt>>& is_point_on_proc,
3283 const FixedVector<ArrOfDouble,3>& coordinates_line,
3284 const std::vector<std::vector<FixedVector<ArrOfDouble,2>>>& coordinates_sides,
3285 DoubleVect& values)
3286{
3288 nb_thermal_circles,
3289 index_circle,
3290 index_line,
3291 is_point_on_proc,
3292 coordinates_line,
3293 coordinates_sides,
3294 *temperature_,
3296 ref_ijk_ft_->eq_ns().get_velocity(),
3297 values,
3298 0);
3299}
3300
3302 const int& nb_thermal_circles,
3303 const int& index_circle,
3304 const int& index_line,
3305 const std::vector<std::vector<ArrOfInt>>& is_point_on_proc,
3306 const FixedVector<ArrOfDouble,3>& coordinates_line,
3307 const std::vector<std::vector<FixedVector<ArrOfDouble,2>>>& coordinates_sides,
3308 DoubleVect& values)
3309{
3311 nb_thermal_circles,
3312 index_circle,
3313 index_line,
3314 is_point_on_proc,
3315 coordinates_line,
3316 coordinates_sides,
3317 *temperature_,
3319 ref_ijk_ft_->eq_ns().get_velocity(),
3320 values,
3321 2);
3322}
3323
3325 const int& nb_thermal_circles,
3326 const int& index_circle,
3327 const int& index_line,
3328 const std::vector<std::vector<ArrOfInt>>& is_point_on_proc,
3329 const FixedVector<ArrOfDouble,3>& coordinates_line,
3330 const std::vector<std::vector<FixedVector<ArrOfDouble,2>>>& coordinates_sides,
3331 DoubleVect& values)
3332{
3334 nb_thermal_circles,
3335 index_circle,
3336 index_line,
3337 is_point_on_proc,
3338 coordinates_line,
3339 coordinates_sides,
3340 *temperature_,
3342 ref_ijk_ft_->eq_ns().get_velocity(),
3343 values,
3344 0);
3345
3347 values += (-delta_T_subcooled_overheated_);
3348
3349 DoubleTab velocity_line(values.size_array());
3351 nb_thermal_circles,
3352 index_circle,
3353 index_line,
3354 is_point_on_proc,
3355 coordinates_line,
3356 coordinates_sides,
3357 *temperature_,
3359 ref_ijk_ft_->eq_ns().get_velocity(),
3360 velocity_line,
3361 2);
3362 DoubleTab velocity_line_frame_of_ref = velocity_line;
3363 // Be careful with Leibniz rules !!!!!!!!!!
3364 // if (upstream_temperature_ > -1e20 && ref_ijk_ft_->get_vitesse_upstream() > -1e20)
3365 // velocity_values_frame_of_ref += (*rising_velocity_overall_)[dir];
3366 // else
3367 velocity_line_frame_of_ref -= (*rising_velocity_overall_)[dir];
3368 if (debug_)
3369 {
3370 Cerr << "Rising velocity on lines" << (*rising_velocity_overall_)[dir] << finl;
3371 Cerr << "Rising velocity magnitude" << (*rising_velocities_)(0) << finl;
3372 Cerr << "Rising vector sign" << (*rising_vectors_)(0, dir) << finl;
3373 }
3374 values *= velocity_line_frame_of_ref;
3375 values *= (ref_ijk_ft_->milieu_ijk().get_rho_liquid() * cp_liquid_);
3376}
3377
3379 const int& nb_thermal_circles,
3380 const int& index_circle,
3381 const int& index_line,
3382 const std::vector<std::vector<ArrOfInt>>& is_point_on_proc,
3383 const FixedVector<ArrOfDouble,3>& coordinates_line,
3384 const std::vector<std::vector<FixedVector<ArrOfDouble,2>>>& coordinates_sides,
3385 DoubleVect& values)
3386{
3388 nb_thermal_circles,
3389 index_circle,
3390 index_line,
3391 is_point_on_proc,
3392 coordinates_line,
3393 coordinates_sides,
3394 *temperature_,
3396 ref_ijk_ft_->eq_ns().get_velocity(),
3397 values,
3398 1);
3399 values *= uniform_lambda_;
3400}
3401
3403 const int& nb_thermal_circles,
3404 const int& index_circle,
3405 const int& index_line,
3406 const std::vector<std::vector<ArrOfInt>>& is_point_on_proc,
3407 const FixedVector<ArrOfDouble,3>& coordinates_line,
3408 const std::vector<std::vector<FixedVector<ArrOfDouble,2>>>& coordinates_sides,
3409 DoubleVect& values)
3410{
3412 nb_thermal_circles,
3413 index_circle,
3414 index_line,
3415 is_point_on_proc,
3416 coordinates_line,
3417 coordinates_sides,
3420 ref_ijk_ft_->eq_ns().get_velocity(),
3421 values,
3422 0);
3423 // values *= ref_ijk_ft_->schema_temps_ijk().get_timestep();
3424}
3425
3426void IJK_Thermal_Subresolution::post_processed_fields_on_downstream_line(const Nom& local_quantities_thermal_lines_time_index_folder,
3427 const int& line_dir,
3428 const int& linear_circle_line_index,
3429 const int& index_circle,
3430 const int& index_line,
3431 const double& diameter_approx,
3432 std::vector<std::vector<ArrOfInt>>& is_point_on_proc,
3433 const std::vector<std::vector<FixedVector<ArrOfInt,3>>>& indices_ijk,
3434 const ArrOfDouble& linear_coord,
3435 const FixedVector<ArrOfDouble,3>& coordinates_line,
3436 const std::vector<std::vector<FixedVector<ArrOfDouble,2>>>& coordinates_sides,
3437 const DoubleVect& temperature_line,
3438 const DoubleVect& velocity_line,
3439 const DoubleVect& convective_term_line,
3440 const DoubleVect& diffusive_term_line,
3441 const DoubleVect& temperature_incr_line)
3442{
3443 is_point_on_proc[index_circle][index_line] *= (int) Process::me() + 1;
3444 ArrOfInt& is_on_proc_tmp = is_point_on_proc[index_circle][index_line];
3445 mp_sum_for_each_item(is_on_proc_tmp);
3446 is_on_proc_tmp -= 1;
3448 {
3449 Cerr << "Post-processing on the lines - INI" << finl;
3450 const int reset = 1;
3451 const double last_time = ref_ijk_ft_->schema_temps_ijk().get_current_time() - ref_ijk_ft_->schema_temps_ijk().get_timestep();
3452 const int last_time_index = ref_ijk_ft_->schema_temps_ijk().get_tstep() + latastep_reprise_ini_;
3453 const int max_digit = 3;
3454 const int max_digit_time = 8;
3455 const int max_rank_digit = rank_ < 1 ? 1 : (int) (log10(rank_) + 1);
3456 const int nb_digit_tstep = last_time_index < 1 ? 1 : (int) (log10(last_time_index) + 1);
3457 const int nb_digit_index_slice = linear_circle_line_index < 1 ? 1 : (int) (log10(linear_circle_line_index) + 1);
3458 Nom line_name = Nom("_thermal_rank_") + Nom(std::string(max_digit - max_rank_digit, '0')) + Nom(rank_) +
3459 Nom("_line_index_") + Nom(std::string(max_digit - nb_digit_index_slice, '0')) + Nom(linear_circle_line_index)
3460 + Nom("_local_quantities_thermal_lines_time_index_")
3461 + Nom(std::string(max_digit_time - nb_digit_tstep, '0')) + Nom(last_time_index) + Nom(".out");
3462 Nom line_header = Nom("tstep\tthermal_rank\tpost_pro_index\tlinear_index"
3463 "\ttime\tcharacteristic_time\ttime_dimensionless"
3464 "\tproc_index"
3465 "\tindex_i\tindex_j\tindex_k"
3466 "\tlinear_coord"
3467 "\tx_coord\ty_coord\tz_coord"
3468 "\ttemperature\tvelocity"
3469 "\tconvective_term\tdiffusive_term"
3470 "\ttemperature_incr");
3471 SFichier fic = Open_file_folder(local_quantities_thermal_lines_time_index_folder, line_name, line_header, reset);
3472 const int nb_points = temperature_line.size_array();
3473 const double gravite_norm = ref_ijk_ft_->milieu_ijk().get_gravite_norm();
3474 const double characteristic_time = (gravite_norm > 1e-6) ? last_time / sqrt(diameter_approx * gravite_norm) : last_time;
3475 const double rho_l = ref_ijk_ft_->milieu_ijk().get_rho_liquid();
3476 const double rho_v = ref_ijk_ft_->milieu_ijk().get_rho_vapour();
3477 const double archimedes_time = sqrt(gravite_norm * (rho_l - rho_v) / (diameter_approx * rho_l));
3478 const double dimensionless_time = (archimedes_time > 1e-6) ? last_time / archimedes_time : last_time;
3479 for (int l=0; l<nb_points; l++)
3480 {
3481 double x_coord = coordinates_line[0][l];
3482 double y_coord = coordinates_line[1][l];
3483 double z_coord = coordinates_line[2][l];
3484 if (index_circle > 0)
3485 {
3486 switch(line_dir)
3487 {
3488 case 0:
3489 y_coord = coordinates_sides[index_circle-1][index_line][0][l];
3490 z_coord = coordinates_sides[index_circle-1][index_line][1][l];
3491 break;
3492 case 1:
3493 x_coord = coordinates_sides[index_circle-1][index_line][0][l];
3494 z_coord = coordinates_sides[index_circle-1][index_line][1][l];
3495 break;
3496 case 2:
3497 x_coord = coordinates_sides[index_circle-1][index_line][0][l];
3498 y_coord = coordinates_sides[index_circle-1][index_line][1][l];
3499 break;
3500 default:
3501 break;
3502 }
3503 }
3504 fic << last_time_index << " ";
3505 fic << rank_ << " " << linear_circle_line_index << " " << l << " ";
3506 fic << last_time << " ";
3507 fic << characteristic_time << " ";
3508 fic << dimensionless_time << " ";
3509 fic << is_on_proc_tmp[l] << " ";
3510 fic << indices_ijk[index_circle][index_line][0][l] << " ";
3511 fic << indices_ijk[index_circle][index_line][1][l] << " ";
3512 fic << indices_ijk[index_circle][index_line][2][l] << " ";
3513 fic << linear_coord[l] << " ";
3514 fic << x_coord << " ";
3515 fic << y_coord << " ";
3516 fic << z_coord << " ";
3517 fic << temperature_line[l] << " ";
3518 fic << velocity_line[l] << " ";
3519 fic << convective_term_line[l] << " ";
3520 fic << diffusive_term_line[l] << " ";
3521 fic << temperature_incr_line[l] << " ";
3522 fic << finl;
3523 }
3524 fic.close();
3525 Cerr << "Post-processing on the lines - END" << finl;
3526 }
3527}
3528
3529void IJK_Thermal_Subresolution::post_process_thermal_wake_slices(const Nom& local_quantities_thermal_slices_time_index_folder)
3530{
3531 const int nb_real_bubbles = ref_ijk_ft_->get_interface().get_nb_bulles_reelles();
3532 if (post_process_thermal_slices_ && nb_real_bubbles==1)
3533 {
3534 ArrOfDouble nb_diam_slices;
3535 nb_diam_slices.append_array(nb_diam_slice_);
3536 double diam_incr = nb_diam_slice_ / nb_slices_;
3537 double diam_incr_int, diam_incr_ext;
3538 int nb_slices_ext = abs ((int) nb_diam_slice_);
3539 int nb_slices_int = nb_slices_ - nb_slices_ext;
3540 if (nb_slices_int > 0 && thermal_slices_regions_)
3541 {
3542 diam_incr_int = 1. / (double) (nb_slices_ - nb_slices_ext + 1);
3543 diam_incr_int = signbit(nb_diam_slice_) ? -diam_incr_int : diam_incr_int;
3544 diam_incr_ext = nb_diam_slice_ / nb_slices_ext;
3545 for (int slice = nb_slices_ext - 2; slice >= 0; slice--)
3546 nb_diam_slices.append_array((slice + 1) * diam_incr_ext);
3547 for (int slice = nb_slices_int - 1; slice >= 0; slice--)
3548 nb_diam_slices.append_array((slice + 1) * diam_incr_int);
3549 }
3550 else
3551 {
3552 for (int slice = nb_slices_ - 2; slice >= 0; slice--)
3553 nb_diam_slices.append_array((slice + 1) * diam_incr);
3554 }
3555 for (int slice = 0; slice < nb_slices_; slice++)
3557 nb_diam_slices[slice],
3558 local_quantities_thermal_slices_time_index_folder);
3559 }
3560}
3561
3563 const double& nb_diam_slice,
3564 const Nom& local_quantities_thermal_slices_time_index_folder)
3565{
3566 int index_dir_local = -1;
3567 int index_dir_global = -1;
3568 int dir;
3569 int n_cross_section_1, n_cross_section_2;
3570 double diameter_approx = 0.;
3571 const double slice_pos = post_process_thermal_wake_slice_index_dir(index_dir_local,
3572 index_dir_global,
3573 n_cross_section_1,
3574 n_cross_section_2,
3575 dir,
3576 nb_diam_slice,
3578 ref_ijk_ft_->milieu_ijk().get_direction_gravite(),
3579 diameter_approx);
3580 DoubleTab slice_values(n_cross_section_1, n_cross_section_2);
3581 DoubleTab slice_velocity_values(n_cross_section_1, n_cross_section_2);
3582 FixedVector<IntTab, 2> ij_indices;
3583 for (int l=0; l<2; l++)
3584 ij_indices[l] = IntTab(n_cross_section_1, n_cross_section_2);
3585 FixedVector<DoubleTab, 3> ij_coords;
3586 for (int c=0; c<3; c++)
3587 ij_coords[c] = DoubleTab(n_cross_section_1, n_cross_section_2);
3588
3590 index_dir_local,
3591 dir,
3592 slice_pos,
3593 ij_indices,
3594 ij_coords,
3595 slice_values,
3596 local_quantities_thermal_slices_time_index_folder);
3598 index_dir_local,
3599 dir,
3600 slice_pos,
3601 ij_indices,
3602 ij_coords,
3603 slice_values,
3604 local_quantities_thermal_slices_time_index_folder);
3605 DoubleTab temperature_slice = slice_values;
3606
3608 index_dir_local,
3609 dir,
3610 slice_pos,
3611 ij_indices,
3612 ij_coords,
3613 slice_values,
3614 local_quantities_thermal_slices_time_index_folder);
3615 DoubleTab velocity_slice = slice_values;
3616
3618 index_dir_local,
3619 dir,
3620 slice_pos,
3621 ij_indices,
3622 ij_coords,
3623 slice_values,
3624 slice_velocity_values,
3625 local_quantities_thermal_slices_time_index_folder);
3626 DoubleTab convection_slice = slice_values;
3627
3629 index_dir_local,
3630 dir,
3631 slice_pos,
3632 ij_indices,
3633 ij_coords,
3634 slice_values,
3635 local_quantities_thermal_slices_time_index_folder);
3636 DoubleTab diffusion_slice = slice_values;
3637
3639 index_dir_local,
3640 dir,
3641 slice_pos,
3642 ij_indices,
3643 ij_coords,
3644 slice_values,
3645 local_quantities_thermal_slices_time_index_folder);
3646 DoubleTab temperature_incr_slice = slice_values;
3647
3649 local_quantities_thermal_slices_time_index_folder,
3650 diameter_approx,
3651 nb_diam_slice,
3652 n_cross_section_1,
3653 n_cross_section_2,
3654 ij_indices,
3655 ij_coords,
3656 temperature_slice,
3657 velocity_slice,
3658 convection_slice,
3659 diffusion_slice,
3660 temperature_incr_slice);
3661}
3662
3664 int& index_dir_global,
3665 int& n_cross_section_1,
3666 int& n_cross_section_2,
3667 int& dir,
3668 const double& nb_diam,
3669 int upstream_dir,
3670 int gravity_dir,
3671 double& diameter)
3672{
3673 if (upstream_dir == -1)
3674 {
3675 dir = gravity_dir;
3676 if (dir == -1)
3677 dir=0;
3678 }
3679 else
3680 dir = upstream_dir;
3681 const Domaine_IJK& geom = temperature_->get_domaine();
3682
3683 const int nb_i_layer_tot = geom.get_nb_elem_tot(0);
3684 const int nb_j_layer_tot = geom.get_nb_elem_tot(1);
3685 const int nb_k_layer_tot = geom.get_nb_elem_tot(2);
3686
3687 int ndir;
3688 switch(dir)
3689 {
3690 case 0:
3691 n_cross_section_1 = nb_j_layer_tot;
3692 n_cross_section_2 = nb_k_layer_tot;
3693 ndir = temperature_->ni();
3694 break;
3695 case 1:
3696 n_cross_section_1 = nb_k_layer_tot;
3697 n_cross_section_2 = nb_i_layer_tot;
3698 ndir = temperature_->nj();
3699 break;
3700 case 2:
3701 n_cross_section_1 = nb_i_layer_tot;
3702 n_cross_section_2 = nb_j_layer_tot;
3703 ndir = temperature_->nk();
3704 break;
3705 default:
3706 n_cross_section_1 = nb_i_layer_tot;
3707 n_cross_section_2 = nb_j_layer_tot;
3708 ndir = temperature_->nk();
3709 break;
3710 }
3711 // thermal_slice.allocate(n_cross_section_1, n_cross_section_2, 1, 0);
3712
3713 bool perio = geom.get_periodic_flag(dir);
3714 assert(ref_ijk_ft_->get_interface().get_nb_bulles_reelles() == 1);
3715 DoubleTab bounding_box;
3716 bounding_box = ref_ijk_ft_->get_interface().get_ijk_compo_connex().get_bounding_box();
3717 const double Dbdir = bounding_box(0, dir, 1) - bounding_box(0, dir, 0);
3718 const double dirb = (*bubbles_barycentre_)(0, dir);
3719 const double ldir = geom.get_domain_length(dir) ;
3720 double nb_diam_tmp = nb_diam;
3721 if (nb_diam_tmp == 0.)
3722 nb_diam_tmp = (ldir / Dbdir) / 2;
3723 else
3724 nb_diam_tmp = signbit(nb_diam_tmp) ? nb_diam_tmp - 0.5: nb_diam_tmp + 0.5;
3725 double dirobj = dirb + nb_diam_tmp * Dbdir;
3726
3727 const double ddir = geom.get_constant_delta(dir);
3728 const double origin_dir = geom.get_origin(dir) ;
3729 const int offset_dir = geom.get_offset_local(dir);
3730
3731 if (perio)
3732 {
3733 while (dirobj < origin_dir)
3734 dirobj += ldir;
3735 while (dirobj > origin_dir + ldir)
3736 dirobj -= ldir;
3737 }
3738 assert(((dirobj >= origin_dir) && (dirobj <= origin_dir + ldir)));
3739
3740 const double x2 = (dirobj - origin_dir) / ddir;
3741 int index_dir = (int) (floor(x2)) - offset_dir;
3742 if ((index_dir >= 0) && (index_dir < ndir))
3743 {
3744 index_dir_local = index_dir;
3745 index_dir_global = index_dir + offset_dir;
3746 }
3747
3748 diameter = 0.;
3749 for (int c=0; c<3; c++)
3750 diameter += bounding_box(0, c, 1) - bounding_box(0, c, 0);
3751 diameter *= (1. / 3.);
3752
3753 return dirobj;
3754}
3755
3757 const int& dir,
3758 const double& slice_pos,
3759 FixedVector<IntTab, 2>& ij_indices,
3760 FixedVector<DoubleTab, 3>& ij_coords,
3761 const IJK_Field_double& field,
3762 const IJK_Field_vector3_double& field_gradient,
3763 const IJK_Field_vector3_double& velocity,
3764 DoubleTab& values,
3765 const int field_type,
3766 const int slice_to_nearest_plane,
3767 const int compute_indices)
3768{
3769 values *= 0.;
3770 if (index_dir_local != -1)
3771 {
3772 const Domaine_IJK& splitting = field.get_domaine();
3773 int offset_cross_dir_1, offset_cross_dir_2;
3774 int n_local_cross_section_1, n_local_cross_section_2;
3775 int * index_i = nullptr;
3776 int * index_j = nullptr;
3777 int * index_k = nullptr;
3778 int incr_i = 0;
3779 int incr_j = 0;
3780 int incr_k = 0;
3781 int i, j;
3782 switch(dir)
3783 {
3784 case 0:
3785 n_local_cross_section_1 = field.nj();
3786 n_local_cross_section_2 = field.nk();
3787 offset_cross_dir_1 = splitting.get_offset_local(1);
3788 offset_cross_dir_2 = splitting.get_offset_local(2);
3789 index_i = &index_dir_local;
3790 index_j = &i;
3791 index_k = &j;
3792 incr_i = 1;
3793 incr_j = 0;
3794 incr_k = 0;
3795 break;
3796 case 1:
3797 n_local_cross_section_1 = field.nk();
3798 n_local_cross_section_2 = field.ni();
3799 offset_cross_dir_1 = splitting.get_offset_local(2);
3800 offset_cross_dir_2 = splitting.get_offset_local(0);
3801 index_i = &j;
3802 index_j = &index_dir_local;
3803 index_k = &i;
3804 incr_i = 0;
3805 incr_j = 1;
3806 incr_k = 0;
3807 break;
3808 case 2:
3809 n_local_cross_section_1 = field.ni();
3810 n_local_cross_section_2 = field.nj();
3811 offset_cross_dir_1 = splitting.get_offset_local(0);
3812 offset_cross_dir_2 = splitting.get_offset_local(1);
3813 index_i = &i;
3814 index_j = &j;
3815 index_k = &index_dir_local;
3816 incr_i = 0;
3817 incr_j = 0;
3818 incr_k = 1;
3819 break;
3820 default:
3821 n_local_cross_section_1 = field.ni();
3822 n_local_cross_section_2 = field.nj();
3823 offset_cross_dir_1 = splitting.get_offset_local(0);
3824 offset_cross_dir_2 = splitting.get_offset_local(1);
3825 index_i = &i;
3826 index_j = &j;
3827 index_k = &index_dir_local;
3828 incr_i = 0;
3829 incr_j = 0;
3830 incr_k = 1;
3831 break;
3832 }
3833
3834 if (compute_indices)
3835 {
3836 for (i=0; i<n_local_cross_section_1; i++)
3837 for (j=0; j<n_local_cross_section_2; j++)
3838 {
3839 Vecteur3 ij_coord = ref_ijk_ft_->get_domaine().get_coords_of_dof(*index_i, *index_j, *index_k, Domaine_IJK::ELEM);
3840 ij_indices[0](i+offset_cross_dir_1, j+offset_cross_dir_2) = i+offset_cross_dir_1;
3841 ij_indices[1](i+offset_cross_dir_1, j+offset_cross_dir_2) = j+offset_cross_dir_2;
3842 switch(dir)
3843 {
3844 case 0:
3845 ij_coords[0](i+offset_cross_dir_1, j+offset_cross_dir_2) = slice_pos;
3846 ij_coords[1](i+offset_cross_dir_1, j+offset_cross_dir_2) = ij_coord[1];
3847 ij_coords[2](i+offset_cross_dir_1, j+offset_cross_dir_2) = ij_coord[2];
3848 break;
3849 case 1:
3850 ij_coords[0](i+offset_cross_dir_1, j+offset_cross_dir_2) = ij_coord[0];
3851 ij_coords[1](i+offset_cross_dir_1, j+offset_cross_dir_2) = slice_pos;
3852 ij_coords[2](i+offset_cross_dir_1, j+offset_cross_dir_2) = ij_coord[2];
3853 break;
3854 case 2:
3855 ij_coords[0](i+offset_cross_dir_1, j+offset_cross_dir_2) = ij_coord[0];
3856 ij_coords[1](i+offset_cross_dir_1, j+offset_cross_dir_2) = ij_coord[1];
3857 ij_coords[2](i+offset_cross_dir_1, j+offset_cross_dir_2) = slice_pos;
3858 break;
3859 default:
3860 break;
3861 }
3862 }
3863 }
3864 else
3865 {
3866 if (slice_to_nearest_plane)
3867 {
3868 switch(field_type)
3869 {
3870 case 0:
3871 for (i=0; i<n_local_cross_section_1; i++)
3872 for (j=0; j<n_local_cross_section_2; j++)
3873 values(i+offset_cross_dir_1, j+offset_cross_dir_2) = field(*index_i, *index_j, *index_k);
3874 break;
3875 case 1:
3876 for (i=0; i<n_local_cross_section_1; i++)
3877 for (j=0; j<n_local_cross_section_2; j++)
3878 values(i+offset_cross_dir_1, j+offset_cross_dir_2) = field_gradient[dir](*index_i, *index_j, *index_k);
3879 break;
3880 case 2:
3881 for (i=0; i<n_local_cross_section_1; i++)
3882 for (j=0; j<n_local_cross_section_2; j++)
3883 {
3884 /*
3885 * Works only for constant geom discretisation
3886 */
3887 values(i + offset_cross_dir_1, j + offset_cross_dir_2) = (velocity[dir](*index_i, *index_j, *index_k) +
3888 velocity[dir](*index_i+incr_i, *index_j+incr_j, *index_k+incr_k)) * 0.5;
3889 }
3890 break;
3891 default:
3892 break;
3893 }
3894 }
3895 else
3896 {
3897 const int nb_val = (int) n_local_cross_section_1 * n_local_cross_section_2;
3898 DoubleTab ij_coords_interp = values;
3899 DoubleVect field_interp(nb_val);
3900 ij_coords_interp.resize(nb_val,3);
3901 int counter = 0;
3902 for (i=0; i<n_local_cross_section_1; i++)
3903 for (j=0; j<n_local_cross_section_2; j++)
3904 {
3905 Vecteur3 ij_coord = ref_ijk_ft_->get_domaine().get_coords_of_dof(*index_i, *index_j, *index_k, Domaine_IJK::ELEM);
3906 switch(dir)
3907 {
3908 case 0:
3909 ij_coords_interp(counter, 0) = slice_pos;
3910 ij_coords_interp(counter, 1) = ij_coord[1];
3911 ij_coords_interp(counter, 2) = ij_coord[2];
3912 break;
3913 case 1:
3914 ij_coords_interp(counter, 0) = ij_coord[0];
3915 ij_coords_interp(counter, 1) = slice_pos;
3916 ij_coords_interp(counter, 2) = ij_coord[2];
3917 break;
3918 case 2:
3919 ij_coords_interp(counter, 0) = ij_coord[0];
3920 ij_coords_interp(counter, 1) = ij_coord[1];
3921 ij_coords_interp(counter, 2) = slice_pos;
3922 break;
3923 default:
3924 break;
3925 }
3926 counter++;
3927 }
3928 switch(field_type)
3929 {
3930 case 0:
3931 ijk_interpolate_skip_unknown_points(field, ij_coords_interp, field_interp, INVALID_INTERP);
3932 break;
3933 case 1:
3934 ijk_interpolate_skip_unknown_points(field_gradient[dir], ij_coords_interp, field_interp, INVALID_INTERP);
3935 break;
3936 case 2:
3937 ijk_interpolate_skip_unknown_points(velocity[dir], ij_coords_interp, field_interp, INVALID_INTERP);
3938 break;
3939 default:
3940 break;
3941 }
3942 counter = 0;
3943 for (i=0; i<n_local_cross_section_1; i++)
3944 for (j=0; j<n_local_cross_section_2; j++)
3945 {
3946 values(i + offset_cross_dir_1, j + offset_cross_dir_2) = field_interp(counter);
3947 counter++;
3948 }
3949 }
3950 }
3951 }
3952 if (!compute_indices)
3953 mp_sum_for_each_item(values);
3954}
3955
3957 int& index_dir_local,
3958 const int& dir,
3959 const double& slice_pos,
3960 FixedVector<IntTab, 2>& ij_indices,
3961 FixedVector<DoubleTab, 3>& ij_coords,
3962 DoubleTab& values,
3963 const Nom& local_quantities_thermal_slices_time_index_folder)
3964{
3965 for (int l=0; l<2; l++)
3966 ij_indices[l] *= 0;
3967 for (int c=0; c<3; c++)
3968 ij_coords[0] *= 0.;
3969 if (index_dir_local != -1)
3970 {
3972 dir,
3973 slice_pos,
3974 ij_indices,
3975 ij_coords,
3976 *temperature_,
3978 ref_ijk_ft_->eq_ns().get_velocity(),
3979 values,
3980 -1,
3982 1);
3983 }
3984 for (int l=0; l<2; l++)
3985 mp_sum_for_each_item(ij_indices[l]);
3986 for (int c=0; c<3; c++)
3987 mp_sum_for_each_item(ij_coords[c]);
3988}
3989
3991 int& index_dir_local,
3992 const int& dir,
3993 const double& slice_pos,
3994 FixedVector<IntTab, 2>& ij_indices,
3995 FixedVector<DoubleTab, 3>& ij_coords,
3996 DoubleTab& values,
3997 const Nom& local_quantities_thermal_slices_time_index_folder)
3998{
4000 dir,
4001 slice_pos,
4002 ij_indices,
4003 ij_coords,
4004 *temperature_,
4006 ref_ijk_ft_->eq_ns().get_velocity(),
4007 values,
4008 0,
4010}
4011
4013 int& index_dir_local,
4014 const int& dir,
4015 const double& slice_pos,
4016 FixedVector<IntTab, 2>& ij_indices,
4017 FixedVector<DoubleTab, 3>& ij_coords,
4018 DoubleTab& velocity_values,
4019 const Nom& local_quantities_thermal_slices_time_index_folder)
4020{
4022 dir,
4023 slice_pos,
4024 ij_indices,
4025 ij_coords,
4026 *temperature_,
4028 ref_ijk_ft_->eq_ns().get_velocity(),
4029 velocity_values,
4030 2,
4032}
4033
4035 int& index_dir_local,
4036 const int& dir,
4037 const double& slice_pos,
4038 FixedVector<IntTab, 2>& ij_indices,
4039 FixedVector<DoubleTab, 3>& ij_coords,
4040 DoubleTab& values,
4041 DoubleTab& velocity_values,
4042 const Nom& local_quantities_thermal_slices_time_index_folder)
4043{
4045 dir,
4046 slice_pos,
4047 ij_indices,
4048 ij_coords,
4049 *temperature_,
4051 ref_ijk_ft_->eq_ns().get_velocity(),
4052 values,
4053 0,
4056 values += (-delta_T_subcooled_overheated_);
4058 dir,
4059 slice_pos,
4060 ij_indices,
4061 ij_coords,
4062 *temperature_,
4064 ref_ijk_ft_->eq_ns().get_velocity(),
4065 velocity_values,
4066 2,
4068 DoubleTab velocity_values_frame_of_ref = velocity_values;
4069 // Be careful with Leibniz rules !!!!!!!!!!
4070 // if (upstream_temperature_ > -1e20 && ref_ijk_ft_->get_vitesse_upstream() > -1e20)
4071 // velocity_values_frame_of_ref += (*rising_velocity_overall_)[dir];
4072 // else
4073 if (debug_)
4074 {
4075 Cerr << "Rising velocity on slices" << (*rising_velocity_overall_)[dir] << finl;
4076 Cerr << "Rising velocity magnitude" << (*rising_velocities_)(0) << finl;
4077 Cerr << "Rising vector sign" << (*rising_vectors_)(0, dir) << finl;
4078 }
4079 velocity_values_frame_of_ref -= (*rising_velocity_overall_)[dir];
4080 values *= velocity_values_frame_of_ref;
4081 values *= (ref_ijk_ft_->milieu_ijk().get_rho_liquid() * cp_liquid_);
4082}
4083
4085 int& index_dir_local,
4086 const int& dir,
4087 const double& slice_pos,
4088 FixedVector<IntTab, 2>& ij_indices,
4089 FixedVector<DoubleTab, 3>& ij_coords,
4090 DoubleTab& values,
4091 const Nom& local_quantities_thermal_slices_time_index_folder)
4092{
4094 dir,
4095 slice_pos,
4096 ij_indices,
4097 ij_coords,
4098 *temperature_,
4100 ref_ijk_ft_->eq_ns().get_velocity(),
4101 values,
4102 1,
4104 // values *= uniform_alpha_;
4105 values *= uniform_lambda_;
4106}
4107
4109 int& index_dir_local,
4110 const int& dir,
4111 const double& slice_pos,
4112 FixedVector<IntTab, 2>& ij_indices,
4113 FixedVector<DoubleTab, 3>& ij_coords,
4114 DoubleTab& values,
4115 const Nom& local_quantities_thermal_slices_time_index_folder)
4116{
4118 dir,
4119 slice_pos,
4120 ij_indices,
4121 ij_coords,
4124 ref_ijk_ft_->eq_ns().get_velocity(),
4125 values,
4126 0,
4128 // values *= (1 / ref_ijk_ft_->schema_temps_ijk().get_timestep());
4129 // values *= ref_ijk_ft_->schema_temps_ijk().get_timestep();
4130}
4131
4133 const Nom& local_quantities_thermal_slices_time_index_folder,
4134 const double& diameter_approx,
4135 const double& nb_diam_slice,
4136 const int& n_cross_section_1,
4137 const int& n_cross_section_2,
4138 const FixedVector<IntTab, 2> ij_indices,
4139 const FixedVector<DoubleTab, 3>& ij_coords,
4140 const DoubleTab& temperature_slice,
4141 const DoubleTab& velocity_slice,
4142 const DoubleTab& convection_slice,
4143 const DoubleTab& diffusion_slice,
4144 const DoubleTab& temperature_incr_slice)
4145{
4147 {
4148 Cerr << "Post-processing on the slices - INI" << finl;
4149 const int reset = 1;
4150 const double last_time = ref_ijk_ft_->schema_temps_ijk().get_current_time() - ref_ijk_ft_->schema_temps_ijk().get_timestep();
4151 const int last_time_index = ref_ijk_ft_->schema_temps_ijk().get_tstep() + latastep_reprise_ini_;
4152 const int max_digit = 3;
4153 const int max_digit_time = 8;
4154 const int max_rank_digit = rank_ < 1 ? 1 : (int) (log10(rank_) + 1);
4155 const int nb_digit_tstep = last_time_index < 1 ? 1 : (int) (log10(last_time_index) + 1);
4156 const int nb_digit_index_slice = slice < 1 ? 1 : (int) (log10(slice) + 1);
4157 Nom slice_name = Nom("_thermal_rank_") + Nom(std::string(max_digit - max_rank_digit, '0')) + Nom(rank_) +
4158 Nom("_slice_index_") + Nom(std::string(max_digit - nb_digit_index_slice, '0')) + Nom(slice)
4159 + Nom("_local_quantities_thermal_slices_time_index_")
4160 + Nom(std::string(max_digit_time - nb_digit_tstep, '0')) + Nom(last_time_index) + Nom(".out");
4161 Nom slice_header = Nom("tstep\tthermal_rank\tpost_pro_index\tlinear_index"
4162 "\ttime\tcharacteristic_time\ttime_dimensionless"
4163 "\tnb_diam_slice\tindex_i\tindex_j\tx_coord\ty_coord\tz_coord"
4164 "\ttemperature\tvelocity"
4165 "\tconvective_term\tdiffusive_term"
4166 "\ttemperature_incr");
4167 SFichier fic = Open_file_folder(local_quantities_thermal_slices_time_index_folder, slice_name, slice_header, reset);
4168 const int nb_elem = n_cross_section_1 * n_cross_section_2;
4169 if (debug_)
4170 Cerr << "Number of elements per slice" << nb_elem << finl;
4171 const double gravite_norm = ref_ijk_ft_->milieu_ijk().get_gravite_norm();
4172 const double characteristic_time = (gravite_norm > 1e-6) ? last_time / sqrt(diameter_approx * gravite_norm) : last_time;
4173 const double rho_l = ref_ijk_ft_->milieu_ijk().get_rho_liquid();
4174 const double rho_v = ref_ijk_ft_->milieu_ijk().get_rho_vapour();
4175 const double archimedes_time = sqrt(gravite_norm * (rho_l - rho_v) / (diameter_approx * rho_l));
4176 const double dimensionless_time = (archimedes_time > 1e-6) ? last_time / archimedes_time : last_time;
4177 int counter = 0;
4178 for (int i=0; i<n_cross_section_1; i++)
4179 for (int j=0; j<n_cross_section_2; j++)
4180 {
4181 fic << last_time_index << " ";
4182 fic << rank_ << " " << slice << " " << counter << " ";
4183 fic << last_time << " ";
4184 fic << characteristic_time << " ";
4185 fic << dimensionless_time << " ";
4186 fic << nb_diam_slice << " ";
4187 fic << ij_indices[0](i,j) << " ";
4188 fic << ij_indices[1](i,j) << " ";
4189 fic << ij_coords[0](i,j) << " ";
4190 fic << ij_coords[1](i,j) << " ";
4191 fic << ij_coords[2](i,j) << " ";
4192 fic << temperature_slice(i,j) << " ";
4193 fic << velocity_slice(i,j) << " ";
4194 fic << convection_slice(i,j) << " ";
4195 fic << diffusion_slice(i,j) << " ";
4196 fic << temperature_incr_slice(i,j) << " ";
4197 fic << finl;
4198 counter++;
4199 }
4200 assert(counter == nb_elem);
4201 fic.close();
4202 Cerr << "Post-processing on the slices - END" << finl;
4203 }
4204}
4205
4207{
4209 thermal_local_subproblems_interfaces_fields_.set_subproblems_interfaces_fields(2);
4210 else
4211 thermal_local_subproblems_interfaces_fields_.set_subproblems_interfaces_fields(1);
4214 debug_);
4215}
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.
bool get_periodic_flag(int direction) const
Method returns true if periodic in this direction.
double get_domain_length(int direction) const
Returns the length of the entire domain in requested direction.
double get_constant_delta(int direction) const
Returns the size of cells in a direction.
double get_origin(int direction) const
Returns the coordinate of the first node (global) of the mesh in the requested 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
void echange_espace_virtuel(int ghost)
Exchange data over "ghost" number of cells.
const Domaine_IJK & get_domaine() const
Nom generate_expression_temperature_ini(const double &time_scope, const double x, const double y, const double z)
double compute_spherical_steady_dirichlet_left_right_value(const double &r)
IJK_Field_vector3_double cell_faces_corrected_convective_
void complete_field_thermal_wake_slice_ij_convection(const int &slice, int &index_dir_local, const int &dir, const double &slice_pos, FixedVector< IntTab, 2 > &ij_indices, FixedVector< DoubleTab, 3 > &ij_coords, DoubleTab &values, DoubleTab &velocity_values, const Nom &local_quantities_thermal_slices_time_index_folder)
void compute_second_order_operator(Matrice &radial_second_order_operator, double dr)
void interpolate_temperature_on_downstream_line(const int &dir, const int &nb_thermal_circles, const int &index_circle, const int &index_line, const std::vector< std::vector< ArrOfInt > > &is_point_on_proc, const FixedVector< ArrOfDouble, 3 > &coordinates_line, const std::vector< std::vector< FixedVector< ArrOfDouble, 2 > > > &coordinates_sides, DoubleVect &values)
IJK_Field_double temperature_cell_neighbours_debug_
void initialise_thermal_line_points(const int &line_dir, ArrOfDouble &linear_coord, FixedVector< ArrOfDouble, 3 > &coordinates_line, double &diameter)
IJK_Field_vector3_double interfacial_heat_flux_contrib_
void compute_first_order_operator_raw(Matrice &radial_first_order_operator)
void compute_first_order_operator(Matrice &radial_first_order_operator, double dr)
double post_process_thermal_wake_slice_index_dir(int &index_dir_local, int &index_dir_global, int &n_cross_section_1, int &n_cross_section_2, int &dir, const double &nb_diam, int upstream_dir, int gravity_dir, double &diameter)
int lire_motcle_non_standard(const Motcle &, Entree &) override
Lecture des parametres de type non simple d'un objet_U a partir d'un flot d'entree.
IJK_Field_vector3_double cell_faces_neighbours_corrected_diffusive_
IJK_Field_int neighbours_temperature_to_correct_trimmed_
IJK_Field_vector3_double interfacial_heat_flux_current_
void complete_field_thermal_wake_slice_ij_diffusion(const int &slice, int &index_dir_local, const int &dir, const double &slice_pos, FixedVector< IntTab, 2 > &ij_indices, FixedVector< DoubleTab, 3 > &ij_coords, DoubleTab &values, const Nom &local_quantities_thermal_slices_time_index_folder)
IJK_Field_vector3_int cell_faces_neighbours_corrected_min_max_bool_
void set_field_temperature_per_bubble(const int index_bubble)
void enforce_periodic_temperature_boundary_value() override
void evaluate_total_liquid_parameter_squared(const IJK_Field_double &field, double &total_parameter)
void compute_second_order_operator_raw(Matrice &radial_second_order_operator)
void compute_temperature_cell_centres(const int first_corr) override
IJK_Field_vector3_double neighbours_faces_weighting_colinearity_
IJK_SolveSys_FD_thermal one_dimensional_advection_diffusion_thermal_solver_implicit_
void interpolate_convective_term_on_downstream_line(const int &dir, const int &nb_thermal_circles, const int &index_circle, const int &index_line, const std::vector< std::vector< ArrOfInt > > &is_point_on_proc, const FixedVector< ArrOfDouble, 3 > &coordinates_line, const std::vector< std::vector< FixedVector< ArrOfDouble, 2 > > > &coordinates_sides, DoubleVect &values)
void initialize(const Domaine_IJK &splitting) override
void complete_field_thermal_wake_slice_ij_values(int &index_dir_local, const int &dir, const double &slice_pos, FixedVector< IntTab, 2 > &ij_indices, FixedVector< DoubleTab, 3 > &ij_coords, const IJK_Field_double &field, const IJK_Field_vector3_double &field_gradient, const IJK_Field_vector3_double &velocity, DoubleTab &values, const int field_type, const int slice_to_nearest_plane, const int compute_indices=0)
FixedVector< ArrOfInt, 6 > first_indices_sparse_matrix_
void find_points_on_proc(std::vector< std::vector< ArrOfInt > > &is_point_on_proc, std::vector< std::vector< FixedVector< ArrOfInt, 3 > > > &ijk_indices, const FixedVector< ArrOfDouble, 3 > &coordinates_line, const std::vector< std::vector< FixedVector< ArrOfDouble, 2 > > > &coordinates_sides, const int &line_dir)
void post_process_thermal_downstream_lines(const Nom &local_quantities_thermal_lines_time_index_folder) override
void initialise_identity_matrices(Matrice &identity_matrix, Matrice &identity_matrix_subproblems)
void compute_convective_diffusive_fluxes_face_centre() override
IJK_Field_double neighbours_temperature_colinearity_weighting_
void min_max_ldir(const int &dir, const Domaine_IJK &geom, double &min_dir, double &max_dir)
IJK_Finite_Difference_One_Dimensional_Matrix_Assembler finite_difference_assembler_
void compare_temperature_fields(const IJK_Field_double &temperature, const IJK_Field_double &temperature_ana, IJK_Field_double &error_temperature_ana, IJK_Field_double &error_temperature_ana_rel)
void set_param(Param &param) const override
IJK_Field_vector3_double cell_faces_corrected_diffusive_
IJK_Field_vector3_double cell_faces_neighbours_corrected_convective_frame_of_reference_
IJK_Field_vector3_int cell_faces_neighbours_corrected_all_bool_
void initialise_radial_diffusion_operator(Matrice &radial_second_order_operator, Matrice &radial_diffusion_matrix)
IJK_Field_vector3_double cell_faces_neighbours_corrected_convective_
void post_processed_fields_on_downstream_line(const Nom &local_quantities_thermal_lines_time_index_folder, const int &line_dir, const int &linear_circle_line_index, const int &index_circle, const int &index_line, const double &diameter_approx, std::vector< std::vector< ArrOfInt > > &is_point_on_proc, const std::vector< std::vector< FixedVector< ArrOfInt, 3 > > > &indices_ijk, const ArrOfDouble &linear_coord, const FixedVector< ArrOfDouble, 3 > &coordinates_line, const std::vector< std::vector< FixedVector< ArrOfDouble, 2 > > > &coordinates_sides, const DoubleVect &temperature_line, const DoubleVect &velocity_line, const DoubleVect &convective_term_line, const DoubleVect &diffusive_term_line, const DoubleVect &temperature_incr_line)
double find_time_dichotomy_derivative(const double &temperature_derivative, double &temperature_limit_left, double &temperature_limit_right)
IJK_Field_vector3_int cell_faces_corrected_bool_
void set_subproblems_interfaces_fields(const Domaine_IJK &splitting) override
void initialise_radial_diffusion_operator_sparse(Matrice &radial_second_order_operator, Matrice &radial_diffusion_matrix)
void post_process_thermal_wake_slices(const Nom &local_quantities_thermal_slices_time_index_folder) override
void interpolate_velocity_on_downstream_line(const int &dir, const int &nb_thermal_circles, const int &index_circle, const int &index_line, const std::vector< std::vector< ArrOfInt > > &is_point_on_proc, const FixedVector< ArrOfDouble, 3 > &coordinates_line, const std::vector< std::vector< FixedVector< ArrOfDouble, 2 > > > &coordinates_sides, DoubleVect &values)
IJK_Field_vector3_double interfacial_heat_flux_dispatched_
IJK_Field_vector3_int cell_faces_neighbours_corrected_diag_bool_
double get_time_inflection_derivative(double &temperature_end_min)
void initialise_radial_convection_operator_sparse(Matrice &radial_first_order_operator, Matrice &radial_convection_matrix)
void approx_erf_inverse(const double &x, double &res)
void initialise_radial_convection_operator(Matrice &radial_first_order_operator, Matrice &radial_convection_matrix)
void initialise_thermal_dowstreamlines_tabs(std::vector< std::vector< FixedVector< ArrOfInt, 3 > > > &parameters, const int &nb_thermal_circles, const int &nb_thermal_lines)
void complete_field_thermal_wake_slice_ij_indices_coords(const int &slice, int &index_dir_local, const int &dir, const double &slice_pos, FixedVector< IntTab, 2 > &ij_indices, FixedVector< DoubleTab, 3 > &ij_coords, DoubleTab &values, const Nom &local_quantities_thermal_slices_time_index_folder)
Nom compute_quasi_static_spherical_diffusion_expression(const double &time_scope, const int index_bubble, const int index_bubble_real)
void interpolate_diffusive_term_on_downstream_line(const int &dir, const int &nb_thermal_circles, const int &index_circle, const int &index_line, const std::vector< std::vector< ArrOfInt > > &is_point_on_proc, const FixedVector< ArrOfDouble, 3 > &coordinates_line, const std::vector< std::vector< FixedVector< ArrOfDouble, 2 > > > &coordinates_sides, DoubleVect &values)
void compute_radial_first_second_order_operators(Matrice &radial_first_order_operator_raw, Matrice &radial_second_order_operator_raw, Matrice &radial_first_order_operator, Matrice &radial_second_order_operator)
void initialise_identity_matrices_sparse(Matrice &identity_matrix, Matrice &identity_matrix_subproblems)
double compute_spherical_steady_dirichlet_left_right_integral(const double &temperature_end_prev)
void complete_field_thermal_wake_slice_ij_velocity(const int &slice, int &index_dir_local, const int &dir, const double &slice_pos, FixedVector< IntTab, 2 > &ij_indices, FixedVector< DoubleTab, 3 > &ij_coords, DoubleTab &velocity_values, const Nom &local_quantities_thermal_slices_time_index_folder)
void post_process_thermal_wake_slice(const int &slice, const double &nb_diam_slice, const Nom &local_quantities_thermal_slices_time_index_folder)
void replace_temperature_cell_centres_neighbours(const int &use_neighbours_temperature_to_correct_trimmed)
void compute_ghost_cell_numbers_for_subproblems(const Domaine_IJK &splitting, int ghost_init) override
void correct_temperature_increment_for_interface_leaving_cell() override
double compute_spherical_steady_dirichlet_left_right_derivative_value(const double &r, const double &temperature_prev)
void set_thermal_subresolution_outputs(const Nom &interfacial_quantities_thermal_probes, const Nom &shell_quantities_thermal_probes, const Nom &overall_bubbles_quantities, const Nom &local_quantities_thermal_probes_time_index_folder) override
double find_time_dichotomy_integral(const double &temperature_integral, double &temperature_end_prev)
void find_cocentric_line_coordinates(const int &nb_thermal_circles, const int &nb_thermal_lines, const double &diameter_approx, std::vector< std::vector< FixedVector< ArrOfDouble, 2 > > > &coordinates_sides)
void evaluate_total_liquid_absolute_parameter(const IJK_Field_double &field, double &total_parameter)
void correct_any_temperature_fields_for_eulerian_fluxes(IJK_Field_double &temperature)
IJK_Field_vector3_double cell_faces_neighbours_corrected_velocity_temperature_
void complete_field_thermal_wake_slice_ij_temperature_incr(const int &slice, int &index_dir_local, const int &dir, const double &slice_pos, FixedVector< IntTab, 2 > &ij_indices, FixedVector< DoubleTab, 3 > &ij_coords, DoubleTab &values, const Nom &local_quantities_thermal_slices_time_index_folder)
void complete_thermal_fluxes_face_centre(const int &fluxes_correction_conservations)
void correct_any_temperature_field_for_visu(IJK_Field_double &temperature)
IJK_One_Dimensional_Subproblems thermal_local_subproblems_
FixedVector< ArrOfInt, 4 > ijk_indices_flux_contrib_
void interpolate_fields_on_downstream_line(const int &dir, const int &nb_thermal_circles, const int &index_circle, const int &index_line, const std::vector< std::vector< ArrOfInt > > &is_point_on_proc, const FixedVector< ArrOfDouble, 3 > &coordinates_line, const std::vector< std::vector< FixedVector< ArrOfDouble, 2 > > > &coordinates_sides, const IJK_Field_double &field, const IJK_Field_vector3_double &field_gradient, const IJK_Field_vector3_double &velocity, DoubleVect &values, const int field_type)
void complete_field_thermal_wake_slice_ij_temperature(const int &slice, int &index_dir_local, const int &dir, const double &slice_pos, FixedVector< IntTab, 2 > &ij_indices, FixedVector< DoubleTab, 3 > &ij_coords, DoubleTab &values, const Nom &local_quantities_thermal_slices_time_index_folder)
void interpolate_temperature_increment_on_downstream_line(const int &dir, const int &nb_thermal_circles, const int &index_circle, const int &index_line, const std::vector< std::vector< ArrOfInt > > &is_point_on_proc, const FixedVector< ArrOfDouble, 3 > &coordinates_line, const std::vector< std::vector< FixedVector< ArrOfDouble, 2 > > > &coordinates_sides, DoubleVect &values)
IJK_SolveSys_FD_thermal one_dimensional_advection_diffusion_thermal_solver_
void post_processed_field_thermal_wake_slice_ij(const int &slice, const Nom &local_quantities_thermal_slices_time_index_folder, const double &diameter_approx, const double &nb_diam_slice, const int &n_cross_section_1, const int &n_cross_section_2, const FixedVector< IntTab, 2 > ij_indices, const FixedVector< DoubleTab, 3 > &ij_coords, const DoubleTab &temperature_slice, const DoubleTab &velocity_slice, const DoubleTab &convection_slice, const DoubleTab &diffusion_slice, const DoubleTab &temperature_incr_slice)
IJK_Field_vector3_double div_coeff_grad_T_raw_
OpHessFluxCentre2IJKScalar_double temperature_hess_flux_op_centre_
bool store_flux_operators_for_energy_balance_
std::shared_ptr< IJK_Field_double > div_coeff_grad_T_volume_
Operateur_IJK_elem_conv temperature_convection_op_
IJK_Field_double u_T_convective_volume_
virtual void compute_temperature_init()
Operateur_IJK_elem_diff temperature_diffusion_op_
virtual void update_thermal_properties()
IJK_Field_double u_T_convective_
Motcles liste_post_instantanes_
IJK_Field_double temperature_ana_
virtual void initialize(const Domaine_IJK &splitting)
const IJK_Field_vector3_double * eulerian_normal_vectors_ns_normed_
IJK_Field_vector3_double grad_T_elem_
virtual void set_param(Param &param) const override
IJK_Field_double temperature_before_extrapolation_
IJK_One_Dimensional_Subproblems_Interfaces_Fields thermal_local_subproblems_interfaces_fields_
IJK_Field_double div_coeff_grad_T_volume_uncorrected_
std::shared_ptr< IJK_Field_double > d_temperature_
virtual void post_process_after_temperature_increment()
IJK_Field_double div_coeff_grad_T_
IJK_Field_double ecart_t_ana_rel_
IJK_Field_double ecart_t_ana_
IJK_Field_double d_temperature_uncorrected_
IJK_Field_vector3_double rho_cp_u_T_convective_raw_
std::shared_ptr< IJK_Field_double > temperature_
IJK_Field_double temperature_for_ini_per_bubble_
void compute_cell_diagonal(const Domaine_IJK &splitting)
C'est le plus simple des descripteurs, utilise pour les tableaux de valeurs aux sommets,...
static void creer_tableau_distribue(const MD_Vector &, Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
transforme v en un tableau parallele ayant la structure md.
void block_to_morse(Matrice_Morse &matrix) const
Classe Matrice_Morse Represente une matrice M (creuse), non necessairement carree.
Classe Matrice Classe generique de la hierarchie des matrices.
Definition Matrice.h:34
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
friend class Entree
Definition Objet_U.h:76
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter_flag(const char *keyword, const bool *value)
Register a boolean flag whose mere presence switches it to true.
Definition Param.cpp:474
void dictionnaire(const char *option_name, int value)
Add an (option name, integer value) entry to the dictionary attached to a previously registered integ...
Definition Param.cpp:293
int lire_sans_accolade(Entree &is)
Read all required keywords in the order they were registered, without enclosing braces.
Definition Param.cpp:41
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
@ REQUIRED
Definition Param.h:115
int lire_avec_accolades_depuis(Entree &is)
Parse the parameter block { ... } from is.
Definition Param.cpp:32
static int check_int_overflow(trustIdType)
Definition Process.cpp:428
static void mp_sum_for_each_item(TRUSTArray< _TYPE_ > &x, int n=-1)
Definition Process.cpp:193
static double mp_sum(double)
Calcule la somme de x sur tous les processeurs du groupe courant.
Definition Process.cpp:146
static int me()
renvoie mon rang dans le groupe de communication courant.
Definition Process.cpp:125
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
Definition Process.cpp:86
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)
_SIZE_ size_array() const
void resize(_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTArray.h:156
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469
void resize(int i)