TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Eval_Conv_VDF_Face.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_Conv_VDF_Face_included
17#define Eval_Conv_VDF_Face_included
18
19#include <Neumann_sortie_libre.h>
20#include <Eval_VDF_Face.h>
21
22template <typename DERIVED_T>
24{
25public:
26 static constexpr bool IS_AMONT = false, IS_CENTRE = false, IS_CENTRE4 = false, IS_QUICK = false, IS_AXI = false;
27 static constexpr bool CALC_FA7_SORTIE_LIB = true, CALC_ARR_PAR = false, CALC_ARR_NAVIER_PAR = false;
28
29 /* ****************************************************************************** *
30 * YES, we do magic ! Its all about : Substition Failure Is Not An Error (SFINAE) *
31 * ****************************************************************************** */
32
33 /* ************************************** *
34 * ********* POUR L'EXPLICITE ********** *
35 * ************************************** */
36
37 template<Type_Flux_Fa7 Fa7_Type, typename Type_Double> inline std::enable_if_t< Fa7_Type == Type_Flux_Fa7::SORTIE_LIBRE, void>
38 flux_fa7(const DoubleTab&, const DoubleTab*, int , const Neumann_sortie_libre&, int, Type_Double& ) const;
39
40 template<Type_Flux_Fa7 Fa7_Type, typename Type_Double> inline std::enable_if_t< Fa7_Type == Type_Flux_Fa7::ELEM, void>
41 flux_fa7(const DoubleTab&, const DoubleTab*,int, int, int, Type_Double& ) const;
42
43 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline std::enable_if_t< Arete_Type == Type_Flux_Arete::INTERNE, void>
44 flux_arete(const DoubleTab&, const DoubleTab*, int, int, int, int, Type_Double& ) const ;
45
46 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline std::enable_if_t< Arete_Type == Type_Flux_Arete::MIXTE, void>
47 flux_arete(const DoubleTab&, const DoubleTab*,int, int, int, int, Type_Double& ) const ;
48
49 template<Type_Flux_Arete Arete_Type, typename Type_Double>
50 inline std::enable_if_t<(Arete_Type == Type_Flux_Arete::PAROI || Arete_Type == Type_Flux_Arete::NAVIER || Arete_Type == Type_Flux_Arete::NAVIER_PAROI), void>
51 flux_arete(const DoubleTab&, const DoubleTab*,int, int, int, int, Type_Double& ) const { /* do nothing */ }
52
53 template<Type_Flux_Arete Arete_Type, typename Type_Double>
54 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>
55 flux_arete(const DoubleTab&, const DoubleTab*,int, int, int, int, Type_Double&, Type_Double& ) const;
56
57 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline std::enable_if_t< Arete_Type == Type_Flux_Arete::PERIODICITE, void>
58 flux_arete(const DoubleTab&, const DoubleTab*, int, int, int, int, Type_Double&, Type_Double& ) const ;
59
60 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline std::enable_if_t< Arete_Type == Type_Flux_Arete::COIN_FLUIDE, void>
61 flux_arete(const DoubleTab&, const DoubleTab*, int, int, int, int, Type_Double&, Type_Double&) const;
62
63 /* ************************************** *
64 * ********* POUR L'IMPLICITE ********** *
65 * ************************************** */
66
67 template<Type_Flux_Fa7 Fa7_Type, typename Type_Double> inline std::enable_if_t< Fa7_Type == Type_Flux_Fa7::SORTIE_LIBRE, void>
68 coeffs_fa7(const DoubleTab*, int , const Neumann_sortie_libre&, Type_Double& , Type_Double& ) const;
69
70 template<Type_Flux_Fa7 Fa7_Type, typename Type_Double> inline std::enable_if_t< Fa7_Type == Type_Flux_Fa7::ELEM, void>
71 coeffs_fa7(const DoubleTab*, int, int, int, Type_Double& , Type_Double& ) const;
72
73 template<Type_Flux_Arete Arete_Type, typename Type_Double>
74 inline std::enable_if_t< Arete_Type == Type_Flux_Arete::INTERNE || Arete_Type == Type_Flux_Arete::MIXTE || Arete_Type == Type_Flux_Arete::PERIODICITE, void>
75 coeffs_arete(const DoubleTab*, int, int, int, int, Type_Double& , Type_Double& ) const;
76
77 template<Type_Flux_Arete Arete_Type, typename Type_Double>
78 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 || Arete_Type == Type_Flux_Arete::COIN_FLUIDE, void>
79 coeffs_arete(const DoubleTab*, int, int, int, int, Type_Double& , Type_Double& , Type_Double& ) const;
80
81 template<Type_Flux_Arete Arete_Type, typename Type_Double> inline
82 std::enable_if_t<(Arete_Type == Type_Flux_Arete::PAROI || Arete_Type == Type_Flux_Arete::NAVIER || Arete_Type == Type_Flux_Arete::NAVIER_PAROI), void>
83 coeffs_arete(const DoubleTab*, int, int, int, int, Type_Double& , Type_Double& , Type_Double& ) const { /* do nothing */ }
84
85private:
86 template <typename Type_Double>
87 inline void fill_coeffs_proto(const int, const double , const double, Type_Double& , Type_Double& ) const;
88
89 // CRTP pattern to static_cast the appropriate class and get the implementation: This is magic !
90 inline int premiere_face_bord() const { return static_cast<const DERIVED_T *>(this)->get_premiere_face_bord(); }
91 inline int orientation(int face) const { return static_cast<const DERIVED_T *>(this)->get_orientation(face); }
92 inline int elem_(int i, int j) const { return static_cast<const DERIVED_T *>(this)->get_elem(i,j); }
93 inline int face_amont_princ_(int num_face, int i) const { return static_cast<const DERIVED_T *>(this)->face_amont_princ(num_face,i); }
94 inline int face_amont_conj_(int num_face,int i, int k) const { return static_cast<const DERIVED_T *>(this)->face_amont_conj(num_face,i,k); }
95 inline double dt_vitesse(int face, int comp = 0) const { return static_cast<const DERIVED_T *>(this)->get_dt_vitesse(face, comp); }
96 inline double surface_porosite(int face) const { return static_cast<const DERIVED_T *>(this)->get_surface_porosite(face); }
97 inline double surface(int face) const { return static_cast<const DERIVED_T *>(this)->get_surface(face); }
98 inline double porosite(int face) const { return static_cast<const DERIVED_T *>(this)->get_porosite(face); }
99 inline double dim_face_(int n1,int k) const { return static_cast<const DERIVED_T *>(this)->dim_face(n1,k); }
100 inline double dim_elem_(int n1,int k) const { return static_cast<const DERIVED_T *>(this)->dim_elem(n1,k); }
101 inline double dist_face_(int n1,int n2,int k) const { return static_cast<const DERIVED_T *>(this)->dist_face(n1,n2,k); }
102 inline double dist_face_period_(int n1,int n2,int k) const { return static_cast<const DERIVED_T *>(this)->dist_face_period(n1,n2,k); }
103 inline double dist_elem_period_(int n1, int n2, int k) const { return static_cast<const DERIVED_T *>(this)->dist_elem_period(n1,n2,k); }
104 inline const Domaine_Cl_VDF& la_zcl() const { return static_cast<const DERIVED_T *>(this)->get_la_zcl(); }
105
106 inline double conv_quick_sharp_plus_(const double psc,const double vit_0, const double vit_1, const double vit_0_0, const double dx, const double dm, const double dxam) const
107 { return static_cast<const DERIVED_T *>(this)->conv_quick_sharp_plus(psc,vit_0,vit_1,vit_0_0,dx,dm,dxam); }
108
109 inline double conv_quick_sharp_moins_(const double psc,const double vit_0,const double vit_1, const double vit_1_1,const double dx, const double dm,const double dxam) const
110 { return static_cast<const DERIVED_T *>(this)->conv_quick_sharp_moins(psc,vit_0,vit_1,vit_1_1,dx,dm,dxam); }
111
112 inline double conv_centre_(const double psc,const double vit_0_0, const double vit_0, const double vit_1, const double vit1_1,double g1, double g2, double g3,double g4) const
113 { return static_cast<const DERIVED_T *>(this)->conv_centre(psc,vit_0_0,vit_0,vit_1,vit1_1,g1,g2,g3,g4); }
114
115 inline void calcul_g_(const double dxam, const double dx, const double dxav, double& g1, double& g2, double& g3, double& g4) const
116 { static_cast<const DERIVED_T *>(this)->calcul_g(dxam,dx,dxav,g1,g2,g3,g4); }
117};
118
119#include <Eval_Conv_VDF_Face.tpp> // templates specializations ici ;)
120
121#endif /* Eval_Conv_VDF_Face_included */
static constexpr bool IS_AXI
static constexpr bool IS_QUICK
static constexpr bool IS_AMONT
static constexpr bool IS_CENTRE
static constexpr bool IS_CENTRE4
std::enable_if_t<(Arete_Type==Type_Flux_Arete::PAROI||Arete_Type==Type_Flux_Arete::NAVIER||Arete_Type==Type_Flux_Arete::NAVIER_PAROI), void > flux_arete(const DoubleTab &, const DoubleTab *, int, int, int, int, Type_Double &) const
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<(Arete_Type==Type_Flux_Arete::PAROI||Arete_Type==Type_Flux_Arete::NAVIER||Arete_Type==Type_Flux_Arete::NAVIER_PAROI), 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||Arete_Type==Type_Flux_Arete::MIXTE||Arete_Type==Type_Flux_Arete::PERIODICITE, void > coeffs_arete(const DoubleTab *, int, int, int, int, Type_Double &, Type_Double &) const
std::enable_if_t< Arete_Type==Type_Flux_Arete::INTERNE, void > flux_arete(const DoubleTab &, const DoubleTab *, int, int, int, int, Type_Double &) const
static constexpr bool CALC_ARR_PAR
static constexpr bool CALC_ARR_NAVIER_PAR
static constexpr bool CALC_FA7_SORTIE_LIB
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
class Eval_VDF_Face Cette classe represente le prototype fonctionnel des evaluateurs
classe Neumann_sortie_libre Cette classe represente une frontiere ouverte sans vitesse imposee