TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Source_Gravite_PF_VDF.cpp
1/****************************************************************************
2* Copyright (c) 2021, 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#include <Convection_Diffusion_Phase_field.h>
17#include <Navier_Stokes_phase_field.h>
18#include <Source_Con_Phase_field.h>
19#include <Source_Gravite_PF_VDF.h>
20#include <Milieu_Phase_field.h>
21#include <Dirichlet_homogene.h>
22#include <Domaine_Cl_VDF.h>
23#include <Probleme_base.h>
24#include <Domaine_VDF.h>
25#include <Periodique.h>
26#include <Dirichlet.h>
27
28Implemente_instanciable(Source_Gravite_PF_VDF, "Source_Gravite_PF_VDF", Source_base);
29
31{
32 return os << que_suis_je() << finl;
33}
34
36{
37 return is;
38}
39
41{
42 le_dom_ = ref_cast(Domaine_VDF, dds);
43 le_dom_Cl_ = ref_cast(Domaine_Cl_VDF, domaine_cl);
44}
45
46DoubleTab& Source_Gravite_PF_VDF::ajouter(DoubleTab& resu) const
47{
48 int face, nb_faces = le_dom_->nb_faces();
49 int premiere_face_interne = le_dom_->premiere_face_int();
50
51 const IntVect& orientation = le_dom_->orientation();
52 const DoubleVect& volumes_entrelaces = le_dom_->volumes_entrelaces();
53 DoubleVect porosite_surf; // porosites surfaciques
54 porosite_surf.ref(equation().milieu().porosite_face());
55 Navier_Stokes_phase_field& eq_NS_PF = ref_cast_non_const(Navier_Stokes_phase_field, equation());
56 const Milieu_Phase_field& mil = ref_cast(Milieu_Phase_field, eq_NS_PF.milieu());
57
58 const DoubleVect& g = mil.gravite().valeurs();
59
60 int num_cl;
61
62 const int boussi = mil.get_boussi();
63
64 int type_systeme_naire = mil.get_fermeture().get_type_systeme_naire(); //si type_systeme_naire = 0 ou 1
65
66 if (type_systeme_naire == 0)
67 {
68 if (boussi == 0)
69 {
70 for (num_cl = 0; num_cl < le_dom_->nb_front_Cl(); num_cl++)
71 {
72 const Cond_lim& la_cl = le_dom_Cl_->les_conditions_limites(num_cl);
73 const Front_VF& le_bord = ref_cast(Front_VF, la_cl->frontiere_dis());
74 int ndeb = le_bord.num_premiere_face();
75 int nfin = ndeb + le_bord.nb_faces();
76 if (sub_type(Dirichlet,la_cl.valeur()) || sub_type(Dirichlet_homogene, la_cl.valeur()))
77 { /* Do nothing */ }
78 else
79 for (face = ndeb; face < nfin; face++)
80 resu(face) += g(orientation(face)) * porosite_surf(face) * volumes_entrelaces(face);
81 }
82
83 for (face = premiere_face_interne; face < nb_faces; face++)
84 resu(face) += g(orientation(face)) * porosite_surf(face) * volumes_entrelaces(face);
85 }
86 else if (boussi == 1)
87 {
88 const DoubleTab& rho = mil.rho().valeurs();
89 double rho0 = mil.rho0();
90 const IntTab& face_voisins = le_dom_->face_voisins();
91 const DoubleVect& volumes = le_dom_->volumes();
92
93 for (num_cl = 0; num_cl < le_dom_->nb_front_Cl(); num_cl++)
94 {
95 const Cond_lim& la_cl = le_dom_Cl_->les_conditions_limites(num_cl);
96 const Front_VF& le_bord = ref_cast(Front_VF, la_cl->frontiere_dis());
97 int ndeb = le_bord.num_premiere_face();
98 int nfin = ndeb + le_bord.nb_faces();
99 if (sub_type(Dirichlet,la_cl.valeur()) || sub_type(Dirichlet_homogene, la_cl.valeur()))
100 { /* Do nothing */ }
101 else
102 for (face = ndeb; face < nfin; face++)
103 {
104 int el0 = face_voisins(face, 0);
105 int el1 = face_voisins(face, 1);
106 double vol0 = volumes(el0);
107 double vol1 = volumes(el1);
108 double cbetaface = (vol0 * (rho(el0) / rho0 - 1.0) + vol1 * (rho(el1) / rho0 - 1.0)) / (vol0 + vol1);
109 resu(face) += cbetaface * g(orientation(face)) * porosite_surf(face) * volumes_entrelaces(face);
110 }
111 }
112
113 for (face = premiere_face_interne; face < nb_faces; face++)
114 {
115 int el0 = face_voisins(face, 0);
116 int el1 = face_voisins(face, 1);
117 double vol0 = volumes(el0);
118 double vol1 = volumes(el1);
119 double cbetaface = (vol0 * (rho(el0) / rho0 - 1.0) + vol1 * (rho(el1) / rho0 - 1.0)) / (vol0 + vol1);
120 resu(face) += cbetaface * g(orientation(face)) * porosite_surf(face) * volumes_entrelaces(face);
121 }
122 }
123 }
124 else if (type_systeme_naire == 1)
125 {
126 if (boussi == 0)
127 {
128 for (num_cl = 0; num_cl < le_dom_->nb_front_Cl(); num_cl++)
129 {
130 const Cond_lim& la_cl = le_dom_Cl_->les_conditions_limites(num_cl);
131 const Front_VF& le_bord = ref_cast(Front_VF, la_cl->frontiere_dis());
132 int ndeb = le_bord.num_premiere_face();
133 int nfin = ndeb + le_bord.nb_faces();
134 if (sub_type(Dirichlet,la_cl.valeur()) || sub_type(Dirichlet_homogene, la_cl.valeur()))
135 { /* Do nothing */ }
136 else
137 for (face = ndeb; face < nfin; face++)
138 resu(face) += g(orientation(face)) * porosite_surf(face) * volumes_entrelaces(face);
139 }
140
141 for (face = premiere_face_interne; face < nb_faces; face++)
142 resu(face) += g(orientation(face)) * porosite_surf(face) * volumes_entrelaces(face);
143 }
144 else if (boussi == 1)
145 {
146 const DoubleTab& rho = mil.rho().valeurs();
147 double rho0 = mil.rho0();
148 const IntTab& face_voisins = le_dom_->face_voisins();
149 const DoubleVect& volumes = le_dom_->volumes();
150
151 for (num_cl = 0; num_cl < le_dom_->nb_front_Cl(); num_cl++)
152 {
153 const Cond_lim& la_cl = le_dom_Cl_->les_conditions_limites(num_cl);
154 const Front_VF& le_bord = ref_cast(Front_VF, la_cl->frontiere_dis());
155 int ndeb = le_bord.num_premiere_face();
156 int nfin = ndeb + le_bord.nb_faces();
157 if (sub_type(Dirichlet,la_cl.valeur()) || sub_type(Dirichlet_homogene, la_cl.valeur()))
158 { /* Do nothing */ }
159 else
160 for (face = ndeb; face < nfin; face++)
161 {
162 int el0 = face_voisins(face, 0);
163 int el1 = face_voisins(face, 1);
164 double vol0 = volumes(el0);
165 double vol1 = volumes(el1);
166 double cbetaface = (vol0 * (rho(el0) / rho0 - 1.0) + vol1 * (rho(el1) / rho0 - 1.0)) / (vol0 + vol1);
167 resu(face) += cbetaface * g(orientation(face)) * porosite_surf(face) * volumes_entrelaces(face);
168 }
169 }
170
171 for (face = premiere_face_interne; face < nb_faces; face++)
172 {
173 int el0 = face_voisins(face, 0);
174 int el1 = face_voisins(face, 1);
175 double vol0 = volumes(el0);
176 double vol1 = volumes(el1);
177 double cbetaface = (vol0 * (rho(el0) / rho0 - 1.0) + vol1 * (rho(el1) / rho0 - 1.0)) / (vol0 + vol1);
178 resu(face) += cbetaface * g(orientation(face)) * porosite_surf(face) * volumes_entrelaces(face);
179 }
180 }
181 }
182
183 return resu;
184}
185
186DoubleTab& Source_Gravite_PF_VDF::calculer(DoubleTab& resu) const
187{
188 resu = 0.;
189 return ajouter(resu);
190}
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
classe Cond_lim Classe generique servant a representer n'importe quelle classe
Definition Cond_lim.h:31
Classe Dirichlet_homogene Cette classe est la classe de base de la hierarchie des conditions aux limi...
classe Dirichlet Cette classe est la classe de base de la hierarchie des conditions aux limites de ty...
Definition Dirichlet.h:31
class Domaine_Cl_VDF
classe Domaine_Cl_dis_base Les objets Domaine_Cl_dis_base representent les conditions aux limites
class Domaine_VDF
Definition Domaine_VDF.h:64
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Front_VF
Definition Front_VF.h:36
int nb_faces() const
Definition Front_VF.h:53
int num_premiere_face() const
Definition Front_VF.h:63
const Champ_Don_base & rho() const
const double & rho0() const
const Fermeture_Phase_field_base & get_fermeture() const
virtual const Champ_Don_base & gravite() const
Renvoie la gravite du milieu si elle a ete associe provoque une erreur sinon.
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
classe Navier_Stokes_phase_field Cette classe porte les termes de l'equation de la dynamique
const Milieu_base & milieu() const override
Renvoie le milieu physique de l'equation (le Fluide_base upcaste en Milieu_base).
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
Classe de base des flux de sortie.
Definition Sortie.h:52
class Source_Gravite_PF_VDF
DoubleTab & ajouter(DoubleTab &) const override
DoubleTab & calculer(DoubleTab &) const override
void associer_domaines(const Domaine_dis_base &domaine, const Domaine_Cl_dis_base &) override
classe Source_base Un objet Source_base est un terme apparaissant au second membre d'une
Definition Source_base.h:42
virtual void ref(const TRUSTVect &)