TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Operateur_IJK_faces_diff_base.cpp
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#include <Domaine_IJK.h>
17#include <Perf_counters.h>
18#include <Operateur_IJK_faces_diff_base.h>
19
20/*
21 * Options for CASE
22 *
23 * Yes_Turb: the flux is turbulent_mu * (grad u + grad^T u) - 2/3 * k + molecular_mu * grad u)'
24 * Yes_M_Grad: the flux is 'molecular_mu * grad u'
25 * Yes_M_Trans: the flux is 'molecular_mu * (grad u + grad^T u)'
26 * Yes_M_Div: the flux is 'molecular_mu * (grad u + grad^T u - 2/3 * div u * Id)'
27 * Yes_M_GradAnisotropic: the flux is 'molecular_mu^a * grad^a u' where (grad^a)_i = Delta_i (grad)_i
28 * Yes_M_TransAnisotropic: the flux is 'molecular_mu^a * (grad^a u + grad^a^T u)' where (grad^a)_i = Delta_i (grad)_i
29 * Yes_M_DivAnisotropic: the flux is 'molecular_mu^a * (grad^a u + grad^a^T u - 2/3 * div^a u * Id)' where (grad^a)_i = Delta_i (grad)_i
30 * Yes_M_GradTensorial: the flux is 'molecular_mu_tensor * grad u'
31 * Yes_M_TransTensorial: the flux is 'molecular_mu_tensor * (grad u + grad^T u)'
32 * Yes_M_DivTensorial: the flux is 'molecular_mu_tensor * (grad u + grad^T u - 2/3 * div u * Id)'
33 * Yes_M_GradTensorialAnisotropic: the flux is 'molecular_mu_tensor^a * grad^a u' where (grad^a)_i = Delta_i (grad)_i
34 * Yes_M_TransTensorialAnisotropic: the flux is 'molecular_mu_tensor^a * (grad^a u + grad^a^T u)' where (grad^a)_i = Delta_i (grad)_i
35 * Yes_M_DivTensorialAnisotropic: the flux is 'molecular_mu_tensor^a * (grad^a u + grad^a^T u - 2/3 * div^a u * Id)' where (grad^a)_i = Delta_i (grad)_i
36 * Yes_M_Struct: the flux is 'structural_model'
37 */
38
39Implemente_base_sans_constructeur(Operateur_IJK_faces_diff_base_double, "Operateur_IJK_faces_diff_base_double", Operateur_IJK_faces_base_double);
40
42{
43 return os;
44}
45
47{
48 return is;
49}
50
52{
53 vx_ = nullptr;
54 vy_ = nullptr;
55 vz_ = nullptr;
56
57 uniform_nu_= nullptr;
58 nu_ = nullptr;
59 divergence_ = nullptr;
60
61 coeff_tensor_xx_ = nullptr;
62 coeff_tensor_xy_ = nullptr;
63 coeff_tensor_xz_ = nullptr;
64 coeff_tensor_yx_ = nullptr;
65 coeff_tensor_yy_ = nullptr;
66 coeff_tensor_yz_ = nullptr;
67 coeff_tensor_zx_ = nullptr;
68 coeff_tensor_zy_ = nullptr;
70
71 is_uniform_ = false;
72 is_turb_= false;
73 is_anisotropic_ = false;
74 with_divergence_= false;
75 with_transpose_= false;
76 is_tensorial_= false;
77 is_structural_= false;
78
79 perio_k_=false;
80}
81
82void Operateur_IJK_faces_diff_base_double::set_coeff_x_y_z(const IJK_Field_double& coeff_tensor_xx,
83 const IJK_Field_double& coeff_tensor_xy,
84 const IJK_Field_double& coeff_tensor_xz,
85 const IJK_Field_double& coeff_tensor_yx,
86 const IJK_Field_double& coeff_tensor_yy,
87 const IJK_Field_double& coeff_tensor_yz,
88 const IJK_Field_double& coeff_tensor_zx,
89 const IJK_Field_double& coeff_tensor_zy,
90 const IJK_Field_double& coeff_tensor_zz)
91{
92 coeff_tensor_xx_ = &coeff_tensor_xx;
93 coeff_tensor_xy_ = &coeff_tensor_xy;
94 coeff_tensor_xz_ = &coeff_tensor_xz;
95 coeff_tensor_yx_ = &coeff_tensor_yx;
96 coeff_tensor_yy_ = &coeff_tensor_yy;
97 coeff_tensor_yz_ = &coeff_tensor_yz;
98 coeff_tensor_zx_ = &coeff_tensor_zx;
99 coeff_tensor_zy_ = &coeff_tensor_zy;
100 coeff_tensor_zz_ = &coeff_tensor_zz;
101}
102
103const IJK_Field_local_double& Operateur_IJK_faces_diff_base_double::get_v(DIRECTION _DIR_)
104{
105 switch(_DIR_)
106 {
107 case DIRECTION::X:
108 return *vx_;
109 case DIRECTION::Y:
110 return *vy_;
111 case DIRECTION::Z:
112 return *vz_;
113 default:
114 Cerr << "Error in Operateur_IJK_faces_diff_base_double::get_v: wrong direction..." << finl;
116 }
117 return *vx_;
118}
119
120const IJK_Field_local_double& Operateur_IJK_faces_diff_base_double::get_coeff_tensor(DIRECTION _COMPO1_, DIRECTION _COMPO2_)
121{
122 assert(is_structural_ || is_tensorial_);
123
124 switch(_COMPO1_)
125 {
126 case DIRECTION::X:
127 {
128 if(_COMPO2_ == DIRECTION::X)
129 return *coeff_tensor_xx_;
130 if(_COMPO2_ == DIRECTION::Y)
131 return *coeff_tensor_xy_;
132 if(_COMPO2_ == DIRECTION::Z)
133 return *coeff_tensor_xz_;
134 break;
135 }
136 case DIRECTION::Y:
137 {
138 if(_COMPO2_ == DIRECTION::X)
139 return *coeff_tensor_yx_;
140 if(_COMPO2_ == DIRECTION::Y)
141 return *coeff_tensor_yy_;
142 if(_COMPO2_ == DIRECTION::Z)
143 return *coeff_tensor_yz_;
144 break;
145 }
146 case DIRECTION::Z:
147 {
148 if(_COMPO2_ == DIRECTION::X)
149 return *coeff_tensor_zx_;
150 if(_COMPO2_ == DIRECTION::Y)
151 return *coeff_tensor_zy_;
152 if(_COMPO2_ == DIRECTION::Z)
153 return *coeff_tensor_zz_;
154 break;
155 }
156 default:
157 Cerr << "Error in OpDiffStructuralOnlyZeroatwallIJK_double::get_structural_model: wrong direction..." << finl;
159 }
160
161 // for compilation only...
162 return *coeff_tensor_xx_;
163}
164
165const IJK_Field_local_double& Operateur_IJK_faces_diff_base_double::get_nu()
166{
167 assert(!is_tensorial_);
168 return *nu_;
169}
170
172{
173 assert(is_uniform_);
174 return *uniform_nu_;
175}
176
178{
179 assert(with_divergence_);
180 return *divergence_;
181}
182
183void Operateur_IJK_faces_diff_base_double::ajouter(const IJK_Field_double& vx, const IJK_Field_double& vy, const IJK_Field_double& vz,
184 IJK_Field_double& dvx, IJK_Field_double& dvy, IJK_Field_double& dvz)
185{
186 statistics().begin_count(STD_COUNTERS::diffusion,statistics().get_last_opened_counter_level()+1);
187 vx_ = &vx;
188 vy_ = &vy;
189 vz_ = &vz;
190 compute_add(dvx, dvy, dvz);
191 nu_ = nullptr;
192 divergence_ = nullptr;
193 coeff_tensor_xx_ = nullptr;
194 coeff_tensor_xy_ = nullptr;
195 coeff_tensor_xz_ = nullptr;
196 coeff_tensor_yx_ = nullptr;
197 coeff_tensor_yy_ = nullptr;
198 coeff_tensor_yz_ = nullptr;
199 coeff_tensor_zx_ = nullptr;
200 coeff_tensor_zy_ = nullptr;
201 coeff_tensor_zz_ = nullptr;
202 statistics().end_count(STD_COUNTERS::diffusion);
203}
204
205void Operateur_IJK_faces_diff_base_double::calculer(const IJK_Field_double& vx, const IJK_Field_double& vy, const IJK_Field_double& vz,
206 IJK_Field_double& dvx, IJK_Field_double& dvy, IJK_Field_double& dvz)
207{
208 statistics().begin_count(STD_COUNTERS::diffusion,statistics().get_last_opened_counter_level()+1);
209 vx_ = &vx;
210 vy_ = &vy;
211 vz_ = &vz;
212 compute_set(dvx, dvy, dvz);
213 nu_ = nullptr;
214 divergence_ = nullptr;
215 coeff_tensor_xx_ = nullptr;
216 coeff_tensor_xy_ = nullptr;
217 coeff_tensor_xz_ = nullptr;
218 coeff_tensor_yx_ = nullptr;
219 coeff_tensor_yy_ = nullptr;
220 coeff_tensor_yz_ = nullptr;
221 coeff_tensor_zx_ = nullptr;
222 coeff_tensor_zy_ = nullptr;
223 coeff_tensor_zz_ = nullptr;
224 statistics().end_count(STD_COUNTERS::diffusion);
225}
226
227/*
228 * Definitions of the subclasses
229 */
230
231Implemente_instanciable_sans_constructeur(OpDiffIJK_double, "OpDiffIJK_double", Operateur_IJK_faces_diff_base_double);
232
234{
236 return os;
237}
238
240{
242 return is;
243}
244
245Implemente_instanciable_sans_constructeur(OpDiffTurbIJK_double, "OpDiffTurbIJK_double", Operateur_IJK_faces_diff_base_double);
246
248{
250 return os;
251}
252
254{
256 return is;
257}
258
259Implemente_instanciable_sans_constructeur(OpDiffStdWithLaminarTransposeIJK_double, "OpDiffStdWithLaminarTransposeIJK_double", Operateur_IJK_faces_diff_base_double);
260
262{
264 return os;
265}
266
268{
270 return is;
271}
272
273Implemente_instanciable_sans_constructeur(OpDiffStdWithLaminarTransposeAndDivergenceIJK_double, "OpDiffStdWithLaminarTransposeAndDivergenceIJK_double", Operateur_IJK_faces_diff_base_double);
274
276{
278 return os;
279}
280
282{
284 return is;
285}
286
287Implemente_instanciable_sans_constructeur(OpDiffAnisotropicIJK_double, "OpDiffAnisotropicIJK_double", Operateur_IJK_faces_diff_base_double);
288
290{
292 return os;
293}
294
296{
298 return is;
299}
300
301Implemente_instanciable_sans_constructeur(OpDiffStdWithLaminarTransposeAnisotropicIJK_double, "OpDiffStdWithLaminarTransposeAnisotropicIJK_double", Operateur_IJK_faces_diff_base_double);
302
304{
306 return os;
307}
308
310{
312 return is;
313}
314
315Implemente_instanciable_sans_constructeur(OpDiffStdWithLaminarTransposeAndDivergenceTensorialAnisotropicZeroatwallIJK_double, "OpDiffStdWithLaminarTransposeAndDivergenceTensorialAnisotropicZeroatwallIJK_double", Operateur_IJK_faces_diff_base_double);
316
318{
320 return os;
321}
322
324{
326 return is;
327}
328
329Implemente_instanciable_sans_constructeur(OpDiffStructuralOnlyZeroatwallIJK_double, "OpDiffStructuralOnlyZeroatwallIJK_double", Operateur_IJK_faces_diff_base_double);
330
332{
334 return os;
335}
336
338{
340 return is;
341}
342
343Implemente_instanciable_sans_constructeur(OpDiffStdWithLaminarTransposeTensorialAnisotropicZeroatwallIJK_double, "OpDiffStdWithLaminarTransposeTensorialAnisotropicZeroatwallIJK_double", Operateur_IJK_faces_diff_base_double);
344
346{
348 return os;
349}
350
352{
354 return is;
355}
356
357Implemente_instanciable_sans_constructeur(OpDiffStdWithLaminarTransposeAndDivergenceAnisotropicIJK_double, "OpDiffStdWithLaminarTransposeAndDivergenceAnisotropicIJK_double", Operateur_IJK_faces_diff_base_double);
358
360{
362 return os;
363}
364
366{
368 return is;
369}
370
371Implemente_instanciable_sans_constructeur(OpDiffTensorialZeroatwallIJK_double, "OpDiffTensorialZeroatwallIJK_double", Operateur_IJK_faces_diff_base_double);
372
374{
376 return os;
377}
378
380{
382 return is;
383}
384
385Implemente_instanciable_sans_constructeur(OpDiffStdWithLaminarTransposeTensorialZeroatwallIJK_double, "OpDiffStdWithLaminarTransposeTensorialZeroatwallIJK_double", Operateur_IJK_faces_diff_base_double);
386
388{
390 return os;
391}
392
394{
396 return is;
397}
398
399Implemente_instanciable_sans_constructeur(OpDiffTensorialAnisotropicZeroatwallIJK_double, "OpDiffTensorialAnisotropicZeroatwallIJK_double", Operateur_IJK_faces_diff_base_double);
400
402{
404 return os;
405}
406
408{
410 return is;
411}
412
413Implemente_instanciable_sans_constructeur(OpDiffStdWithLaminarTransposeAndDivergenceTensorialZeroatwallIJK_double, "OpDiffStdWithLaminarTransposeAndDivergenceTensorialZeroatwallIJK_double", Operateur_IJK_faces_diff_base_double);
414
416{
418 return os;
419}
420
422{
424 return is;
425}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
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
void compute_set(IJK_Field_double &dvx, IJK_Field_double &dvy, IJK_Field_double &dvz)
void compute_add(IJK_Field_double &dvx, IJK_Field_double &dvy, IJK_Field_double &dvz)
void ajouter(const IJK_Field_double &vx, const IJK_Field_double &vy, const IJK_Field_double &vz, IJK_Field_double &dvx, IJK_Field_double &dvy, IJK_Field_double &dvz)
const IJK_Field_local_double & get_v(DIRECTION _DIR_)
void set_coeff_x_y_z(const IJK_Field_double &coeff_tensor_xx, const IJK_Field_double &coeff_tensor_xy, const IJK_Field_double &coeff_tensor_xz, const IJK_Field_double &coeff_tensor_yx, const IJK_Field_double &coeff_tensor_yy, const IJK_Field_double &coeff_tensor_yz, const IJK_Field_double &coeff_tensor_zx, const IJK_Field_double &coeff_tensor_zy, const IJK_Field_double &coeff_tensor_zz)
void calculer(const IJK_Field_double &vx, const IJK_Field_double &vy, const IJK_Field_double &vz, IJK_Field_double &dvx, IJK_Field_double &dvy, IJK_Field_double &dvz)
const IJK_Field_local_double & get_coeff_tensor(DIRECTION _COMPO1_, DIRECTION _COMPO2_)
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52