TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
EDO_Pression_th_VDF.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 <Loi_Etat_Multi_GP_WC.h>
17#include <Loi_Etat_Multi_GP_QC.h>
18#include <EDO_Pression_th_VDF.h>
19#include <Domaine_VDF.h>
20
21Implemente_base(EDO_Pression_th_VDF, "EDO_Pression_th_VDF", EDO_Pression_th_base);
22
24
26
27/*! @brief Renvoie la valeur de la pression calculee pour conserver la masse
28 *
29 * @return (Double) pression calculee
30 */
31double EDO_Pression_th_VDF::masse_totale(double P, const DoubleTab& T)
32{
33 ToDo_Kokkos("critical");
34 int elem, nb_elem = le_dom->nb_elem();
35 const DoubleVect& volumes = le_dom->volumes();
36 const Loi_Etat_base& loi_ = ref_cast(Loi_Etat_base, le_fluide_->loi_etat().valeur());
37 double M = 0.;
38 if (!sub_type(Loi_Etat_Multi_GP_QC, loi_))
39 {
40 for (elem = 0; elem < nb_elem; elem++)
41 {
42 double v = volumes(elem);
43 M += v * loi_.calculer_masse_volumique(P, T[elem]);
44 }
45 }
46 else
47 {
48 const Loi_Etat_Multi_GP_QC& loi_mel_GP = ref_cast(Loi_Etat_Multi_GP_QC, loi_);
49 const DoubleTab& Masse_mol_mel = loi_mel_GP.masse_molaire();
50
51 for (elem = 0; elem < nb_elem; elem++)
52 {
53 double v = volumes(elem);
54 double r = 8.3143 / Masse_mol_mel(elem);
55 M += v * loi_mel_GP.calculer_masse_volumique(P, T[elem], r);
56 }
57 }
58 M = Process::mp_sum(M);
59 return M;
60}
61
62double EDO_Pression_th_VDF::masse_totale(const DoubleTab& P, const DoubleTab& T)
63{
64 ToDo_Kokkos("critical");
65 int elem, nb_elem = le_dom->nb_elem();
66 const DoubleVect& volumes = le_dom->volumes();
67 const Loi_Etat_base& loi_ = ref_cast(Loi_Etat_base, le_fluide_->loi_etat().valeur());
68 double M = 0.;
69 if (!sub_type(Loi_Etat_Multi_GP_WC, loi_))
70 {
71 for (elem = 0; elem < nb_elem; elem++)
72 {
73 double v = volumes(elem);
74 M += v * loi_.calculer_masse_volumique(P(elem), T(elem));
75 }
76 }
77 else
78 {
79 const Loi_Etat_Multi_GP_WC& loi_mel_GP = ref_cast(Loi_Etat_Multi_GP_WC, loi_);
80 const DoubleTab& Masse_mol_mel = loi_mel_GP.masse_molaire();
81
82 for (elem = 0; elem < nb_elem; elem++)
83 {
84 double v = volumes(elem);
85 double r = 8.3143 / Masse_mol_mel(elem);
86 M += v * loi_mel_GP.calculer_masse_volumique(P(elem), T(elem), r);
87 }
88 }
89 M = Process::mp_sum(M);
90 return M;
91}
92
93void EDO_Pression_th_VDF::calculer_grad(const DoubleTab& inco, DoubleTab& resu)
94{
95 int face, n0, n1, ori;
96 double coef;
97 const Domaine_VDF& dom = ref_cast(Domaine_VDF, le_dom.valeur());
98
99 const IntTab& face_voisins = dom.face_voisins();
100 const IntVect& orientation = dom.orientation();
101 const DoubleVect& porosite_surf = le_fluide_->porosite_face();
102 const DoubleTab& xp = dom.xp();
103 const DoubleVect& volume_entrelaces = le_dom->volumes_entrelaces();
104
105 // Boucle sur les faces internes
106 ToDo_Kokkos("critical");
107 for (face = dom.premiere_face_int(); face < dom.nb_faces(); face++)
108 {
109 n0 = face_voisins(face, 0);
110 n1 = face_voisins(face, 1);
111 ori = orientation(face);
112 coef = volume_entrelaces(face) * porosite_surf(face);
113 coef = 1;
114 resu(face) += coef * (inco(n1) - inco(n0)) / (xp(n1, ori) - xp(n0, ori));
115 }
116}
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
double xp(int num_elem, int k) const
Definition Domaine_VF.h:77
int premiere_face_int() const
une face est interne ssi elle separe deux elements.
Definition Domaine_VF.h:463
int face_voisins(int num_face, int i) const
renvoie l'element voisin de numface dans la direction i.
Definition Domaine_VF.h:418
classe EDO_Pression_th_VDF Cette classe represente l'EDO sur la pression associee au schema de
void calculer_grad(const DoubleTab &, DoubleTab &)
double masse_totale(double P, const DoubleTab &T) override
Renvoie la valeur de la pression calculee pour conserver la masse.
classe EDO_Pression_th_base Cette classe est la base de la hierarchie des EDO sur la pression
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Loi_Etat_Multi_GP_QC Cette classe represente la loi d'etat pour un melange de gaz parfaits.
void calculer_masse_volumique() override
Recalcule la masse volumique.
classe Loi_Etat_Multi_GP_WC Cette classe represente la loi d'etat pour un melange de gaz parfaits.
void calculer_masse_volumique() override
Recalcule la masse volumique.
const DoubleTab & masse_molaire() const
classe Loi_Etat_base Cette classe est la base de la hierarchie des lois d'etat.
virtual void calculer_masse_volumique()
Recalcule la masse volumique.
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
static double mp_sum(double)
Calcule la somme de x sur tous les processeurs du groupe courant.
Definition Process.cpp:146
Classe de base des flux de sortie.
Definition Sortie.h:52