TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Eval_Diff_VDF.h
1/****************************************************************************
2* Copyright (c) 2026, 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 Eval_Diff_VDF_included
17#define Eval_Diff_VDF_included
18
19#include <Champ_Uniforme.h>
20#include <Pb_Multiphase.h>
21#include <Champ_base.h>
22#include <TRUST_Ref.h>
23
25{
26public:
27 virtual ~Eval_Diff_VDF() { }
28
29 inline const int& is_var() const { return is_var_; }
30
31 inline virtual const Champ_base& diffusivite() const final { return get_diffusivite(); }
32
33 inline virtual const Champ_base& get_diffusivite() const final
34 {
35 assert(ref_diffusivite_);
36 return ref_diffusivite_.valeur();
37 }
38
39 inline virtual void associer_pb(const Probleme_base& pb) final
40 {
41 ref_probleme_ = pb;
43 }
44
45 inline virtual void update_diffusivite() final
46 {
47 // Pour Pb_multiphase, tab_diffusivite_ = alpha * Mu ou alpha * D
48 if (sub_type(Pb_Multiphase, ref_probleme_.valeur()))
49 {
50 tab_alpha_.ref(ref_cast(Pb_Multiphase, ref_probleme_.valeur()).equation_masse().inconnue().passe());
52 for (int e = 0; e < tab_diffusivite_.dimension(0); e++)
53 for (int n = 0; n < tab_diffusivite_.dimension(1); n++)
54 tab_diffusivite_(e, n) = std::max(tab_alpha_(e, n), 1e-8) * ref_diffusivite_->valeurs()(is_var_ * e, n);
55
56 tab_diffusivite_.echange_espace_virtuel();
57 }
58 else
59 tab_diffusivite_.ref(ref_diffusivite_->valeurs());
60 }
61
62 inline virtual void associer(const Champ_base& diffu)
63 {
64 ref_diffusivite_ = diffu;
65 is_var_ = sub_type(Champ_Uniforme, diffu) ? 0 : 1;
66 }
67
68 virtual void mettre_a_jour() // surcharger pour Multi-incos ...
69 {
70 ref_diffusivite_->valeurs().echange_espace_virtuel();
72 }
73
74 // Methods used by the flux computation in template class:
75 inline double compute_heq_impl(double d0, int i, double d1, int j, int compo) const
76 {
77 return 1. / (d0 / tab_diffusivite_(is_var_ * i, compo) + d1 / tab_diffusivite_(is_var_ * j, compo));
78 }
79
80 inline double nu_1_impl(int i, int compo) const { return tab_diffusivite_(is_var_ * i, compo); }
81 inline double nu_2_impl(int i, int compo) const { return tab_diffusivite_(is_var_ * i, compo); }
82
83 inline double nu_1_impl_face(int i, int j, int compo) const
84 {
85 return 0.5 * (tab_diffusivite_(is_var_ * i, compo) + tab_diffusivite_(is_var_ * j, compo));
86 }
87
88 inline double nu_2_impl_face(int i, int j, int k, int l, int compo) const
89 {
90 return 0.25 * (tab_diffusivite_(is_var_ * i, compo) + tab_diffusivite_(is_var_ * j, compo) + tab_diffusivite_(is_var_ * k, compo) + tab_diffusivite_(is_var_ * l, compo));
91 }
92
93 inline double nu_lam_impl_face(int i, int j, int k, int l, int compo) const { return nu_2_impl_face(i, j, k, l, compo); }
94 inline double nu_lam_impl_face2(int i, int j, int compo) const { return nu_1_impl_face(i, j, compo); }
95
96 // These methods will be overloaded in DIFT operators (See Eval_Dift_VDF_const_Elem for example ...)
97 inline int get_ind_Fluctu_Term() const { return 0; }
98 inline double get_dv_mvol(const int i) const { throw; } /* seulement pour K-Eps */
99 inline virtual double get_equivalent_distance(int boundary_index,int local_face) const { return 0; }
100 inline double nu_t_impl(int i, int compo) const { return 0.; }
101 inline double tau_tan_impl(int i, int j) const { return 0.; }
102 inline bool uses_wall() const { return false; }
103 inline bool uses_mod() const { return false; }
104 inline const DoubleTab& get_k_elem() const { throw; } // pour F5 seulement ...
105
106protected:
107 int is_var_ = 0;
108 OBS_PTR(Probleme_base) ref_probleme_;
109 OBS_PTR(Champ_base) ref_diffusivite_;
111};
112
113#endif /* Eval_Diff_VDF_included */
classe Champ_Uniforme Represente un champ constant dans l'espace et dans le temps.
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
virtual const Champ_base & get_diffusivite() const final
double nu_2_impl_face(int i, int j, int k, int l, int compo) const
double nu_1_impl(int i, int compo) const
bool uses_wall() const
double get_dv_mvol(const int i) const
virtual void associer_pb(const Probleme_base &pb) final
OBS_PTR(Probleme_base) ref_probleme_
double nu_1_impl_face(int i, int j, int compo) const
const DoubleTab & get_k_elem() const
OBS_PTR(Champ_base) ref_diffusivite_
const int & is_var() const
virtual ~Eval_Diff_VDF()
virtual void mettre_a_jour()
virtual void update_diffusivite() final
double nu_t_impl(int i, int compo) const
double nu_2_impl(int i, int compo) const
double compute_heq_impl(double d0, int i, double d1, int j, int compo) const
virtual void associer(const Champ_base &diffu)
virtual double get_equivalent_distance(int boundary_index, int local_face) const
int get_ind_Fluctu_Term() const
double nu_lam_impl_face(int i, int j, int k, int l, int compo) const
virtual const Champ_base & diffusivite() const final
double nu_lam_impl_face2(int i, int j, int compo) const
DoubleTab tab_diffusivite_
double tau_tan_impl(int i, int j) const
bool uses_mod() const
DoubleTab tab_alpha_
classe Pb_Multiphase Cette classe represente un probleme de thermohydraulique multiphase de type "3*N...
classe Probleme_base C'est un Probleme_U qui n'est pas un couplage.