TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Evaluateur_Source_Force_Boussinesq_VDF_Face.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
17#ifndef Evaluateur_Source_Force_Boussinesq_VDF_Face_included
18#define Evaluateur_Source_Force_Boussinesq_VDF_Face_included
19
20#include <Evaluateur_Source_Face.h>
21#include <Domaine_VDF.h>
22#include <Champ_Don_base.h>
23
24/*! @brief : class Evaluateur_Source_Force_Boussinesq_VDF_Face
25 *
26 * <Description of class Evaluateur_Source_Force_Boussinesq_VDF_Face>
27 */
28
30{
31
32public :
33 template <typename Type_Double> void calculer_terme_source(const int num_face, Type_Double& source) const;
34 template <typename Type_Double> void calculer_terme_source_bord(const int num_face, Type_Double& source) const { calculer_terme_source(num_face, source); }
35 void completer() override;
36 void associer(const Champ_Don_base& g, const double& rho0, const Champ_Don_base& rho);
37 void mettre_a_jour() override;
38
39protected :
41 DoubleVect volumes_;
42 DoubleVect g_;
43 double rho0_;
45 DoubleTab db_beta_;
46
47};
48
50{
52 const Domaine_VDF& dom_VDF = ref_cast(Domaine_VDF,le_dom.valeur());
53 face_voisins_.ref(dom_VDF.face_voisins());
54 volumes_.ref(dom_VDF.volumes());
55}
56
58{
59 g_.ref(g.valeurs());
60 rho0_ = rho0;
61 rho_ = rho;
62 const int nb_faces_tot = ref_cast(Domaine_VDF,le_dom.valeur()).nb_faces_tot();
63 db_beta_.resize(nb_faces_tot, RESIZE_OPTIONS::NOCOPY_NOINIT);
65}
66
68{
69 const int nb_faces_tot = ref_cast(Domaine_VDF,le_dom.valeur()).nb_faces_tot();
70 const DoubleTab& rho = rho_->valeurs();
71 db_beta_ = 0.;
72 for (int fac = 0; fac < nb_faces_tot; fac++)
73 {
74 int elem1 = face_voisins_(fac, 0);
75 int elem2 = face_voisins_(fac, 1);
76 double vol = 0;
77 if (elem1 != -1)
78 {
79 db_beta_(fac) += (rho(elem1) / rho0_ - 1.0) * volumes_(elem1);
80 vol += volumes_(elem1);
81 }
82 if (elem2 != -1)
83 {
84 db_beta_(fac) += (rho(elem2) / rho0_ - 1.0) * volumes_(elem2);
85 vol += volumes_(elem2);
86 }
87 db_beta_(fac) /= vol;
88 }
89}
90
91template <typename Type_Double>
92void Evaluateur_Source_Force_Boussinesq_VDF_Face::calculer_terme_source(const int num_face, Type_Double& source) const
93{
94 const int size = source.size_array();
95 for (int i = 0; i < size; i++) source[i] = db_beta_(num_face) * g_(orientation(num_face)) * porosite_surf(num_face) * volumes_entrelaces(num_face);
96}
97
98
99#endif /* Evaluateur_Source_Force_Boussinesq_VDF_Face_included */
classe Champ_Don_base classe de base des Champs donnes (non calcules)
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
class Domaine_VDF
Definition Domaine_VDF.h:64
double volumes(int i) const
Definition Domaine_VF.h:113
int face_voisins(int num_face, int i) const
renvoie l'element voisin de numface dans la direction i.
Definition Domaine_VF.h:418
: class Evaluateur_Source_Force_Boussinesq_VDF_Face
void calculer_terme_source(const int num_face, Type_Double &source) const
void calculer_terme_source_bord(const int num_face, Type_Double &source) const
void associer(const Champ_Don_base &g, const double &rho0, const Champ_Don_base &rho)