TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Diametre_bulles_constant.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 <Diametre_bulles_constant.h>
17#include <Pb_Multiphase.h>
18
19#include <Discret_Thyd.h>
20#include <Champ_base.h>
21
22Implemente_instanciable(Diametre_bulles_constant, "Diametre_bulles_constant", Correlation_base);
23
24Sortie& Diametre_bulles_constant::printOn(Sortie& os) const { return os; }
25
27{
28 Param param(que_suis_je());
29 param.ajouter("diametre", &d_bulle_, Param::REQUIRED);
30 param.lire_avec_accolades_depuis(is);
31
32 Pb_Multiphase& pb = ref_cast(Pb_Multiphase, pb_.valeur());
33 int N = pb.nb_phases();
34 const Discret_Thyd& dis = ref_cast(Discret_Thyd, pb.discretisation());
35 Noms noms(N), unites(N);
36 noms[0] = "diametre_bulles";
37 unites[0] = "m";
38 Motcle typeChamp = "champ_elem";
39 const Domaine_dis_base& z = pb.domaine_dis();
40 dis.discretiser_champ(typeChamp, z, scalaire, noms, unites, N, 0, diametres_);
41
42 champs_compris_.ajoute_champ(diametres_);
43
44 for (int n = 0; n < pb.nb_phases(); n++) //recherche de n_l, n_g : phase {liquide,gaz}_continu en priorite
45 if (pb.nom_phase(n).debute_par("liquide") && (n_l < 0 || pb.nom_phase(n).finit_par("continu")))
46 n_l = n;
47
48 if (n_l < 0)
49 Process::exit(que_suis_je() + " : liquid phase not found!");
50
51 DoubleTab& tab_diametres = diametres_->valeurs();
52 for (int i = 0; i < tab_diametres.dimension_tot(0); i++)
53 for (int n = 0; n < N; n++)
54 if (n != n_l)
55 tab_diametres(i, n) = d_bulle_;
56
57 return is;
58}
59
61{
62 if (nom == "diametre_bulles")
63 return champs_compris_.has_champ(nom, ref_champ);
64
65 return false; /* rien trouve */
66}
67
69{
70 if (nom == "diametre_bulles")
71 return true;
72
73 return false; /* rien trouve */
74}
75
77{
78 if (nom == "diametre_bulles")
79 return champs_compris_.get_champ(nom);
80
81 throw std::runtime_error(std::string("Field ") + nom.getString() + std::string(" not found !"));
82}
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_constant Contient un champ de bulles de diametre constant
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
const Champ_base & get_champ(const Motcle &nom) 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
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
virtual int finit_par(const char *const n) const
Definition Nom.cpp:324
virtual int debute_par(const char *const n) const
Definition Nom.cpp:319
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
const Nom & nom_phase(int i) const
int nb_phases() const
const Discretisation_base & discretisation() const
Renvoie la discretisation associee 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
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160