TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Force_Centrifuge_VDF_Face_Axi.cpp
1/****************************************************************************
2* Copyright (c) 2024, 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 <Force_Centrifuge_VDF_Face_Axi.h>
17#include <Domaine_VDF.h>
18#include <Domaine_Cl_VDF.h>
19#include <Champ_Face_VDF.h>
20#include <Neumann_sortie_libre.h>
21#include <Dirichlet.h>
22#include <Dirichlet_homogene.h>
23#include <Symetrie.h>
24#include <TRUSTTrav.h>
25#include <Equation_base.h>
26#include <Milieu_base.h>
27
28
29Implemente_instanciable(Force_Centrifuge_VDF_Face_Axi,"Force_Centrifuge_VDF_Face_Axi",Source_base);
30
31//// printOn
32//
33
35{
36 return s << que_suis_je() ;
37}
38
39//// readOn
40//
41
43{
44 return s ;
45}
46
47
48/////////////////////////////////////////////////////////////////////
49//
50// Implementation of functions
51//
52// of the Force_Centrifuge_VDF_Face_Axi class
53//
54////////////////////////////////////////////////////////////////////
55
57{
58 Cerr << "Force_Centrifuge_VDF_Face_Axi::associer_pb" << finl;
59}
60
62 const Domaine_Cl_dis_base& domaine_Cl_dis)
63{
64 const Domaine_VDF& zvdf = ref_cast(Domaine_VDF, domaine_dis);
65 const Domaine_Cl_VDF& zclvdf = ref_cast(Domaine_Cl_VDF, domaine_Cl_dis);
66 le_dom_VDF = zvdf;
67 le_dom_Cl_VDF = zclvdf;
68 elem_faces.ref(zvdf.elem_faces());
69 orientation.ref(zvdf.orientation());
70 xp.ref(zvdf.xp());
71 xv.ref(zvdf.xv());
73 porosite_surf.ref(le_dom_Cl_VDF->equation().milieu().porosite_face());
74}
75
76void Force_Centrifuge_VDF_Face_Axi::ajouter_blocs(matrices_t matrices, DoubleTab& secmem, const tabs_t& semi_impl) const
77{
78 const Domaine_VDF& zvdf = le_dom_VDF.valeur();
79 const Domaine_Cl_VDF& zclvdf = le_dom_Cl_VDF.valeur();
80 const DoubleTab& vitesse = la_vitesse->valeurs();
81
82 int nb_elem = zvdf.nb_elem();
83 int nb_faces = zvdf.nb_faces();
84 DoubleTrav vit_sum(nb_faces);
85 vit_sum =0;
86 double U,V,coef;
87 int fac0,fac1,fac2,fac3;
88
89 // Loop over elements to compute vit_sum
90
91 for (int num_elem=0; num_elem<nb_elem; num_elem++)
92 {
93 fac0 = elem_faces(num_elem,0);
94 fac1 = elem_faces(num_elem,1);
95 fac2 = elem_faces(num_elem,dimension);
96 fac3 = elem_faces(num_elem,1+dimension);
97
98 V = 0.5*(vitesse(fac1)+vitesse(fac3));
99 U = 0.5*(vitesse(fac0)+vitesse(fac2));
100
101 vit_sum(fac0) += 0.5*(V*V);
102 vit_sum(fac2) += 0.5*(V*V);
103
104 vit_sum(fac1) += 0.5*(U*V);
105 vit_sum(fac3) += 0.5*(U*V);
106 }
107
108 // Loop over boundary conditions to process boundary faces
109
110 int ndeb,nfin,ori,num_face;
111
112 for (int n_bord=0; n_bord<zvdf.nb_front_Cl(); n_bord++)
113 {
114
115 // for each boundary condition, check its type
116 // If Dirichlet or Symmetry face, do nothing
117 // If Neumann face, compute the contribution to the source term
118
119 const Cond_lim& la_cl = zclvdf.les_conditions_limites(n_bord);
120
121 if (sub_type(Neumann_sortie_libre,la_cl.valeur()))
122 {
123 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
124 ndeb = le_bord.num_premiere_face();
125 nfin = ndeb + le_bord.nb_faces();
126
127 for (num_face=ndeb; num_face<nfin; num_face++)
128 {
129 ori = orientation(num_face);
130 if (ori == 0)
131 {
132 coef = volume_entrelaces(num_face)*porosite_surf(num_face)/xv(num_face,0);
133 secmem(num_face) += 0.5*(vit_sum(num_face)*coef);
134 }
135 else if (ori == 1)
136 {
137 coef = volume_entrelaces(num_face)*porosite_surf(num_face)/xv(num_face,0);
138 secmem(num_face) -= 0.5*(vit_sum(num_face)*coef);
139 }
140 }
141 }
142 else if (sub_type(Symetrie,la_cl.valeur()))
143 { /* Do nothing */}
144 else if ((sub_type(Dirichlet, la_cl.valeur())) || (sub_type(Dirichlet_homogene, la_cl.valeur())))
145 { /* Do nothing */}
146 }
147
148 // Loop over internal faces
149
150 ndeb = zvdf.premiere_face_int();
151 nfin = zvdf.nb_faces();
152
153 for (num_face=ndeb; num_face<nfin; num_face++)
154 {
155 ori = orientation(num_face);
156 if (ori == 0)
157 {
158 coef = volume_entrelaces(num_face)*porosite_surf(num_face)/xv(num_face,0);
159 secmem(num_face) += 0.5*(vit_sum(num_face)*coef);
160 }
161 else if (ori == 1)
162 {
163 coef = volume_entrelaces(num_face)*porosite_surf(num_face)/xv(num_face,0);
164 secmem(num_face) -= 0.5*(vit_sum(num_face)*coef);
165 }
166 }
167}
168
169DoubleTab& Force_Centrifuge_VDF_Face_Axi::calculer(DoubleTab& resu) const
170{
171 resu=0;
172 ajouter(resu);
173 return resu;
174}
175
177{
179 la_vitesse = ref_cast(Champ_Face_VDF,equation().inconnue());
180
181}
182
183
184
class Champ_Face_VDF
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_VDF
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_VDF
Definition Domaine_VDF.h:61
int orientation(int) const override
inline DoubleVect& Domaine_VDF::porosite_face() {
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 elem_faces(int i, int j) const
Returns the index of the i-th face of element num_elem; the face numbering convention is.
Definition Domaine_VF.h:542
double xp(int num_elem, int k) const
Definition Domaine_VF.h:77
int premiere_face_int() const
A face is internal if and only if it separates two elements.
Definition Domaine_VF.h:463
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
class Force_Centrifuge_VDF_Face_Axi
void completer() override
Updates internal references of the Source_base object.
void associer_domaines(const Domaine_dis_base &, const Domaine_Cl_dis_base &) override
void associer_pb(const Probleme_base &) override
void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl) const override
DoubleTab & calculer(DoubleTab &) const override
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 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.
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 Probleme_base It is a Probleme_U that is not a coupling.
Base class for output streams.
Definition Sortie.h:52
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.
virtual DoubleTab & ajouter(DoubleTab &) const
Symetrie On symmetry faces, the following properties hold:
Definition Symetrie.h:37