TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Operateur_IJK_elem_diff_base.h
1/****************************************************************************
2* Copyright (c) 2015 - 2016, 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 Operateur_IJK_elem_diff_base_included
17#define Operateur_IJK_elem_diff_base_included
18
19#include <Operateur_IJK_base.h>
20#include <Cut_cell_FT_Disc.h>
21
22enum class BOUNDARY_FLUX { NOT_DETERMINED_BY_BOUNDARY=0, KMIN_WALL=1, KMAX_WALL=2 };
23
25{
26 Declare_base_sans_constructeur(Operateur_IJK_elem_diff_base_double);
27public:
29 virtual void initialize(const Domaine_IJK& splitting) override;
30 virtual void set_indicatrice(const IJK_Field_double& indicatrice) { indicatrice_= &indicatrice; };
31 virtual void set_corrige_flux(OWN_PTR(Corrige_flux_FT_base)& corrige_flux) { corrige_flux_ = &corrige_flux; };
32 virtual void calculer(const IJK_Field_double& field,
33 IJK_Field_double& result,
34 const IJK_Field_local_double& boundary_flux_kmin,
35 const IJK_Field_local_double& boundary_flux_kmax);
36 virtual void ajouter(const IJK_Field_double& field,
37 IJK_Field_double& result,
38 const IJK_Field_local_double& boundary_flux_kmin,
39 const IJK_Field_local_double& boundary_flux_kmax);
40
41 inline void set_uniform_lambda(const double& uniform_lambda) { uniform_lambda_ = &uniform_lambda; };
42 inline void set_uniform_lambda_liquid(const double& uniform_lambda_liquid) { uniform_lambda_liquid_ = &uniform_lambda_liquid; };
43 inline void set_uniform_lambda_vapour(const double& uniform_lambda_vapour) { uniform_lambda_vapour_ = &uniform_lambda_vapour; };
44
45 inline void set_lambda(const IJK_Field_local_double& lambda) { lambda_ = &lambda; };
46
47 inline void set_coeff_x_y_z(const IJK_Field_local_double& coeff_field_x,
48 const IJK_Field_local_double& coeff_field_y,
49 const IJK_Field_local_double& coeff_field_z)
50 {
51 coeff_field_x_ = &coeff_field_x;
52 coeff_field_y_ = &coeff_field_y;
53 coeff_field_z_ = &coeff_field_z;
54 }
55
56 inline double get_uniform_lambda()
57 {
58 if (uniform_lambda_ == nullptr)
59 return 1.;
60 else
61 return *uniform_lambda_;
62 }
63
64 inline void compute_flux_x(IJK_Field_local_double& resu, const int k_layer) override
65 {
66 compute_flux_<DIRECTION::X>(resu,k_layer);
67 }
68 inline void compute_flux_y(IJK_Field_local_double& resu, const int k_layer) override
69 {
70 compute_flux_<DIRECTION::Y>(resu,k_layer);
71 }
72 inline void compute_flux_z(IJK_Field_local_double& resu, const int k_layer) override
73 {
74 compute_flux_<DIRECTION::Z>(resu,k_layer);
75 }
76 inline double compute_flux_local_x(int i, int j, int k) override
77 {
79 }
80 inline double compute_flux_local_y(int i, int j, int k) override
81 {
83 }
84 inline double compute_flux_local_z(int i, int j, int k) override
85 {
87 }
88
89protected:
90 template <DIRECTION _DIR_>
91 inline void compute_flux_(IJK_Field_local_double& resu, const int k_layer);
92
93 template <DIRECTION _DIR_>
94 inline double compute_flux_local_(int i, int j, int k);
95
96 template <DIRECTION _DIR_>
97 inline double compute_flux_local_(double d0, double d1, double surface, double input_left, double input_centre, double lambda_left, double lambda_centre, double structural_model);
98
99 template <DIRECTION _DIR_>
100 inline BOUNDARY_FLUX flux_determined_by_boundary_condition_(int k);
101
102 template <DIRECTION _DIR_>
103 inline double compute_flux_local_boundary_condition_(BOUNDARY_FLUX type_boundary_flux, int i, int j);
104
105 template <DIRECTION _DIR_>
106 inline Vecteur3 compute_surface_d0_d1_(int k);
107
108 const IJK_Field_local_double& get_model(DIRECTION _DIR_);
109
112
113 // Pointers to input data (set by calculer, used by compute_flux_...)
114 const IJK_Field_double *input_field_;
115
116 const IJK_Field_local_double *lambda_;
117 const double *uniform_lambda_;
120
121 const IJK_Field_local_double *coeff_field_x_;
122 const IJK_Field_local_double *coeff_field_y_;
123 const IJK_Field_local_double *coeff_field_z_;
124
125 const IJK_Field_local_double *boundary_flux_kmin_;
126 const IJK_Field_local_double *boundary_flux_kmax_;
127
129 const IJK_Field_local_double *indicatrice_;
130
138
139};
140
147
149{
150 Declare_instanciable_sans_constructeur(OpDiffUniformIJKScalarCorrection_double);
151public:
153private:
154 void correct_flux(IJK_Field_local_double *const flux, int k_layer, const int dir) override;
155 void correct_flux_spherical(Simd_double& a, Simd_double& b, const int& i, const int& j, int k_layer, int dir) override;
156};
157
159{
160 Declare_instanciable_sans_constructeur(OpDiffIJKScalar_cut_cell_double);
161public:
163 void initialise_cut_cell(bool ignore_small_cells,
164 FixedVector<Cut_cell_double, 3>& cut_cell_flux,
165 IJK_Field_int& treatment_count,
166 int& new_treatment)
167 {
168 ignore_small_cells_ = ignore_small_cells;
169 cut_cell_flux_ = &cut_cell_flux;
170 treatment_count_ = &treatment_count;
171 new_treatment_ = &new_treatment;
172 }
173
174 void set_runge_kutta(int rk_step, double dt_tot, IJK_Field_vector3_double& current_fluxes, IJK_Field_vector3_double& RK3_F_fluxes, Cut_field_int& cellule_rk_restreint_diff_main)
175 {
176 if (rk_step == -1)
177 {
179 rk_step_ = -1;
180 dt_tot_ = 0;
181 current_fluxes_ = nullptr;
182 RK3_F_fluxes_ = nullptr;
183 cellule_rk_restreint_diff_main_ = nullptr;
184 }
185 else
186 {
188 rk_step_ = rk_step;
189 dt_tot_ = dt_tot;
190 current_fluxes_ = &current_fluxes;
191 RK3_F_fluxes_ = &RK3_F_fluxes;
192 cellule_rk_restreint_diff_main_ = &cellule_rk_restreint_diff_main;
193 }
194 };
195
197 {
198 assert(&(*cut_cell_flux_)[0].get_cut_cell_disc() == &(*cut_cell_flux_)[1].get_cut_cell_disc());
199 assert(&(*cut_cell_flux_)[0].get_cut_cell_disc() == &(*cut_cell_flux_)[2].get_cut_cell_disc());
200 return &(*cut_cell_flux_)[0].get_cut_cell_disc();
201 }
202
204 {
205 return cut_cell_flux_;
206 }
207
209 const IJK_Field_local_double& flux_x,
210 const IJK_Field_local_double& flux_y,
211 const IJK_Field_local_double& flux_zmin,
212 const IJK_Field_local_double& flux_zmax,
213 IJK_Field_double& resu, int k_layer, bool add);
214
215 void Operator_IJK_div(const IJK_Field_local_double& flux_x, const IJK_Field_local_double& flux_y,
216 const IJK_Field_local_double& flux_zmin, const IJK_Field_local_double& flux_zmax,
217 IJK_Field_double& resu, int k_layer, bool add) override
218 {
219 Operateur_IJK_elem_base_double::Operator_IJK_div(flux_x, flux_y, flux_zmin, flux_zmax, resu, k_layer, add);
220
222 compute_cut_cell_divergence(cut_cell_flux, flux_x, flux_y, flux_zmin, flux_zmax, resu, k_layer, add);
223 }
224
225private:
226 void correct_flux(IJK_Field_local_double *const flux, int k_layer, const int dir) override;
227
228 template <DIRECTION _DIR_>
229 inline void correct_flux_(IJK_Field_local_double *const flux, int k_layer);
230
231
232 bool ignore_small_cells_;
233
234 FixedVector<Cut_cell_double, 3> *cut_cell_flux_;
235 Cut_field_int *cellule_rk_restreint_diff_main_;
236
237 IJK_Field_int *treatment_count_;
238 int *new_treatment_;
239
240};
241
243{
244 Declare_instanciable_sans_constructeur(OpDiffIJKScalar_double);
245public:
247};
248
255
262
269
276
277#include <Operateur_IJK_elem_diff_base.tpp>
278
279#endif
: class Corrige_flux_FT API pour modifier un champ de flux à partir de donnees à l'interface....
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
Definition Domaine_IJK.h:47
void compute_cut_cell_divergence(const FixedVector< Cut_cell_double, 3 > &cut_cell_flux, const IJK_Field_local_double &flux_x, const IJK_Field_local_double &flux_y, const IJK_Field_local_double &flux_zmin, const IJK_Field_local_double &flux_zmax, IJK_Field_double &resu, int k_layer, bool add)
FixedVector< Cut_cell_double, 3 > * get_cut_cell_flux()
void set_runge_kutta(int rk_step, double dt_tot, IJK_Field_vector3_double &current_fluxes, IJK_Field_vector3_double &RK3_F_fluxes, Cut_field_int &cellule_rk_restreint_diff_main)
void initialise_cut_cell(bool ignore_small_cells, FixedVector< Cut_cell_double, 3 > &cut_cell_flux, IJK_Field_int &treatment_count, int &new_treatment)
void Operator_IJK_div(const IJK_Field_local_double &flux_x, const IJK_Field_local_double &flux_y, const IJK_Field_local_double &flux_zmin, const IJK_Field_local_double &flux_zmax, IJK_Field_double &resu, int k_layer, bool add) override
virtual void Operator_IJK_div(const IJK_Field_local_double &flux_x, const IJK_Field_local_double &flux_y, const IJK_Field_local_double &flux_zmin, const IJK_Field_local_double &flux_zmax, IJK_Field_double &resu, int k_layer, bool add)
IJK_Field_vector3_double * current_fluxes_
IJK_Field_vector3_double * RK3_F_fluxes_
void compute_flux_y(IJK_Field_local_double &resu, const int k_layer) override
virtual void ajouter(const IJK_Field_double &field, IJK_Field_double &result, const IJK_Field_local_double &boundary_flux_kmin, const IJK_Field_local_double &boundary_flux_kmax)
virtual void set_indicatrice(const IJK_Field_double &indicatrice)
double compute_flux_local_y(int i, int j, int k) override
void set_uniform_lambda(const double &uniform_lambda)
void set_uniform_lambda_liquid(const double &uniform_lambda_liquid)
void compute_flux_x(IJK_Field_local_double &resu, const int k_layer) override
void set_lambda(const IJK_Field_local_double &lambda)
virtual void set_corrige_flux(OWN_PTR(Corrige_flux_FT_base)&corrige_flux)
double compute_flux_local_x(int i, int j, int k) override
void compute_flux_z(IJK_Field_local_double &resu, const int k_layer) override
const IJK_Field_local_double * boundary_flux_kmin_
void set_coeff_x_y_z(const IJK_Field_local_double &coeff_field_x, const IJK_Field_local_double &coeff_field_y, const IJK_Field_local_double &coeff_field_z)
virtual void calculer(const IJK_Field_double &field, IJK_Field_double &result, const IJK_Field_local_double &boundary_flux_kmin, const IJK_Field_local_double &boundary_flux_kmax)
double compute_flux_local_boundary_condition_(BOUNDARY_FLUX type_boundary_flux, int i, int j)
double compute_flux_local_z(int i, int j, int k) override
OWN_PTR(Corrige_flux_FT_base) *corrige_flux_
virtual void initialize(const Domaine_IJK &splitting) override
const IJK_Field_local_double & get_model(DIRECTION _DIR_)
const IJK_Field_local_double * boundary_flux_kmax_
void compute_flux_(IJK_Field_local_double &resu, const int k_layer)
void set_uniform_lambda_vapour(const double &uniform_lambda_vapour)