TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Evaluateur_Source_Force_Capillaire_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_Capillaire_VDF_Face_included
18#define Evaluateur_Source_Force_Capillaire_VDF_Face_included
19
20#include <Evaluateur_Source_Face.h>
21#include <Domaine_VDF.h>
22#include <Operateur_Grad.h>
23
24/*! @brief : class Evaluateur_Source_Force_Capillaire_VDF_Face
25 *
26 * <Description of class Evaluateur_Source_Force_Capillaire_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;
35 void completer() override;
36 void associer(const Champ_Inc_base& c, const Champ_Inc_base& mutilde, const Champ_Don_base& rho, const Operateur_Grad& opgrad);
37 inline void mettre_a_jour() override;
38
39protected :
41 DoubleVect volumes_;
42
47 VECT(DoubleTab) grad_mutilde_;
48
49};
50
52{
54 const Domaine_VDF& dom_VDF = ref_cast(Domaine_VDF,le_dom.valeur());
55 face_voisins_.ref(dom_VDF.face_voisins());
56 volumes_.ref(dom_VDF.volumes());
57}
58
60{
61 c_ = c;
62 mutilde_ = mutilde;
63 rho_ = rho;
64 opgrad_ = opgrad;
65 const int nb_param = mutilde.valeurs().line_size();
66 grad_mutilde_.dimensionner(nb_param);
67 for (int j = 0; j < nb_param; j++)
68 {
69 grad_mutilde_[j] = opgrad.mon_inconnue().valeurs();
70 }
72}
73
75{
76 const DoubleTab& mutilde = mutilde_->valeurs();
77 const int nb_elem = mutilde.dimension_tot(0);
78 const int nb_param = mutilde.line_size();
79 DoubleTab temp_mutilde1(nb_elem, 1);
80 for (int j = 0; j < nb_param; j++)
81 {
82 for (int i = 0; i < nb_elem; i++)
83 {
84 temp_mutilde1(i, 0) = mutilde(i, j);
85 }
86 opgrad_->calculer(temp_mutilde1, grad_mutilde_[j]);
87 }
88}
89
90template <typename Type_Double>
91void Evaluateur_Source_Force_Capillaire_VDF_Face::calculer_terme_source(const int num_face, Type_Double& source) const
92{
93 const DoubleTab& c = c_->valeurs();
94 const int nb_param = c.line_size();
95 const int size = source.size_array();
96 const int elem1 = face_voisins_(num_face, 0);
97 const int elem2 = face_voisins_(num_face, 1);
98 const double vol1 = volumes_(elem1);
99 const double vol2 = volumes_(elem2);
100 const double votTot = vol1 + vol2;
101 double rho0;
102 const DoubleTab& db_rho = rho_->valeurs();
103 if (sub_type(Champ_Uniforme, rho_.valeur()))
104 {
105 rho0 = db_rho(0);
106 }
107 else
108 {
109 rho0 = (db_rho(elem1) * vol1 + db_rho(elem2) * vol2) / votTot;
110 }
111 for (int j = 0; j < nb_param; j++)
112 {
113 double fac = (vol1 * c(elem1, j) + vol2 * c(elem2, j)) / votTot / rho0;
114 for (int i = 0; i < size; i++) source[i] = - fac * grad_mutilde_[j](num_face, i);
115 }
116}
117
118template <typename Type_Double>
119void Evaluateur_Source_Force_Capillaire_VDF_Face::calculer_terme_source_bord(const int num_face, Type_Double& source) const
120{
121 const int size = source.size_array();
122 for (int i = 0; i < size; i++) source[i] = 0.;
123}
124
125
126#endif /* Evaluateur_Source_Force_Capillaire_VDF_Face_included */
classe Champ_Don_base classe de base des Champs donnes (non calcules)
Classe Champ_Inc_base.
DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ au temps courant.
classe Champ_Uniforme Represente un champ constant dans l'espace et dans le temps.
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_Capillaire_VDF_Face
void calculer_terme_source_bord(const int num_face, Type_Double &source) const
void calculer_terme_source(const int num_face, Type_Double &source) const
void associer(const Champ_Inc_base &c, const Champ_Inc_base &mutilde, const Champ_Don_base &rho, const Operateur_Grad &opgrad)
Classe Operateur_Grad Classe generique de la hierarchie des operateurs calculant le gradient.
const Champ_Inc_base & mon_inconnue() const
Renvoie le champ representant l'inconnue de l'equation dont l'operateur fait partie.
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160
int line_size() const
Definition TRUSTVect.tpp:67