TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Diametre_bulles_musig.cpp
1/****************************************************************************
2* Copyright (c) 2025, 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 <Diametre_bulles_musig.h>
17#include <Pb_Multiphase.h>
18
19#include <Discret_Thyd.h>
20#include <Champ_base.h>
21#include <Milieu_MUSIG.h>
22
23Implemente_instanciable(Diametre_bulles_musig, "Diametre_bulles_musig", Correlation_base);
24
25Sortie& Diametre_bulles_musig::printOn(Sortie& os) const { return os; }
26
28{
29 Param param(que_suis_je());
30 param.ajouter("diametre", &d_bulle_, Param::REQUIRED);
31 param.lire_avec_accolades_depuis(is);
32
33 Pb_Multiphase& pb = ref_cast(Pb_Multiphase, pb_.valeur());
34 const Milieu_MUSIG *milMusig = sub_type(Milieu_MUSIG, pb.milieu()) ? &ref_cast(Milieu_MUSIG, pb.milieu()) : nullptr;
35 if (!milMusig) Process::exit(que_suis_je() + " : MUSIG not found !");
36
37 int N = pb.nb_phases();
38 const Discret_Thyd& dis = ref_cast(Discret_Thyd, pb.discretisation());
39 Noms noms(N), unites(N);
40 noms[0] = "diametre_bulles";
41 unites[0] = "m";
42 Motcle typeChamp = "champ_elem";
43 const Domaine_dis_base& z = pb.domaine_dis();
44 dis.discretiser_champ(typeChamp, z, scalaire, noms, unites, N, 0, diametres_);
45
46 champs_compris_.ajoute_champ(diametres_);
47
48 // Print information regarding diameters of the MUSIG method (dispersed phase)
49 // Not mandatory but enable to verify diameter values
51 {
52 for (int k = 0; k < N; k++)
53 {
54 if (milMusig->has_dispersed_gas(k)) cout << " Gaz_Dispersee - Classe N° " << k << " diametre Inf=" << milMusig->get_Diameter_Inf(k) << " diametre Sup=" << milMusig->get_Diameter_Sup(k) << " diametre Sauter=" << milMusig->get_Diameter_Sauter(k) << endl;
55 if (milMusig->has_dispersed_liquid(k)) cout << " Liquide_Dispersee - Classe N° " << k << " diametre Inf=" << milMusig->get_Diameter_Inf(k) << " diametre Sup=" << milMusig->get_Diameter_Sup(k) << " diametre Sauter=" << milMusig->get_Diameter_Sauter(k) << endl;
56 }
57 }
58 // Store diameters of Sauter (dispersed phase)
59 DoubleTab& tab_diametres = diametres_->valeurs();
60 for (int i = 0; i < tab_diametres.dimension_tot(0); i++)
61 for (int k = 0; k < N; k++)
62 {
63 tab_diametres(i, k) = d_bulle_;
64 if (milMusig->has_dispersed_gas(k)) tab_diametres(i, k) = milMusig->get_Diameter_Sauter(k);
65 if (milMusig->has_dispersed_liquid(k)) tab_diametres(i, k) = milMusig->get_Diameter_Sauter(k);
66 }
67
68 return is;
69}
70
71bool Diametre_bulles_musig::has_champ(const Motcle& nom, OBS_PTR(Champ_base) &ref_champ) const
72{
73 if (nom == "diametre_bulles")
74 return champs_compris_.has_champ(nom, ref_champ);
75
76 return false; /* nothing found */
77}
78
80{
81 if (nom == "diametre_bulles")
82 return true;
83
84 return false; /* nothing found */
85}
86
88{
89 if (nom == "diametre_bulles")
90 return champs_compris_.get_champ(nom);
91
92 throw std::runtime_error(std::string("Field ") + nom.getString() + std::string(" not found !"));
93}
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
Champs_compris champs_compris_
OBS_PTR(Probleme_base) pb_
classe Diametre_bulles_musig Contains the Sauter diameters of the bubble/droplet field (dispersed pha...
const Champ_base & get_champ(const Motcle &nom) const override
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
void discretiser_champ(const Motcle &directive, const Domaine_dis_base &z, const Nom &nom, const Nom &unite, int nb_comp, int nb_pas_dt, double temps, OWN_PTR(Champ_Inc_base)&champ, const Nom &sous_type=NOM_VIDE) const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
double get_Diameter_Sup(int iPhaseMilieu) const
bool has_dispersed_gas(int k) const
double get_Diameter_Inf(int iPhaseMilieu) const
bool has_dispersed_liquid(int k) const
double get_Diameter_Sauter(int iPhaseMilieu) const
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
const std::string & getString() const
Definition Nom.h:92
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
@ REQUIRED
Definition Param.h:115
int nb_phases() const
const Discretisation_base & discretisation() const
Renvoie la discretisation associee au probleme.
virtual const Milieu_base & milieu() const
Renvoie le milieu physique associe au probleme.
const Domaine_dis_base & domaine_dis() const
Renvoie le domaine discretise associe au probleme.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
Definition Process.cpp:86
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160