TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
SourceFiltree_FT_disc_VEF_P1NC.cpp
1/****************************************************************************
2* Copyright (c) 2015 - 2016, 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 <SourceFiltree_FT_disc_VEF_P1NC.h>
17#include <Probleme_FT_Disc_gen.h>
18#include <Transport_Interfaces_FT_Disc.h>
19#include <Parser.h>
20#include <Domaine_VEF.h>
21#include <Domaine_Cl_VEF.h>
22#include <Neumann_sortie_libre.h>
23#include <Symetrie.h>
24#include <Periodique.h>
25#include <Dirichlet.h>
26#include <Dirichlet_homogene.h>
27
28Implemente_instanciable(SourceFiltree_FT_disc_VEF_P1NC,"SourceFiltree_FT_disc_VEF_P1NC",Source_base);
29
30
32{
33 return lire(is);
34}
36{
38 return os << que_suis_je();
39}
40/*! @brief Lit les parametres du terme source a partir d'un flot d'entree.
41 *
42 * @param (Entree& is) un flot d'entree
43 */
48
49DoubleTab& SourceFiltree_FT_disc_VEF_P1NC::ajouter(DoubleTab& resu) const
50{
51 const Domaine_VEF& domaine_VEF = le_dom_VEF.valeur();
52 const Domaine_Cl_VEF& domaine_Cl_VEF = le_dom_Cl_VEF.valeur();
53 const IntTab& face_voisins = domaine_VEF.face_voisins();
54 const DoubleTab& xv = domaine_VEF.xv();
55 const DoubleTab& Indicatrice = Indic_->valeurs();
56 const DoubleVect& volumes_entrelaces = domaine_VEF.volumes_entrelaces();
57 const DoubleVect& porosite_surf = equation().milieu().porosite_face();
58 const int nb_front_Cl = domaine_VEF.nb_front_Cl();
59
60 int n_bord,face, elem1,elem2,k, ndeb,nfin, offset;
61 double indic, x,y,z = 0;
62 // Boucle sur les conditions limites pour traiter les faces de bord
63 for (n_bord=0 ; n_bord<nb_front_Cl ; n_bord++)
64 {
65 // pour chaque Condition Limite on regarde son type
66 // Si face de Dirichlet on ne fait rien
67 // Si face de Neumann, Periodique ou de Symetrie on calcule la contribution au terme source
68 const Cond_lim& la_cl = domaine_Cl_VEF.les_conditions_limites(n_bord);
69 if (sub_type(Neumann_sortie_libre,la_cl.valeur())||sub_type(Symetrie,la_cl.valeur()))
70 {
71 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
72 ndeb = le_bord.num_premiere_face();
73 nfin = ndeb + le_bord.nb_faces();
74 for (face=ndeb; face<nfin; face++)
75 {
76 elem1 = face_voisins(face,0);
77 indic = Indicatrice(elem1);
78 x = xv(face,0);
79 y = xv(face,1);
80 if (dimension==3)
81 {
82 z = xv(face,2);
83 }
84 if (indic<0.5)
85 {
86 offset = 0;
87 }
88 else
89 {
90 offset = dimension_;
91 }
92 for (k=0 ; k<dimension ; k++)
93 {
94 fI_xyz_t[k]->setVar("x",x);
95 fI_xyz_t[k]->setVar("y",y);
96 fI_xyz_t[k]->setVar("z",z);
97 fI_xyz_t[k]->setVar("t",temps_);
98 resu(face,k) += fI_xyz_t[offset+k]->eval() * volumes_entrelaces(face) * porosite_surf(face);
99 }
100 }
101 }
102 else if (sub_type(Periodique,la_cl.valeur()))
103 {
104 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
105 ndeb = le_bord.num_premiere_face();
106 nfin = ndeb + le_bord.nb_faces();
107 for (face=ndeb; face<nfin; face++)
108 {
109 elem1 = face_voisins(face,0);
110 elem2 = face_voisins(face,1);
111 indic = (Indicatrice(elem1) + Indicatrice(elem2)) /2.;
112 x = xv(face,0);
113 y = xv(face,1);
114 if (dimension==3)
115 {
116 z = xv(face,2);
117 }
118 if (indic<0.5)
119 {
120 offset = 0;
121 }
122 else
123 {
124 offset = dimension_;
125 }
126 for (k=0 ; k<dimension ; k++)
127 {
128 fI_xyz_t[k]->setVar("x",x);
129 fI_xyz_t[k]->setVar("y",y);
130 fI_xyz_t[k]->setVar("z",z);
131 fI_xyz_t[k]->setVar("t",temps_);
132 resu(face,k) += fI_xyz_t[offset+k]->eval() * volumes_entrelaces(face) * porosite_surf(face);
133 }
134 }
135 }
136 else if ( (sub_type(Dirichlet,la_cl.valeur())) || (sub_type(Dirichlet_homogene,la_cl.valeur())) )
137 {
138 ;
139 }
140 }
141 //faces internes
142 for (face =domaine_VEF.premiere_face_int(); face<domaine_VEF.nb_faces(); face++)
143 {
144 elem1 = face_voisins(face,0);
145 elem2 = face_voisins(face,1);
146 indic = (Indicatrice(elem1) + Indicatrice(elem2)) /2.;
147 x = xv(face,0);
148 y = xv(face,1);
149 if (dimension==3)
150 {
151 z = xv(face,2);
152 }
153 if (indic<0.5)
154 {
155 offset = 0;
156 }
157 else
158 {
159 offset = dimension_;
160 }
161 for (k=0 ; k<dimension ; k++)
162 {
163 fI_xyz_t[k]->setVar("x",x);
164 fI_xyz_t[k]->setVar("y",y);
165 fI_xyz_t[k]->setVar("z",z);
166 fI_xyz_t[k]->setVar("t",temps_);
167 resu(face,k) += fI_xyz_t[offset+k]->eval() * volumes_entrelaces(face) * porosite_surf(face);
168 }
169 }
170
171 return resu;
172}
173DoubleTab& SourceFiltree_FT_disc_VEF_P1NC::calculer(DoubleTab& resu) const
174{
175 resu = 0.;
176 return ajouter(resu);
177}
179{
180 temps_ = temps;
181}
186
188{
189 le_dom_VEF = ref_cast(Domaine_VEF, domaine_dis);
190 le_dom_Cl_VEF = ref_cast(Domaine_Cl_VEF, domaine_Cl_dis);
191}
193{
194 if (sub_type(Probleme_FT_Disc_gen,pb))
195 {
196 const Probleme_FT_Disc_gen& pbFT = ref_cast(Probleme_FT_Disc_gen,pb);
198 Indic_ = eq_transport.inconnue();
199 }
200 else
201 {
202 Cerr<<"Un probleme "<<pb.que_suis_je()<<" ne peut etre associe a une source SourceFiltree_FT_disc_VEF_P1NC"<<finl;
203 Cerr<<"Il faut utiliser un pb Pb_Front_Tracking_base"<<finl;
204 }
205}
class Cond_lim Generic class used to represent any class
Definition Cond_lim.h:31
Classe Dirichlet_homogene This class is the base class of the hierarchy of homogeneous Dirichlet-type...
Dirichlet This class is the base class of the hierarchy of Dirichlet-type boundary conditions.
Definition Dirichlet.h:31
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
class Domaine_VEF
Definition Domaine_VEF.h:53
int nb_faces() const
Returns the total number of faces.
Definition Domaine_VF.h:471
DoubleVect & volumes_entrelaces()
Definition Domaine_VF.h:99
double xv(int num_face, int k) const
Definition Domaine_VF.h:76
int premiere_face_int() const
A face is internal if and only if it separates two elements.
Definition Domaine_VF.h:463
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
Definition Domaine_VF.h:418
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
int nb_front_Cl() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual const Milieu_base & milieu() const =0
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
DoubleVect & porosite_face()
Definition Milieu_base.h:62
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
Neumann_sortie_libre This class represents an open boundary without imposed velocity.
friend class Entree
Definition Objet_U.h:71
static int dimension
Definition Objet_U.h:94
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
class Periodique This class represents a periodic boundary condition.
Definition Periodique.h:31
virtual const Transport_Interfaces_FT_Disc & equation_interfaces(const Motcle &nom) const
class Probleme_base It is a Probleme_U that is not a coupling.
Base class for output streams.
Definition Sortie.h:52
class SourceFiltree_FT_disc_VEF_P1NC la Classe SourceFiltree permet d'ajouter un terme source agissan...
void mettre_a_jour(double temps) override
DOES NOTHING - to override in derived classes.
DoubleTab & calculer(DoubleTab &) const override
Entree & lire(Entree &is)
Lit les parametres du terme source a partir d'un flot d'entree.
void associer_pb(const Probleme_base &) override
void associer_domaines(const Domaine_dis_base &, const Domaine_Cl_dis_base &) override
DoubleTab & ajouter(DoubleTab &) const override
void completer() override
Updates internal references of the Source_base object.
Sortie & ecrire_donnees(Sortie &) const
Entree & lire_donnees(Entree &)
Lit les parametres du terme source a partir d'un flot d'entree.
Source_base A Source_base object is a term appearing on the right-hand side of an.
Definition Source_base.h:42
virtual void completer()
Updates internal references of the Source_base object.
Symetrie On symmetry faces, the following properties hold:
Definition Symetrie.h:37
const Champ_Inc_base & inconnue() const override