TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Source_Reaction_Particules_VDF.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 <Source_Reaction_Particules_VDF.h>
17#include <TRUSTTab.h>
18#include <Transport_Marqueur_FT.h>
19#include <Domaine.h>
20#include <Domaine_VDF.h>
21#include <Champ_implementation_P1.h>
22#include <Dirichlet.h>
23#include <Dirichlet_homogene.h>
24#include <Milieu_base.h>
25#include <MD_Vector_tools.h>
26#include <Probleme_base.h>
27
28Implemente_instanciable(Source_Reaction_Particules_VDF,"Two_Way_Coupling_VDF",Source_Reaction_Particules);
29
31{
32 return os;
33}
34
36{
37 return is;
38}
39
40//-Interpolation de source_stockage_ aux sommets (par ponderation par coordonnes barycentriques)
41//-Dans le cas parallele une sommation aux sommets items communs est faite
42// pour tenir compte des contributions de chaque processeur
43//-Calcul de la source aux faces en sommant la condribution de chacun des sommets de la face
44//Rq : Le terme source est divisee par rho si le milieu n est pas quasi-compressible
45DoubleTab& Source_Reaction_Particules_VDF::ajouter(DoubleTab& resu) const
46{
47 const DoubleTab& source_action = eq_marqueur_->source_stockage();
48 const Domaine_dis_base& zdis = equation().domaine_dis();
49 const Domaine_VDF& zvf = ref_cast(Domaine_VDF,zdis);
51 const Domaine& domaine_geom = zdis.domaine();
52 const DoubleTab& coord = domaine_geom.coord_sommets();
53 const IntTab& sommet_poly = domaine_geom.les_elems();
54 const IntTab& face_som = zvf.face_sommets();
55 const IntVect& orient = zvf.orientation();
56 const Maillage_FT_Disc& maillage = eq_marqueur_->maillage_interface();
57 const DoubleTab& positions = maillage.sommets();
58 const ArrOfInt& som_elem = maillage.sommet_elem();
59 int dim = Objet_U::dimension;
60 int nb_faces = zvf.nb_faces();
61 int premiere_face_interne = zvf.premiere_face_int();
62 int nb_pos = positions.dimension(0);
63 int nb_som_elem = domaine_geom.nb_som_elem();
64 int nb_som_face = domaine_geom.type_elem()->nb_som_face();
65 int is_QC=0;
66 int is_FT=0;
67 double coord_b=0.;
68 double x_pos,y_pos;
69 double z_pos=0.;
70 int elem,som_glob;
71 const int nb_elem_reels = domaine_geom.nb_elem();
72
73 //creation d un espace virtuel pour source_som
74 DoubleTab source_som(0, dim);
75 domaine_geom.creer_tableau_sommets(source_som);
76
77 //is_QC=0 le terme source est homogne a dv/dt sinon homogene a d(rho*v)/dt
78 is_QC = equation().probleme().is_dilatable();
79 if (sub_type(Navier_Stokes_FT_Disc,equation()))
80 is_FT = 1;
81
82 const Champ_base& champ_rho = (is_FT==1?ref_cast(Navier_Stokes_FT_Disc,equation()).champ_rho_faces():equation().milieu().masse_volumique());
83 const DoubleTab& rho_faces = champ_rho.valeurs();
84
85 //Remplissage de source_som (interpolation de source_stockage aux sommets)
86
87 //verifier que 0<=coord_b<=1
88 for (int pos=0; pos<nb_pos; pos++)
89 {
90 x_pos = positions(pos,0);
91 y_pos = positions(pos,1);
92 if (dim==3)
93 z_pos = positions(pos,2);
94
95 elem = som_elem[pos];
96 // On va sommer les contributions de tous les sommets communs,
97 // ne pas traiter les elements virtuels, on aurait plusieurs fois la contribution du meme point
98 if (elem < nb_elem_reels)
99 {
100 for (int som=0; som<nb_som_elem; som++)
101 {
102 som_glob = sommet_poly(elem,som);
103 if (dim==2)
104 coord_b = coord_barycentrique_P1_rectangle(sommet_poly,coord,x_pos,y_pos,elem,som) ;
105 else if (dim==3)
106 coord_b = coord_barycentrique_P1_hexaedre(sommet_poly,coord,x_pos,y_pos,z_pos,elem,som) ;
107 for (int k=0; k<dim; k++)
108 source_som(som_glob,k) -= source_action(pos,k)*coord_b;
109 }
110 }
111 }
112
113 // Sommation des contributions de tous les sommets partages entre plusieurs processeurs,
114 // puis echange espace virtuel.
116 //Remplissage de resu (Interpolation de source_som aux faces)
117
118 //Traitement des conditions limites
119 int num_cl;
120 for (num_cl=0 ; num_cl<zdis.nb_front_Cl() ; num_cl++)
121 {
122 const Cond_lim& la_cl = zcldis.les_conditions_limites(num_cl);
123 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
124 int ndeb = le_bord.num_premiere_face();
125 int nfin = ndeb + le_bord.nb_faces();
126 if (sub_type(Dirichlet,la_cl.valeur()) || sub_type(Dirichlet_homogene,la_cl.valeur()))
127 ;
128 else
129 for (int face=ndeb ; face<nfin ; face++)
130 {
131 int ncomp = orient(face);
132 double rho = 1.;
133 if (!is_QC)
134 rho = (is_FT==1?rho_faces(face):rho_faces(0,0));
135 for (int nbsf=0; nbsf<nb_som_face; nbsf++)
136 {
137 som_glob = face_som(face,nbsf);
138 resu(face) += (1./nb_som_face)*source_som(som_glob,ncomp)/rho;
139 }
140 }
141 }
142
143 //Traitement des faces internes
144 for (int face=premiere_face_interne; face<nb_faces; face++)
145 {
146 int ncomp = orient(face);
147 double rho = 1.;
148 if (!is_QC)
149 rho = (is_FT==1?rho_faces(face):rho_faces(0,0));
150
151 for (int nbsf=0; nbsf<nb_som_face; nbsf++)
152 {
153 som_glob = face_som(face,nbsf);
154 resu(face) += (1./nb_som_face)*source_som(som_glob,ncomp)/rho;
155 }
156 }
157
158 return resu;
159}
virtual DoubleTab & valeurs()=0
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
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
int nb_som_elem() const
Renvoie le nombre de sommets des elements geometriques constituants le domaine.
Definition Domaine.h:474
IntTab_t & les_elems()
Definition Domaine.h:129
int_t nb_elem() const
Definition Domaine.h:131
const DoubleTab_t & coord_sommets() const
Definition Domaine.h:112
virtual void creer_tableau_sommets(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
Cree un tableau ayant une "ligne" par sommet du maillage.
Definition Domaine.cpp:1000
classe Domaine_Cl_dis_base Les objets Domaine_Cl_dis_base representent les conditions aux limites
const Cond_lim & les_conditions_limites(int) const
Renvoie la i-ieme condition aux limites.
class Domaine_VDF
Definition Domaine_VDF.h:64
int orientation(int) const override
inline DoubleVect& Domaine_VDF::porosite_face() {
int nb_faces() const
renvoie le nombre global de faces.
Definition Domaine_VF.h:471
int face_sommets(int i, int j) const
renvoie le numero du ieme sommet de la face num_face.
Definition Domaine_VF.h:583
int premiere_face_int() const
une face est interne ssi elle separe deux elements.
Definition Domaine_VF.h:463
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
int nb_front_Cl() const
const Domaine & domaine() 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
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Renvoie le domaine des conditions aux limite discretisee associee a l'equation.
Probleme_base & probleme()
Renvoie le probleme associe a l'equation.
Domaine_dis_base & domaine_dis()
Renvoie le domaine discretise associe a l'equation.
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
static void echange_espace_virtuel(IntVect &, Operations_echange opt=ECHANGE_EV, IsExchangeBlocking is_exchange_blocking=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")
: class Maillage_FT_Disc Cette classe decrit un maillage:
const DoubleTab & sommets() const
renvoie le tableau des sommets (reels et virtuels) dimension(0) = nombre de sommets,
const ArrOfInt & sommet_elem() const
pour postraitement, renvoie sommet_elem_
virtual const Champ_base & masse_volumique() const
Renvoie la masse volumique du milieu.
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
static int dimension
Definition Objet_U.h:99
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
bool is_dilatable() const
Classe de base des flux de sortie.
Definition Sortie.h:52
Classe Source_Reaction_Particules_VDF.
DoubleTab & ajouter(DoubleTab &) const override
Classe Source_Reaction_Particules Calcul du terme source a ajouter dans Navier_Stokes pour prendre en...
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133