TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Production_WIT_PolyMAC_MPFA.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 <Production_WIT_PolyMAC_MPFA.h>
17
18#include <Domaine_PolyMAC_MPFA.h>
19#include <Sources_helpers_Multiphase.h>
20
21
22Implemente_instanciable(Production_WIT_PolyMAC_MPFA,"Production_WIT_Elem_PolyMAC_MPFA", Source_base);
23
25{
26 return os;
27}
28
30{
31 Param param(que_suis_je());
32 param.ajouter("Reb_c", &Reb_c_);
33 param.ajouter("constante_gravitation", &g_);
34 param.lire_avec_accolades_depuis(is);
35
36 n_l_ = find_liquid_phase(ref_cast(Pb_Multiphase, equation().probleme()), que_suis_je());
37
38 return is;
39}
40
41void Production_WIT_PolyMAC_MPFA::dimensionner_blocs(matrices_t matrices, const tabs_t& semi_impl) const
42{
43// empty : no derivative to add in the blocks
44}
45
46void Production_WIT_PolyMAC_MPFA::ajouter_blocs(matrices_t matrices, DoubleTab& secmem, const tabs_t& semi_impl) const
47{
48 const Domaine_PolyMAC_MPFA& domaine = ref_cast(Domaine_PolyMAC_MPFA, equation().domaine_dis());
49 const DoubleTab& tab_rho = equation().probleme().get_champ("masse_volumique").passe();
50 const DoubleTab& tab_alp = equation().probleme().get_champ("alpha").passe();
51 const DoubleTab& vit = equation().probleme().get_champ("vitesse").passe();
52 const DoubleTab& diam = equation().probleme().get_champ("diametre_bulles").valeurs();
53 const DoubleTab& nu = equation().probleme().get_champ("viscosite_cinematique").passe();
54
55 const DoubleVect& pe = equation().milieu().porosite_elem();
56 const DoubleVect& ve = domaine.volumes();
57
58 const int Nk = equation().inconnue().valeurs().dimension(1);
59 const int N = ref_cast(Pb_Multiphase, equation().probleme()).nb_phases();
60 const int ne = domaine.nb_elem();
61 const int nf_tot = domaine.nb_faces_tot();
62 const int D = dimension;
63
64 if (Nk != 1)
65 Process::exit("WIT is only in the liquid phase");
66
67 if (D != 3)
68 Process::exit("WIT is only coded for 3 dimensions");
69
70 for(int e = 0 ; e < ne ; e++)
71 for (int k = 0 ; k < N ; k++)
72 if (k != n_l_)
73 {
74 const double u_r = relative_velocity_norm(vit, nf_tot, D, e, k, n_l_);
75 const double Reb = diam(e, k) * u_r / nu(e, n_l_);
76 secmem(e, 0) += ve(e) * pe(e) * tab_alp(e, k) * (tab_rho(e, n_l_) - tab_rho(e, k)) / tab_rho(e, n_l_) * g_ * u_r * (0.9 - exp(-Reb / Reb_c_));
77 }
78}
DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ au temps courant.
virtual DoubleTab & valeurs()=0
virtual DoubleTab & passe(int i=1)
Definition Champ_Proto.h:50
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 const Champ_Inc_base & inconnue() const =0
Probleme_base & probleme()
Renvoie le probleme associe a l'equation.
DoubleVect & porosite_elem()
Definition Milieu_base.h:58
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
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 Pb_Multiphase Cette classe represente un probleme de thermohydraulique multiphase de type "3*N...
const Champ_base & get_champ(const Motcle &nom) const override
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe Production_WIT_PolyMAC_MPFA Cette classe implemente dans PolyMAC_MPFA la production de l'equat...
void dimensionner_blocs(matrices_t matrices, const tabs_t &semi_impl={}) const override
void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={}) const override
Classe de base des flux de sortie.
Definition Sortie.h:52
classe Source_base Un objet Source_base est un terme apparaissant au second membre d'une
Definition Source_base.h:42
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133