TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Op_Diff_Dift_VDF.h
1/****************************************************************************
2* Copyright (c) 2024, 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 Op_Diff_Dift_VDF_included
17#define Op_Diff_Dift_VDF_included
18
19#include <Modele_turbulence_scal_base.h>
20#include <Modele_turbulence_hyd_base.h>
21#include <Iterateur_VDF_base.h>
22#include <Correlation_base.h>
23#include <Champ_P0_VDF.h>
24#include <TRUST_Deriv.h>
25#include <type_traits>
26
27class Champ_base;
28
29template <typename OP_TYPE>
31{
32protected:
33
34 template <Type_Operateur _TYPE_ ,typename EVAL_TYPE>
35 inline std::enable_if_t<_TYPE_ == Type_Operateur::Op_DIFF_ELEM || _TYPE_ == Type_Operateur::Op_DIFT_ELEM || _TYPE_ == Type_Operateur::Op_DIFT_MULTIPHASE_ELEM, void>
36 associer_impl(const Domaine_dis_base& domaine_dis, const Domaine_Cl_dis_base& domaine_cl_dis, const Champ_Inc_base& ch_diffuse)
37 {
38 const Champ_P0_VDF& inco = ref_cast(Champ_P0_VDF,ch_diffuse);
39 associer_<EVAL_TYPE>(domaine_dis,domaine_cl_dis).associer_inconnue(inco);
40 }
41
42 template <Type_Operateur _TYPE_ ,typename EVAL_TYPE>
43 inline std::enable_if_t<_TYPE_ == Type_Operateur::Op_DIFF_FACE || _TYPE_ == Type_Operateur::Op_DIFT_FACE || _TYPE_ == Type_Operateur::Op_DIFT_MULTIPHASE_FACE, void>
44 associer_impl(const Domaine_dis_base& domaine_dis, const Domaine_Cl_dis_base& domaine_cl_dis, const Champ_Inc_base& ch_diffuse)
45 {
46 const Champ_Face_VDF& inco = ref_cast(Champ_Face_VDF,ch_diffuse);
47 associer_<EVAL_TYPE>(domaine_dis,domaine_cl_dis).associer_inconnue(inco);
48 }
49
50 template <typename EVAL_TYPE>
52 {
53 EVAL_TYPE& eval_diff_turb = static_cast<EVAL_TYPE&>(iter_vdf()->evaluateur());
54 eval_diff_turb.associer(ch_diff);
55 }
56
57 template <typename EVAL_TYPE>
58 void associer_pb(const Probleme_base& pb)
59 {
60 EVAL_TYPE& eval_diff_turb = static_cast<EVAL_TYPE&>(iter_vdf()->evaluateur());
61 eval_diff_turb.associer_pb(pb);
62 }
63
64 template <Type_Operateur _TYPE_ ,typename EVAL_TYPE>
65 inline std::enable_if_t<_TYPE_ == Type_Operateur::Op_DIFT_MULTIPHASE_FACE || _TYPE_ == Type_Operateur::Op_DIFT_MULTIPHASE_ELEM, void>
67 {
68 EVAL_TYPE& eval_diff_turb = static_cast<EVAL_TYPE&>(iter_vdf()->evaluateur());
69 eval_diff_turb.associer_corr(corr);
70 }
71
72 template <Type_Operateur _TYPE_ ,typename EVAL_TYPE>
73 inline std::enable_if_t<_TYPE_ == Type_Operateur::Op_DIFT_MULTIPHASE_FACE || _TYPE_ == Type_Operateur::Op_DIFT_MULTIPHASE_ELEM, const DoubleTab&>
75 {
76 const EVAL_TYPE& eval_diff_turb = static_cast<const EVAL_TYPE&>(iter_vdf()->evaluateur());
77 return eval_diff_turb.get_diffusivite_turbulente_multiphase();
78 }
79
80 template <Type_Operateur _TYPE_ ,typename EVAL_TYPE>
81 inline std::enable_if_t<_TYPE_ == Type_Operateur::Op_DIFT_MULTIPHASE_FACE, void>
82 set_nut_impl(const DoubleTab& nut)
83 {
84 EVAL_TYPE& eval_diff_turb = static_cast<EVAL_TYPE&>(iter_vdf()->evaluateur());
85 eval_diff_turb.set_nut(nut, true /* need alpha * rho */ );
86 }
87
88 template <Type_Operateur _TYPE_ ,typename EVAL_TYPE>
89 inline std::enable_if_t<_TYPE_ == Type_Operateur::Op_DIFT_MULTIPHASE_ELEM, void>
90 set_nut_impl(const DoubleTab& nut)
91 {
92 EVAL_TYPE& eval_diff_turb = static_cast<EVAL_TYPE&>(iter_vdf()->evaluateur());
93 eval_diff_turb.set_nut(nut, false /* DO NOT need alpha * rho */);
94 }
95
96 template <typename EVAL_TYPE>
98 {
99 const EVAL_TYPE& eval_diff_turb = static_cast<const EVAL_TYPE&>(iter_vdf()->evaluateur());
100 return eval_diff_turb.get_diffusivite();
101 }
102
103 template <typename EVAL_TYPE>
104 const double& alpha_impl(const int i) const // TODO : FIXME : pour multiphase faut ajouter compo
105 {
106 const EVAL_TYPE& eval_diff_turb = static_cast<const EVAL_TYPE&>(iter_vdf()->evaluateur());
107 const Champ_base& diffu = eval_diff_turb.get_diffusivite();
108 const int is_var = eval_diff_turb.is_var();
109 return diffu.valeurs()(is_var * i);
110 }
111
112 template <typename EVAL_TYPE>
113 const DoubleTab& tab_alpha_impl() const
114 {
115 const EVAL_TYPE& eval_diff_turb = static_cast<const EVAL_TYPE&>(iter_vdf()->evaluateur());
116 const Champ_base& diffu = eval_diff_turb.get_diffusivite();
117 return diffu.valeurs();
118 }
119
120
121 template <Type_Operateur _TYPE_ ,typename EVAL_TYPE>
122 inline std::enable_if_t<_TYPE_ == Type_Operateur::Op_DIFF_FACE, void>
124 {
125 EVAL_TYPE& eval_diff = static_cast<EVAL_TYPE&> (iter_vdf()->evaluateur());
126 eval_diff.mettre_a_jour();
127 }
128
129 template <Type_Operateur _TYPE_ ,typename EVAL_TYPE>
130 inline std::enable_if_t<_TYPE_ == Type_Operateur::Op_DIFT_ELEM || _TYPE_ == Type_Operateur::Op_DIFT_FACE, void>
132 {
133 static_cast<OP_TYPE *>(this)->associer_diffusivite_turbulente_base(visc_ou_diff_turb); // hohohoho
134 EVAL_TYPE& eval_diff_turb = static_cast<EVAL_TYPE&>(iter_vdf()->evaluateur());
135 eval_diff_turb.associer_diff_turb(visc_ou_diff_turb);
136 }
137
138 template <Type_Operateur _TYPE_ ,typename EVAL_TYPE>
139 inline std::enable_if_t<_TYPE_ == Type_Operateur::Op_DIFT_ELEM, void>
141 {
142 EVAL_TYPE& eval_diff_turb = static_cast<EVAL_TYPE&>(iter_vdf()->evaluateur());
143 eval_diff_turb.associer_loipar(loi_paroi);
144 }
145
146 template <Type_Operateur _TYPE_ ,typename EVAL_TYPE>
147 inline std::enable_if_t<_TYPE_ == Type_Operateur::Op_DIFT_ELEM, void> completer_impl()
148 {
149 static_cast<OP_TYPE *>(this)->completer_Op_Dift_VDF_base();
150 const RefObjU& modele_turbulence = static_cast<OP_TYPE *>(this)->equation().get_modele(TURBULENCE);
151 if (sub_type(Modele_turbulence_scal_base,modele_turbulence.valeur()))
152 {
153 const Modele_turbulence_scal_base& mod_turb = ref_cast(Modele_turbulence_scal_base,modele_turbulence.valeur());
154 const Champ_Fonc_base& lambda_t = mod_turb.conductivite_turbulente();
156
157 const Turbulence_paroi_scal_base& loipar = mod_turb.loi_paroi();
158 if (mod_turb.loi_paroi_non_nulle()) associer_loipar_impl<_TYPE_,EVAL_TYPE>(loipar); // Et YES !
159
160 EVAL_TYPE& eval_diff_turb = static_cast<EVAL_TYPE&> (iter_vdf()->evaluateur());
161 eval_diff_turb.init_ind_fluctu_term(); // utile juste pour Const/Var Elem... sinon on fait rien
162 }
163 else // bizarre mais V2 (on fait comme le cas de l'Op_FACE mais sans assoscier un modele ...)
164 {
165 const Modele_turbulence_hyd_base& mod_turb = ref_cast(Modele_turbulence_hyd_base,modele_turbulence.valeur());
166 const Champ_Fonc_base& alpha_t = mod_turb.viscosite_turbulente();
168 }
169 }
170
171 template <Type_Operateur _TYPE_ ,typename EVAL_TYPE>
172 inline std::enable_if_t<_TYPE_ == Type_Operateur::Op_DIFT_FACE, void> completer_impl()
173 {
174 static_cast<OP_TYPE *>(this)->completer_Op_Dift_VDF_base();
175 const RefObjU& modele_turbulence = static_cast<OP_TYPE *>(this)->equation().get_modele(TURBULENCE);
176 const Modele_turbulence_hyd_base& mod_turb = ref_cast(Modele_turbulence_hyd_base,modele_turbulence.valeur());
177 const Champ_Fonc_base& visc_turb = mod_turb.viscosite_turbulente();
179 EVAL_TYPE& eval_diff_turb = static_cast<EVAL_TYPE&> (iter_vdf()->evaluateur());
180 eval_diff_turb.associer_modele_turbulence(mod_turb);
181 }
182
183private:
184 // CRTP pour recuperer l'iter
185 inline const OWN_PTR(Iterateur_VDF_base)& iter_vdf() const { return static_cast<const OP_TYPE *>(this)->get_iter(); }
186 inline OWN_PTR(Iterateur_VDF_base)& iter_vdf() { return static_cast<OP_TYPE *>(this)->get_iter(); }
187
188 template <typename EVAL_TYPE>
189 inline EVAL_TYPE& associer_(const Domaine_dis_base& domaine_dis, const Domaine_Cl_dis_base& domaine_cl_dis)
190 {
191 const Domaine_VDF& zvdf = ref_cast(Domaine_VDF,domaine_dis);
192 const Domaine_Cl_VDF& zclvdf = ref_cast(Domaine_Cl_VDF,domaine_cl_dis);
193 iter_vdf()->associer(zvdf,zclvdf,static_cast<OP_TYPE&>(*this));
194 EVAL_TYPE& eval_diff = static_cast<EVAL_TYPE&> (iter_vdf()->evaluateur());
195 eval_diff.associer_domaines(zvdf,zclvdf);
196 return eval_diff;
197 }
198};
199
200#endif /* Op_Diff_Dift_VDF_included */
class Champ_Face_VDF Cette classe sert a representer un champ vectoriel dont on ne calcule
classe Champ_Fonc_base Classe de base des champs qui sont fonction d'une grandeur calculee
Classe Champ_Inc_base.
classe Champ_P0_VDF Classe qui represente un champ discret P0 par element associe a un domaine discre...
virtual DoubleTab & valeurs()=0
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
classe Domaine_Cl_dis_base Les objets Domaine_Cl_dis_base representent les conditions aux limites
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
Classe Modele_turbulence_hyd_base Cette classe sert de base a la hierarchie des classes.
const Champ_Fonc_base & viscosite_turbulente() const
Classe Modele_turbulence_scal_base Cette classe represente un modele de turbulence pour une equation ...
const Champ_Fonc_base & conductivite_turbulente() const
const Turbulence_paroi_scal_base & loi_paroi() const
Renvoie la loi de turbulence sur la paroi (version const).
int loi_paroi_non_nulle() const
Renvoie si oui ou non loi de paroi (version const).
void associer_diffusivite_impl(const Champ_base &ch_diff)
std::enable_if_t< _TYPE_==Type_Operateur::Op_DIFT_MULTIPHASE_ELEM, void > set_nut_impl(const DoubleTab &nut)
const double & alpha_impl(const int i) const
const DoubleTab & tab_alpha_impl() const
std::enable_if_t< _TYPE_==Type_Operateur::Op_DIFT_MULTIPHASE_FACE, void > set_nut_impl(const DoubleTab &nut)
std::enable_if_t< _TYPE_==Type_Operateur::Op_DIFF_FACE, void > mettre_a_jour_impl()
std::enable_if_t< _TYPE_==Type_Operateur::Op_DIFF_ELEM||_TYPE_==Type_Operateur::Op_DIFT_ELEM||_TYPE_==Type_Operateur::Op_DIFT_MULTIPHASE_ELEM, void > associer_impl(const Domaine_dis_base &domaine_dis, const Domaine_Cl_dis_base &domaine_cl_dis, const Champ_Inc_base &ch_diffuse)
std::enable_if_t< _TYPE_==Type_Operateur::Op_DIFF_FACE||_TYPE_==Type_Operateur::Op_DIFT_FACE||_TYPE_==Type_Operateur::Op_DIFT_MULTIPHASE_FACE, void > associer_impl(const Domaine_dis_base &domaine_dis, const Domaine_Cl_dis_base &domaine_cl_dis, const Champ_Inc_base &ch_diffuse)
const Champ_base & diffusivite_impl() const
void associer_pb(const Probleme_base &pb)
std::enable_if_t< _TYPE_==Type_Operateur::Op_DIFT_MULTIPHASE_FACE||_TYPE_==Type_Operateur::Op_DIFT_MULTIPHASE_ELEM, void > associer_corr_impl(const Correlation_base &corr)
std::enable_if_t< _TYPE_==Type_Operateur::Op_DIFT_FACE, void > completer_impl()
std::enable_if_t< _TYPE_==Type_Operateur::Op_DIFT_ELEM||_TYPE_==Type_Operateur::Op_DIFT_FACE, void > associer_diffusivite_turbulente_impl(const Champ_Fonc_base &visc_ou_diff_turb)
std::enable_if_t< _TYPE_==Type_Operateur::Op_DIFT_ELEM, void > completer_impl()
std::enable_if_t< _TYPE_==Type_Operateur::Op_DIFT_MULTIPHASE_FACE||_TYPE_==Type_Operateur::Op_DIFT_MULTIPHASE_ELEM, const DoubleTab & > get_diffusivite_turbulente_multiphase_impl() const
std::enable_if_t< _TYPE_==Type_Operateur::Op_DIFT_ELEM, void > associer_loipar_impl(const Turbulence_paroi_scal_base &loi_paroi)
classe Probleme_base C'est un Probleme_U qui n'est pas un couplage.
const Objet_U & valeur() const
Definition TRUST_Ref.h:134
Classe Turbulence_paroi_scal_base Classe de base pour la hierarchie des classes representant les mode...