TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Eval_Diff_VDF_Face_Gen.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 Eval_Diff_VDF_Face_Gen_included
17#define Eval_Diff_VDF_Face_Gen_included
18
19#include <Neumann_sortie_libre.h>
20#include <Evaluateur_VDF.h>
21#include <Eval_VDF_Face.h>
22
23/*! @brief class Eval_Diff_VDF_Face_Gen Evaluateur VDF pour la diffusion
24 *
25 * Le champ diffuse est un Champ_Face_VDF
26 *
27 * @sa Eval_VDF_Face, Evaluateur_VDF
28 */
29template <typename DERIVED_T>
31{
32public:
33 // TEST_COEFFS : if true, activate the finite difference evaluation of coeffs to check the implementation
34 // ACTIVATE_TAU_TR : if true, activate the calculation of the tau_tr component (should always be activated, use for debug in laminar for example)
35 static constexpr bool IS_TURB = false, IS_ANISO = false, TEST_COEFFS = false, ACTIVATE_TAU_TR = true;
36
37 /* ****************************************************************************** *
38 * YES, we do magic ! Its all about : Substition Failure Is Not An Error (SFINAE) *
39 * ****************************************************************************** */
40
41 /* ************************************** *
42 * ********* POUR L'EXPLICITE ********** *
43 * ************************************** */
44
45 template<Type_Flux_Fa7 Fa7_Type, typename Type_Double> inline std::enable_if_t< Fa7_Type == Type_Flux_Fa7::SORTIE_LIBRE, void>
46 flux_fa7(const DoubleTab&, const DoubleTab*, int , const Neumann_sortie_libre&, int, Type_Double& ) const { /* Do nothing */ }
47
48 template<Type_Flux_Fa7 Fa7_Type, typename Type_Double> inline std::enable_if_t< Fa7_Type == Type_Flux_Fa7::ELEM, void>
49 flux_fa7(const DoubleTab&, const DoubleTab*, int, int, int, Type_Double& ) const;
50
51 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline std::enable_if_t< Arete_Type == Type_Flux_Arete::INTERNE, void>
52 flux_arete(const DoubleTab&, const DoubleTab*, int, int, int, int, Type_Double& ) const ;
53
54 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline std::enable_if_t< Arete_Type == Type_Flux_Arete::MIXTE, void>
55 flux_arete(const DoubleTab&, const DoubleTab*, int, int, int, int, Type_Double& ) const ;
56
57 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline std::enable_if_t<Arete_Type == Type_Flux_Arete::PAROI || Arete_Type == Type_Flux_Arete::NAVIER_PAROI, void>
58 flux_arete(const DoubleTab&, const DoubleTab*, int, int, int, int, Type_Double& ) const ;
59
60 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline std::enable_if_t<(Arete_Type == Type_Flux_Arete::NAVIER), void>
61 flux_arete(const DoubleTab&, const DoubleTab*, int, int, int, int, Type_Double& ) const;
62
63 template<Type_Flux_Arete Arete_Type, typename Type_Double>
64 inline std::enable_if_t< Arete_Type == Type_Flux_Arete::FLUIDE || Arete_Type == Type_Flux_Arete::NAVIER_FLUIDE || Arete_Type == Type_Flux_Arete::PAROI_FLUIDE, void>
65 flux_arete(const DoubleTab&, const DoubleTab*, int, int, int, int, Type_Double&, Type_Double&) const;
66
67 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline std::enable_if_t< Arete_Type == Type_Flux_Arete::PERIODICITE, void>
68 flux_arete(const DoubleTab&, const DoubleTab*, int, int, int, int, Type_Double&, Type_Double&) const ;
69
70 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline std::enable_if_t< Arete_Type == Type_Flux_Arete::COIN_FLUIDE, void>
71 flux_arete(const DoubleTab&, const DoubleTab*, int, int, int, int, Type_Double&, Type_Double&) const
72 {
73 Cerr << "arete_coin_fluide not coded for this scheme. Ask the TRUST support to code like Eval_Amont_VDF_Face !" << finl;
75 }
76
77 /* ************************************** *
78 * ********* POUR L'IMPLICITE ********** *
79 * ************************************** */
80
81 template<Type_Flux_Fa7 Fa7_Type, typename Type_Double> inline std::enable_if_t< Fa7_Type == Type_Flux_Fa7::SORTIE_LIBRE, void>
82 coeffs_fa7(const DoubleTab*, int , const Neumann_sortie_libre&, Type_Double& , Type_Double& ) const { /* Do nothing */}
83
84 template<Type_Flux_Fa7 Fa7_Type, typename Type_Double> inline std::enable_if_t< Fa7_Type == Type_Flux_Fa7::ELEM, void>
85 coeffs_fa7(const DoubleTab*, int, int, int, Type_Double& , Type_Double& ) const;
86
87 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline std::enable_if_t< Arete_Type == Type_Flux_Arete::INTERNE, void>
88 coeffs_arete(const DoubleTab*, int, int, int, int, Type_Double& , Type_Double& ) const;
89
90 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline std::enable_if_t< Arete_Type == Type_Flux_Arete::MIXTE, void>
91 coeffs_arete(const DoubleTab*, int, int, int, int, Type_Double& , Type_Double& ) const;
92
93 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline std::enable_if_t< Arete_Type == Type_Flux_Arete::PERIODICITE, void>
94 coeffs_arete(const DoubleTab*, int, int, int, int, Type_Double& , Type_Double& ) const;
95
96 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline std::enable_if_t< Arete_Type == Type_Flux_Arete::PAROI || Arete_Type == Type_Flux_Arete::NAVIER_PAROI, void>
97 coeffs_arete(const DoubleTab*, int, int, int, int, Type_Double& , Type_Double& , Type_Double& ) const;
98
99 template<Type_Flux_Arete Arete_Type, typename Type_Double>
100 inline std::enable_if_t< Arete_Type == Type_Flux_Arete::FLUIDE || Arete_Type == Type_Flux_Arete::NAVIER_FLUIDE || Arete_Type == Type_Flux_Arete::PAROI_FLUIDE, void>
101 coeffs_arete(const DoubleTab*, int, int, int, int, Type_Double& , Type_Double& , Type_Double& ) const;
102
103 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline std::enable_if_t< (Arete_Type == Type_Flux_Arete::NAVIER), void>
104 coeffs_arete(const DoubleTab*, int, int, int, int, Type_Double& , Type_Double& , Type_Double& ) const;
105
106 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline std::enable_if_t< (Arete_Type == Type_Flux_Arete::COIN_FLUIDE), void>
107 coeffs_arete(const DoubleTab*, int, int, int, int, Type_Double& , Type_Double& , Type_Double& ) const { /* Do nothing */ }
108
109private:
110 inline double surface_(int i,int j) const { return 0.5*(surface(i)+surface(j)); }
111 inline double porosity_(int i,int j) const { return 0.5*(porosite(i)+porosite(j)); }
112
113 // CRTP pattern to static_cast the appropriate class and get the implementation : This is magic !
114 inline double nu_mean_2pts(int i=0, int j=0, int compo=0) const { return static_cast<const DERIVED_T *>(this)->nu_1_impl_face(i, j, compo); }
115 inline double nu_mean_4pts(int i, int j, int k, int l, int compo=0) const { return static_cast<const DERIVED_T *>(this)->nu_2_impl_face(i, j, k, l,compo); }
116 inline double nu_lam(int i, int j=0) const { return static_cast<const DERIVED_T *>(this)->nu_2_impl(i,j); } // Attention nu_2_impl and not nu_1_impl for Dift ...
117 inline double nu_lam_mean_4pts(int i, int j, int k, int l, int compo=0) const { return static_cast<const DERIVED_T *>(this)->nu_lam_impl_face(i,j,k,l,compo); }
118 inline double nu_lam_mean_2pts(int i, int j, int compo=0) const { return static_cast<const DERIVED_T *>(this)->nu_lam_impl_face2(i,j,compo); }
119 inline double nu_turb(int i, int compo=0) const { return static_cast<const DERIVED_T *>(this)->nu_t_impl(i,compo); }
120 inline double tau_tan(int i, int j) const { return static_cast<const DERIVED_T *>(this)->tau_tan_impl(i,j); }
121 inline bool uses_wall_law() const { return static_cast<const DERIVED_T *>(this)->uses_wall(); }
122 inline bool uses_mod_turb() const { return static_cast<const DERIVED_T *>(this)->uses_mod(); }
123 inline const DoubleTab& k_elem() const { return static_cast<const DERIVED_T *>(this)->get_k_elem(); } // pour F5 seulement ...
124
125 // methods to check coeffs/flux implementation
126 static constexpr double EPS = 1e-6;
127
128 template<typename Type_Double> void check_error(const char * , const int, const int , const Type_Double& , const Type_Double& , const Type_Double& ) const;
129
130 template<Type_Flux_Arete Arete_Type, typename Type_Double>
131 inline std::enable_if_t< Arete_Type == Type_Flux_Arete::INTERNE || Arete_Type == Type_Flux_Arete::MIXTE, void>
132 test_coeffs_common(const int , const int , const int , const int , Type_Double& , Type_Double& ) const;
133
134 template<Type_Flux_Arete Arete_Type, typename Type_Double>
135 inline std::enable_if_t<Arete_Type == Type_Flux_Arete::PAROI || Arete_Type == Type_Flux_Arete::NAVIER_PAROI, void>
136 test_coeffs_common(const int , const int , const int , const int , Type_Double& , Type_Double& ) const;
137
138 template<Type_Flux_Arete Arete_Type, typename Type_Double>
139 inline std::enable_if_t<Arete_Type == Type_Flux_Arete::FLUIDE || Arete_Type == Type_Flux_Arete::NAVIER_FLUIDE || Arete_Type == Type_Flux_Arete::PAROI_FLUIDE, void>
140 test_coeffs_common(const int , const int , const int , const int , Type_Double& , Type_Double& , Type_Double& , Type_Double&) const;
141
142 template<Type_Flux_Arete Arete_Type, typename Type_Double>
143 inline std::enable_if_t<Arete_Type == Type_Flux_Arete::PERIODICITE, void>
144 test_coeffs_common(const int , const int , const int , const int , Type_Double& , Type_Double& ) const;
145
146 template<Type_Flux_Fa7 Fa7_Type, typename Type_Double> inline std::enable_if_t< Fa7_Type == Type_Flux_Fa7::ELEM, void>
147 test_coeffs_fa7(const int, const int, const int, const Type_Double& ) const;
148
149 template<Type_Flux_Arete Arete_Type, typename Type_Double>
150 inline std::enable_if_t< Arete_Type == Type_Flux_Arete::INTERNE, void>
151 test_coeffs_arete(const int, const int, const int, const int, const Type_Double& ) const;
152
153 template<Type_Flux_Arete Arete_Type, typename Type_Double>
154 inline std::enable_if_t<Arete_Type == Type_Flux_Arete::MIXTE, void>
155 test_coeffs_arete(const int, const int, const int, const int, const Type_Double& ) const;
156
157 template<Type_Flux_Arete Arete_Type, typename Type_Double>
158 inline std::enable_if_t<Arete_Type == Type_Flux_Arete::PERIODICITE, void>
159 test_coeffs_arete(const int, const int, const int, const int, const Type_Double& ) const;
160
161 template<Type_Flux_Arete Arete_Type, typename Type_Double>
162 inline std::enable_if_t<Arete_Type == Type_Flux_Arete::PAROI || Arete_Type == Type_Flux_Arete::NAVIER_PAROI, void>
163 test_coeffs_arete(const int, const int, const int, const int, const Type_Double&) const;
164
165 template<Type_Flux_Arete Arete_Type, typename Type_Double>
166 inline std::enable_if_t<Arete_Type == Type_Flux_Arete::FLUIDE || Arete_Type == Type_Flux_Arete::NAVIER_FLUIDE || Arete_Type == Type_Flux_Arete::PAROI_FLUIDE, void>
167 test_coeffs_arete(const int, const int, const int, const int, const Type_Double& , const Type_Double&) const;
168};
169
170#include <Eval_Diff_VDF_Face_Gen.tpp> // templates specializations ici ;)
171
172#endif /* Eval_Diff_VDF_Face_Gen_included */
class Eval_Diff_VDF_Face_Gen Evaluateur VDF pour la diffusion
std::enable_if_t< Fa7_Type==Type_Flux_Fa7::SORTIE_LIBRE, void > flux_fa7(const DoubleTab &, const DoubleTab *, int, const Neumann_sortie_libre &, int, Type_Double &) const
std::enable_if_t< Fa7_Type==Type_Flux_Fa7::SORTIE_LIBRE, void > coeffs_fa7(const DoubleTab *, int, const Neumann_sortie_libre &, Type_Double &, Type_Double &) const
static constexpr bool TEST_COEFFS
static constexpr bool ACTIVATE_TAU_TR
static constexpr bool IS_TURB
std::enable_if_t<(Arete_Type==Type_Flux_Arete::COIN_FLUIDE), void > coeffs_arete(const DoubleTab *, int, int, int, int, Type_Double &, Type_Double &, Type_Double &) const
std::enable_if_t< Arete_Type==Type_Flux_Arete::INTERNE, void > coeffs_arete(const DoubleTab *, int, int, int, int, Type_Double &, Type_Double &) const
std::enable_if_t< Arete_Type==Type_Flux_Arete::COIN_FLUIDE, void > flux_arete(const DoubleTab &, const DoubleTab *, int, int, int, int, Type_Double &, Type_Double &) const
static constexpr bool IS_ANISO
std::enable_if_t< Arete_Type==Type_Flux_Arete::INTERNE, void > flux_arete(const DoubleTab &, const DoubleTab *, int, int, int, int, Type_Double &) const
class Eval_VDF_Face Cette classe represente le prototype fonctionnel des evaluateurs
DoubleVect porosite
DoubleVect surface
classe Neumann_sortie_libre Cette classe represente une frontiere ouverte sans vitesse imposee
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455