TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
IJK_One_Dimensional_Subproblems.h
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#ifndef IJK_One_Dimensional_Subproblems_included
17#define IJK_One_Dimensional_Subproblems_included
18
19#include <IJK_One_Dimensional_Subproblem.h>
20#include <IJK_Field_vector.h>
21#include <IJK_Finite_Difference_One_Dimensional_Matrix_Assembler.h>
22#include <TRUSTList.h>
23#include <TRUST_List.h>
24
25
26/////////////////////////////////////////////////////////////////////////////
27//
28// .DESCRIPTION : class IJK_One_Dimensional_Subproblems
29//
30// <Description of class IJK_One_Dimensional_Subproblems>
31//
32/////////////////////////////////////////////////////////////////////////////
33
38
39class IJK_One_Dimensional_Subproblems : public LIST(IJK_One_Dimensional_Subproblem)
40{
41
42 Declare_instanciable(IJK_One_Dimensional_Subproblems);
45
46public :
48 void associer(const Probleme_FTD_IJK_base& ijk_ft) { ref_ijk_ft_ = ijk_ft; };
49 void initialise_thermal_subproblems_list_params(const int& pre_initialise_thermal_subproblems_list,
50 const double& pre_factor_subproblems_number,
51 const int& remove_append_subproblems,
52 const int& use_sparse_matrix);
54 void set_max_subproblems(const int max_subproblems) { max_subproblems_ = max_subproblems; };
55 void clean();
56 void clean(int add, int append);
57 void clean_add();
58 void clean_remove();
59 void clean_append();
62 void add_subproblems(int n);
64 void set_global_index();
66 const int& j,
67 const int& k);
68 void get_ijk_indices_from_subproblems(const int& rank,
69 int& i,
70 int& j,
71 int& k);
72 void associate_ijk_indices_to_subproblem(const int& rank,
73 const int& i,
74 const int& j,
75 const int& k);
77 const int& j,
78 const int& k) const;
79 void associate_sub_problem_to_inputs(IJK_Thermal_Subresolution& ref_thermal_subresolution,
80 int i, int j, int k,
81 const double& indicator,
82 double global_time_step,
83 double current_time,
84 const IJK_Interfaces& interfaces,
85 const IJK_Field_vector3_double& velocity,
86 const IJK_Field_vector3_double& velocity_ft,
87 const IJK_Field_double& pressure);
93 int is_in_map_index_ijk(const std::map<int, std::map<int, std::map<int, int>>>& subproblem_to_ijk_indices,
94 const int& index_i,
95 const int& index_j,
96 const int& index_k);
97 void set_effective_subproblems(const int& enable_probe_collision_detection);
102 void reajust_probes_length(const int probe_length_condition);
103 void compute_modified_probe_length(const int& probe_variations_enabled);
105 void compute_source_terms_impose_boundary_conditions(const int& boundary_condition_interface,
106 const double& interfacial_boundary_condition_value,
107 const int& impose_boundary_condition_interface_from_simulation,
108 const int& boundary_condition_end,
109 const double& end_boundary_condition_value,
110 const int& impose_user_boundary_condition_end_value);
116 void get_subproblem_ijk_indices(int& i, int& j, int& k, int& subproblem_index) const;
117 const int& get_dxyz_increment_bool(const int& subproblem_index) const;
118 const int& get_dxyz_over_two_increment_bool(const int& subproblem_index) const;
119 const FixedVector<int,3>& get_pure_neighbours_corrected_sign(const int& subproblem_index) const;
120 const std::vector<std::vector<std::vector<bool>>>& get_pure_neighbours_to_correct(const int& subproblem_index) const;
121 const std::vector<std::vector<std::vector<double>>>& get_pure_neighbours_corrected_distance(const int& subproblem_index) const;
122 const std::vector<std::vector<std::vector<double>>>& get_pure_neighbours_corrected_colinearity(const int& subproblem_index) const;
123 const std::vector<std::vector<std::vector<std::vector<bool>>>> get_pure_neighbours_last_faces_to_correct(const int& subproblem_index) const;
124 const std::vector<std::vector<std::vector<std::vector<double>>>> get_pure_neighbours_last_faces_corrected_distance(const int& subproblem_index) const;
125 const std::vector<std::vector<std::vector<std::vector<double>>>> get_pure_neighbours_last_faces_corrected_colinearity(const int& subproblem_index) const;
127 double get_temperature_profile_at_point(const int& i, const double& dist) const;
128 const double& get_dist_cell_interface(const int& i) const;
129 const FixedVector<double,6>& get_dist_faces_interface(const int& i) const;
130 const Vecteur3& get_bary_facet(const int& i) const;
131 void set_pure_flux_corrected(const double& flux_face,
132 const int& i,
133 const int& l,
134 const int& flux_type);
135
136 void compute_error_flux_interface(const int& i);
138 void compare_flux_interface(const int& i, std::vector<double>& radial_flux_error);
139
140 double get_corrective_flux_from_neighbours(const int& i, const int& l);
141 double get_corrective_flux_from_current(const int& i, const int& l);
144 const double& dist,
145 const int& dir,
146 bool& valid_val,
147 const int& l,
148 const int& index_i,
149 const int& index_j,
150 const int& index_k,
151 const int& temperature=0) const;
152 DoubleVect get_temperature_profile_discrete_integral_at_point(const int& i, const double& dist, const int& level, const int& dir);
153 DoubleVect get_temperature_times_velocity_profile_discrete_integral_at_point(const int& i, const double& dist, const int& level, const int& dir, const int& l);
154 DoubleVect get_temperature_gradient_profile_discrete_integral_at_point(const int& i, const double& dist, const int& level, const int& dir);
155 DoubleVect get_temperature_gradient_times_conductivity_profile_discrete_integral_at_point(const int& i, const double& dist, const int& level, const int& dir);
156 double get_temperature_gradient_profile_at_point(const int& i, const double& dist, const int& dir);
157 double get_temperature_gradient_times_conductivity_profile_at_point(const int& i, const double& dist, const int& dir, bool& valid_val);
158
159 Nom get_header_from_string_lists(const std::vector<std::string>& key_results_int,
160 const std::vector<std::string>& key_results_double);
161 void set_results_probes_size(const std::vector<std::string>& key_results_int,
162 const std::vector<std::string>& key_results_double,
163 std::map<std::string, ArrOfInt>& results_probes_int,
164 std::map<std::string, ArrOfDouble>& results_probes_double);
166 const std::vector<std::string>& key_results_int,
167 const std::vector<std::string>& key_results_double,
168 std::map<std::string, ArrOfInt>& results_probes_int,
169 std::map<std::string, ArrOfDouble>& results_probes_double);
170 void thermal_subresolution_outputs_parallel(const int& rank,
171 const Nom& interfacial_quantities_thermal_probes,
172 const Nom& shell_quantities_thermal_probes,
173 const Nom& overall_bubbles_quantities,
174 const Nom& local_quantities_thermal_probes_time_index_folder);
175 void thermal_subresolution_outputs(const int& rank,
176 const Nom& interfacial_quantities_thermal_probes,
177 const Nom& shell_quantities_thermal_probes,
178 const Nom& overall_bubbles_quantities,
179 const Nom& local_quantities_thermal_probes_time_index_folder);
180
181 void compare_fluxes_thermal_subproblems(const IJK_Field_vector3_double& convective_diffusive_fluxes_raw,
182 const int flux_type,
183 const int inv_sign=0);
184
185 const int& get_subproblems_counter() const
186 {
188 }
190 {
192 }
193
194 double get_min_temperature() const;
195 double get_max_temperature() const;
196 double get_min_temperature_domain_ends() const;
197 double get_max_temperature_domain_ends() const;
198 double get_min_euler_time_step(int& nb_iter_explicit);
203 double get_local_dt_cfl();
205 int get_probe_variations_enabled(const int& probe_variations_priority);
208 void set_local_time_step(const double& local_time_step);
210 const int& get_end_index_subproblem(const int index) const;
212 void sort_limited_probes_spherical_coords_post_processing(const int& post_process_all_probes,
213 const int& nb_theta, const int& nb_phi,
214 const int theta_diag_val, const int phi_diag_val);
215 void compute_overall_quantities_per_bubbles(const IJK_Field_double& temperature_ghost,
216 const double& delta_temperature,
217 const double& lambda);
218 void compute_nusselt_numbers_per_bubbles(const IJK_Field_double& temperature_gradient_ghost,
219 const double& delta_temperature,
220 const double& lambda);
222 void compute_overall_bubbles_quantities(IJK_Thermal_Subresolution& ref_thermal_subresolution);
225 void post_process_overall_bubbles_quantities(const int rank, const Nom& overall_bubbles_quantities);
226
227 void dispatch_interfacial_heat_flux_correction(IJK_Field_vector3_double& interfacial_heat_flux_dispatched,
228 FixedVector<ArrOfInt, 4>& ijk_indices_out,
229 ArrOfDouble& thermal_flux_out,
230 IJK_Field_vector3_double& interfacial_heat_flux_current);
232 ArrOfDouble& thermal_flux_out);
234 const ArrOfDouble& thermal_flux_out,
235 IJK_Field_vector3_double& interfacial_heat_flux_dispatched);
236 void dispatch_interfacial_heat_flux(IJK_Field_vector3_double& interfacial_heat_flux_dispatched,
237 FixedVector<ArrOfInt, 3>& ijk_indices_out,
238 FixedVector<ArrOfDouble, 3>& thermal_flux_out);
239
240 double get_thermal_subproblem_value_at_ijk_index(const int& m, int& index_i, int& index_j, int& index_k, const int& val_index);
241
242protected :
243 std::vector<IJK_One_Dimensional_Subproblem*> one_dimensional_effective_subproblems_;
244 std::vector<IJK_One_Dimensional_Subproblem*> one_dimensional_disabled_subproblems_;
245 int init_ = 1;
246 int debug_ = 0;
256 bool is_updated_ = 0;
258
260
261 std::map<int, std::map<int, std::map<int, int>>> subproblem_to_ijk_indices_previous_;
262 std::map<int, std::map<int, std::map<int, int>>> subproblem_to_ijk_indices_;
263
264 std::vector<DoubleVect> temperature_probes_previous_;
265 std::vector<double> indicator_probes_previous_;
266 std::vector<Vecteur3> velocities_probes_previous_;
268
270 std::map<int, std::map<int, std::map<int, int>>> subproblem_to_ijk_indices_previous_global_;
271 std::map<int, std::map<int, std::map<int, int>>> subproblem_to_ijk_indices_global_;
272
274 std::vector<std::vector<ArrOfDouble>> temperature_probes_previous_local_perio_;
276 std::vector<std::vector<ArrOfDouble>> velocities_probes_previous_local_perio_;
277 std::vector<std::vector<ArrOfDouble>> normal_vector_compo_probes_previous_local_perio_;
278
280 std::vector<std::vector<ArrOfDouble>> temperature_probes_previous_global_;
281 std::vector<ArrOfDouble> indicator_probes_previous_global_;
282 std::vector<std::vector<ArrOfDouble>> velocities_probes_previous_global_;
283 std::vector<std::vector<ArrOfDouble>> normal_vector_compo_probes_previous_global_;
284
290
296
304
312
315
318
321
326
330
333 const Vecteur3 * liquid_velocity_ = nullptr;
334
342
343 double total_surface_ = 0.;
344 double total_volume_ = 0.;
345 double lambda_=0.;
346 double * prandtl_number_ = nullptr;
347
350
351 double uniform_alpha_ = 0.;
355
356 const DoubleTab * bubbles_barycentres_ = nullptr;
357 const DoubleTab * bubbles_barycentres_old_ = nullptr;
358 const DoubleTab * bubbles_barycentres_new_ = nullptr;
359 const ArrOfDouble * bubbles_volume_ = nullptr;
360 const ArrOfDouble * bubbles_rising_velocities_ = nullptr;
361 const DoubleTab * bubbles_rising_vectors_per_bubble_ = nullptr;
362 const ArrOfDouble * bubbles_rising_velocities_from_barycentres_ = nullptr;
363 const DoubleTab * bubbles_rising_vectors_from_barycentres_ = nullptr;
364
369
373
377
381
385
390
393
398
401
404
409
413
417
421
425
426 ArrOfDouble radius_outputs_;
427 ArrOfDouble theta_outputs_;
428 ArrOfDouble phi_outputs_;
430
439
441
450
459
462
465
468
473
478
482
486
490
494
498
502
506
510
515
518
522
527
530
534
539
542
546
551
554
558
563
566
570
575
578
582
585
588
591
594
597
600
603
606
609
612
615
618
619 int nb_bubbles_ = 0;
620 int * latastep_reprise_ = nullptr;
621
623
624};
625
626#endif /* IJK_One_Dimensional_Subproblems_included */
: class IJK_Interfaces
DoubleVect get_temperature_profile_discrete_integral_at_point(const int &i, const double &dist, const int &level, const int &dir)
const int & get_dxyz_over_two_increment_bool(const int &subproblem_index) const
std::map< int, std::map< int, std::map< int, int > > > subproblem_to_ijk_indices_previous_global_
DoubleVect get_temperature_gradient_times_conductivity_profile_discrete_integral_at_point(const int &i, const double &dist, const int &level, const int &dir)
std::vector< IJK_One_Dimensional_Subproblem * > one_dimensional_disabled_subproblems_
void initialise_thermal_subproblems_list_params(const int &pre_initialise_thermal_subproblems_list, const double &pre_factor_subproblems_number, const int &remove_append_subproblems, const int &use_sparse_matrix)
std::vector< std::vector< ArrOfDouble > > normal_vector_compo_probes_previous_local_perio_
const FixedVector< double, 6 > & get_dist_faces_interface(const int &i) const
IJK_One_Dimensional_Subproblems(const Probleme_FTD_IJK_base &ijk_ft)
void share_interfacial_heat_flux_correction_on_procs(FixedVector< ArrOfInt, 4 > &ijk_indices_out, ArrOfDouble &thermal_flux_out)
void thermal_subresolution_outputs(const int &rank, 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)
void compute_modified_probe_length(const int &probe_variations_enabled)
void set_local_time_step(const double &local_time_step)
void dispatch_interfacial_heat_flux(IJK_Field_vector3_double &interfacial_heat_flux_dispatched, FixedVector< ArrOfInt, 3 > &ijk_indices_out, FixedVector< ArrOfDouble, 3 > &thermal_flux_out)
void set_max_subproblems(const int max_subproblems)
FixedVector< ArrOfDouble, 3 > relative_rising_dir_compo_barycentres_upstream_
double get_temperature_gradient_times_conductivity_profile_at_point(const int &i, const double &dist, const int &dir, bool &valid_val)
std::vector< std::vector< ArrOfDouble > > temperature_probes_previous_global_
int is_in_map_index_ijk(const std::map< int, std::map< int, std::map< int, int > > > &subproblem_to_ijk_indices, const int &index_i, const int &index_j, const int &index_k)
const FixedVector< int, 3 > & get_pure_neighbours_corrected_sign(const int &subproblem_index) const
const std::vector< std::vector< std::vector< std::vector< bool > > > > get_pure_neighbours_last_faces_to_correct(const int &subproblem_index) const
std::vector< ArrOfDouble > indicator_probes_previous_global_
std::vector< ArrOfDouble > indicator_probes_previous_local_perio_
double get_min_euler_time_step(int &nb_iter_explicit)
FixedVector< ArrOfInt, 3 > ijk_indices_to_subproblem_
void associate_variables_for_post_processing(IJK_Thermal_Subresolution &ref_thermal_subresolution)
const int & get_end_index_subproblem(const int index) const
std::vector< Vecteur3 > normal_vector_compo_probes_previous_
void compare_fluxes_thermal_subproblems(const IJK_Field_vector3_double &convective_diffusive_fluxes_raw, const int flux_type, const int inv_sign=0)
int get_probe_variations_enabled(const int &probe_variations_priority)
FixedVector< std::vector< ArrOfInt >, 2 > index_ij_subproblems_global_
const std::vector< std::vector< std::vector< std::vector< double > > > > get_pure_neighbours_last_faces_corrected_distance(const int &subproblem_index) const
std::vector< std::vector< ArrOfDouble > > temperature_probes_previous_local_perio_
void compute_source_terms_impose_boundary_conditions(const int &boundary_condition_interface, const double &interfacial_boundary_condition_value, const int &impose_boundary_condition_interface_from_simulation, const int &boundary_condition_end, const double &end_boundary_condition_value, const int &impose_user_boundary_condition_end_value)
const std::vector< std::vector< std::vector< double > > > & get_pure_neighbours_corrected_colinearity(const int &subproblem_index) const
std::vector< std::vector< ArrOfDouble > > normal_vector_compo_probes_previous_global_
const std::vector< std::vector< std::vector< std::vector< double > > > > get_pure_neighbours_last_faces_corrected_colinearity(const int &subproblem_index) const
void set_results_probes_size(const std::vector< std::string > &key_results_int, const std::vector< std::string > &key_results_double, std::map< std::string, ArrOfInt > &results_probes_int, std::map< std::string, ArrOfDouble > &results_probes_double)
const std::vector< std::vector< std::vector< double > > > & get_pure_neighbours_corrected_distance(const int &subproblem_index) const
std::vector< IJK_One_Dimensional_Subproblem * > one_dimensional_effective_subproblems_
void compute_overall_quantities_per_bubbles(const IJK_Field_double &temperature_ghost, const double &delta_temperature, const double &lambda)
int get_subproblem_index_from_ijk_indices(const int &i, const int &j, const int &k) const
double get_corrective_flux_from_current(const int &i, const int &l)
void retrieve_interfacial_heat_flux_correction_on_procs(const FixedVector< ArrOfInt, 4 > &ijk_indices_out, const ArrOfDouble &thermal_flux_out, IJK_Field_vector3_double &interfacial_heat_flux_dispatched)
void set_effective_subproblems(const int &enable_probe_collision_detection)
std::map< int, std::map< int, std::map< int, int > > > subproblem_to_ijk_indices_previous_
FixedVector< std::vector< ArrOfInt >, 2 > index_ij_subproblems_local_perio_
void compare_flux_interface(const int &i, std::vector< double > &radial_flux_error)
void associate_subproblem_to_ijk_indices(const int &i, const int &j, const int &k)
const std::vector< std::vector< std::vector< bool > > > & get_pure_neighbours_to_correct(const int &subproblem_index) const
const int & get_dxyz_increment_bool(const int &subproblem_index) const
std::vector< std::vector< ArrOfDouble > > velocities_probes_previous_local_perio_
DoubleVect get_temperature_gradient_profile_discrete_integral_at_point(const int &i, const double &dist, const int &level, const int &dir)
DoubleVect get_temperature_times_velocity_profile_discrete_integral_at_point(const int &i, const double &dist, const int &level, const int &dir, const int &l)
void compute_overall_bubbles_quantities(IJK_Thermal_Subresolution &ref_thermal_subresolution)
void get_ijk_indices_from_subproblems(const int &rank, int &i, int &j, int &k)
std::map< int, std::map< int, std::map< int, int > > > subproblem_to_ijk_indices_
void associate_ijk_indices_to_subproblem(const int &rank, const int &i, const int &j, const int &k)
void associer(const Probleme_FTD_IJK_base &ijk_ft)
OBS_PTR(Probleme_FTD_IJK_base) ref_ijk_ft_
double get_temperature_gradient_profile_at_point(const int &i, const double &dist, const int &dir)
std::vector< std::vector< ArrOfDouble > > velocities_probes_previous_global_
double get_corrective_flux_from_neighbours(const int &i, const int &l)
double get_temperature_times_velocity_profile_at_point(const int &i, const double &dist, const int &dir, bool &valid_val, const int &l, const int &index_i, const int &index_j, const int &index_k, const int &temperature=0) const
void dispatch_interfacial_heat_flux_correction(IJK_Field_vector3_double &interfacial_heat_flux_dispatched, FixedVector< ArrOfInt, 4 > &ijk_indices_out, ArrOfDouble &thermal_flux_out, IJK_Field_vector3_double &interfacial_heat_flux_current)
const Vecteur3 & get_bary_facet(const int &i) const
double get_temperature_profile_at_point(const int &i, const double &dist) const
void set_results_probes_fic(SFichier &fic, const std::vector< std::string > &key_results_int, const std::vector< std::string > &key_results_double, std::map< std::string, ArrOfInt > &results_probes_int, std::map< std::string, ArrOfDouble > &results_probes_double)
void compute_nusselt_numbers_per_bubbles(const IJK_Field_double &temperature_gradient_ghost, const double &delta_temperature, const double &lambda)
double get_thermal_subproblem_value_at_ijk_index(const int &m, int &index_i, int &index_j, int &index_k, const int &val_index)
FixedVector< ArrOfDouble, 3 > relative_rising_dir_compo_barycentres_
void sort_limited_probes_spherical_coords_post_processing(const int &post_process_all_probes, const int &nb_theta, const int &nb_phi, const int theta_diag_val, const int phi_diag_val)
void thermal_subresolution_outputs_parallel(const int &rank, 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)
void associate_sub_problem_to_inputs(IJK_Thermal_Subresolution &ref_thermal_subresolution, int i, int j, int k, const double &indicator, double global_time_step, double current_time, const IJK_Interfaces &interfaces, const IJK_Field_vector3_double &velocity, const IJK_Field_vector3_double &velocity_ft, const IJK_Field_double &pressure)
FixedVector< ArrOfDouble, 3 > relative_rising_dir_compo_upstream_
std::map< int, std::map< int, std::map< int, int > > > subproblem_to_ijk_indices_global_
void get_subproblem_ijk_indices(int &i, int &j, int &k, int &subproblem_index) const
Nom get_header_from_string_lists(const std::vector< std::string > &key_results_int, const std::vector< std::string > &key_results_double)
void set_pure_flux_corrected(const double &flux_face, const int &i, const int &l, const int &flux_type)
const double & get_dist_cell_interface(const int &i) const
void post_process_overall_bubbles_quantities(const int rank, const Nom &overall_bubbles_quantities)
FixedVector< ArrOfDouble, 3 > relative_rising_dir_compo_
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
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