TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Nucleation_paroi_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 <Nucleation_paroi_PolyMAC_MPFA.h>
17#include <Pb_Multiphase.h>
18#include <Champ_Elem_PolyMAC_MPFA.h>
19#include <Op_Diff_PolyMAC_MPFA_Elem.h>
20#include <Milieu_composite.h>
21#include <Flux_parietal_base.h>
22#include <Flux_interfacial_PolyMAC_HFV.h>
23#include <Matrix_tools.h>
24#include <Array_tools.h>
25#include <math.h>
26#include <Sources.h>
27#include <Flux_interfacial_PolyMAC_HFV.h>
28#include <Domaine_PolyMAC_MPFA.h>
29
30Implemente_instanciable(Nucleation_paroi_PolyMAC_MPFA, "Nucleation_paroi_Elem_PolyMAC_MPFA", Source_base);
31
33{
34 return os;
35}
36
38{
39 Pb_Multiphase *pbm = sub_type(Pb_Multiphase, equation().probleme()) ? &ref_cast(Pb_Multiphase, equation().probleme()) : nullptr;
40
41 if (!pbm || pbm->nb_phases() == 1)
42 Process::exit(que_suis_je() + " : not needed for single-phase flow!");
43
44 for (int n = 0; n < pbm->nb_phases(); n++) //recherche de n_l, n_g : phase {liquide,gaz}_continu en priorite
45 if (pbm->nom_phase(n).debute_par("liquide")
46 && (n_l < 0 || pbm->nom_phase(n).finit_par("continu")))
47 n_l = n;
48
49 if (n_l < 0)
50 Process::exit(que_suis_je() + " : liquid phase not found!");
51
52 if (n_l != 0)
53 Process::exit(que_suis_je() + " : liquid phase must be the first declared phase !");
54
55 if (!pbm->has_correlation("flux_parietal"))
56 Process::exit("Nucleation_paroi_PolyMAC_MPFA : wall heat flux correlation needed !");
57
58 if (!pbm->has_correlation("flux_parietal")) Process::exit("Nucleation_paroi_PolyMAC_MPFA : wall heat flux correlation needed !");
59 const Flux_parietal_base& correlation_fp = ref_cast(Flux_parietal_base, pbm->get_correlation("flux_parietal"));
60
61 if (!correlation_fp.calculates_bubble_nucleation_diameter())
62 Process::exit("Nucleation_paroi_PolyMAC_MPFA : wall heat flux correlation must calculate the nucleated bubble diameter !");
63
64 const Sources& les_sources_loc = pbm->equation(2).sources();
65 for (int j = 0 ; j<les_sources_loc.size(); j++)
66 if (sub_type(Flux_interfacial_PolyMAC_HFV, les_sources_loc(j).valeur()))
67 src_flux_interfacial_ = les_sources_loc(j).valeur();
68
69 if (!src_flux_interfacial_)
70 Process::exit(que_suis_je() + " : there must be an interfacial flux source for nucleation to be possible !");
71
72 return is;
73}
74
75void Nucleation_paroi_PolyMAC_MPFA::dimensionner_blocs(matrices_t matrices, const tabs_t& semi_impl) const // 100% explicit for now
76{
77}
78
79void Nucleation_paroi_PolyMAC_MPFA::ajouter_blocs(matrices_t matrices, DoubleTab& secmem, const tabs_t& semi_impl) const
80{
81 const Pb_Multiphase& pbm = ref_cast(Pb_Multiphase, equation().probleme());
82 const Domaine_PolyMAC_MPFA& domaine = ref_cast(Domaine_PolyMAC_MPFA, equation().domaine_dis());
83 const IntTab& f_e = domaine.face_voisins();
84
85 const DoubleTab& rho = pbm.milieu().masse_volumique().passe();
86 const DoubleTab& press = ref_cast(QDM_Multiphase, pbm.equation_qdm()).pression().passe();
87 const DoubleTab& qpi = ref_cast(Flux_interfacial_PolyMAC_HFV, src_flux_interfacial_.valeur()).qpi();
88 const DoubleTab& dnuc = ref_cast(Op_Diff_PolyMAC_MPFA_Elem, pbm.equation(2).operateur(0).l_op_base()).d_nucleation();
89
90 const int N = pbm.nb_phases();
91 const int Np = pbm.get_champ("pression").valeurs().line_size();
92
93 const Milieu_composite& milc = ref_cast(Milieu_composite, pbm.milieu());
94
95 /* elements */
96 for (int f = 0; f < domaine.premiere_face_int(); f++) // We inject only in first element
97 for (int k = 0, mp = 0 ; k < N ; k++, mp += (Np > 1))
98 if (k != n_l)
99 if (milc.has_saturation(n_l, k)) // vapor phase
100 {
101 Saturation_base& sat = milc.get_saturation(n_l, k);
102 int e = f_e(f, 0);
103 secmem(e , k) += 6. * qpi(e, n_l, k) / (std::max(dnuc(e,k), 1.e-8) * rho(e, k) * sat.Lvap(press(e, mp)));
104 }
105}
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
Sources & sources()
Renvoie les termes sources asssocies a l'equation.
virtual const Operateur & operateur(int) const =0
virtual int calculates_bubble_nucleation_diameter() const
virtual const Champ_base & masse_volumique() const
Renvoie la masse volumique du milieu.
Classe Milieu_composite Cette classe represente un fluide reel ainsi que.
bool has_saturation(int k, int l) const
Saturation_base & get_saturation(int k, int l) const
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
virtual int debute_par(const char *const n) const
Definition Nom.cpp:319
classe Nucleation_paroi_PolyMAC_MPFA forme pi * d_nuc**2 * N_nuc Terme source d'aire interfaciale
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
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
virtual Operateur_base & l_op_base()=0
classe Pb_Multiphase Cette classe represente un probleme de thermohydraulique multiphase de type "3*N...
virtual Equation_base & equation_qdm()
const Nom & nom_phase(int i) const
const Equation_base & equation(int) const override
Renvoie l'equation d'hydraulique de type Navier_Stokes_std si i=0 Renvoie l'equation de la thermique ...
int nb_phases() const
const Champ_base & get_champ(const Motcle &nom) const override
int has_correlation(std::string nom_correlation) const
const Correlation_base & get_correlation(std::string nom_correlation) const
virtual const Milieu_base & milieu() const
Renvoie le milieu physique associe au probleme.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
classe QDM_Multiphase Cette classe porte les termes de l'equation de la dynamique
void Lvap(const SpanD P, SpanD res, int ncomp=1, int ind=0) const
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
int line_size() const
Definition TRUSTVect.tpp:67