TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Source_Portance_interfaciale_base.cpp
1/****************************************************************************
2* Copyright (c) 2026, 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 <Source_Portance_interfaciale_base.h>
17#include <Portance_interfaciale_base.h>
18#include <Pb_Multiphase.h>
19#include <Discret_Thyd.h>
20
21Implemente_base(Source_Portance_interfaciale_base, "Source_Portance_interfaciale_base", Sources_Multiphase_base);
22// XD Portance_interfaciale source_base Portance_interfaciale BRACE Base class for source term of lift force in momentum
23// XD_CONT equation.
24// XD attr beta floattant beta OPT Multiplying factor for the bubble lift force source term.
25
27
29{
30 Param param(que_suis_je());
31 param.ajouter("beta", &beta_);
32 param.ajouter("g", &g_);
33 param.lire_avec_accolades_depuis(is);
34
35 Pb_Multiphase *pbm = sub_type(Pb_Multiphase, equation().probleme()) ? &ref_cast(Pb_Multiphase, equation().probleme()) : nullptr;
36
37 if (!pbm || pbm->nb_phases() == 1) Process::exit(que_suis_je() + " : not needed for single-phase flow!");
38
39 const bool res_en_T = pbm ? pbm->resolution_en_T() : true;
40 if (!res_en_T) Process::exit("Source_Portance_interfaciale_base::readOn NOT YET PORTED TO ENTHALPY EQUATION ! TODO FIXME !!");
41
42 for (int n = 0; n < pbm->nb_phases(); n++) // search for n_l, n_g: {liquid,gas}_continuous phase in priority
43 if (pbm->nom_phase(n).debute_par("liquide") && (n_l < 0 || pbm->nom_phase(n).finit_par("continu"))) n_l = n;
44
45 if (n_l < 0) Process::exit(que_suis_je() + " : liquid phase not found!");
46
47 if (pbm->has_correlation("Portance_interfaciale")) correlation_ = pbm->get_correlation("Portance_interfaciale"); // correlation provided by the correlation block
48 else Correlation_base::typer_lire_correlation(correlation_, (*pbm), "Portance_interfaciale", is); // otherwise read it
49
50 pbm->creer_champ("vorticite"); // vorticity is needed
51
52 return is;
53}
54
56{
57 if (motlu == "wobble")
58 if (!wobble)
59 {
60 Pb_Multiphase& pb = ref_cast(Pb_Multiphase, equation().probleme());
61 int N = pb.nb_phases();
62 const Discret_Thyd& dis=ref_cast(Discret_Thyd,pb.discretisation());
63 Noms noms(N), unites(N);
64 noms[0] = "wobble";
65 unites[0] = "none";
66 Motcle typeChamp = "champ_elem" ;
67 const Domaine_dis_base& z = pb.domaine_dis();
68 dis.discretiser_champ(typeChamp, z, scalaire, noms , unites, N, 0, wobble);
69 champs_compris_.ajoute_champ(wobble);
70 }
71 if (motlu == "C_lift")
72 if (!C_lift)
73 {
74 Pb_Multiphase& pb = ref_cast(Pb_Multiphase, equation().probleme());
75 int N = pb.nb_phases();
76 const Discret_Thyd& dis=ref_cast(Discret_Thyd,pb.discretisation());
77 Noms noms(N), unites(N);
78 noms[0] = "C_lift";
79 unites[0] = "none";
80 Motcle typeChamp = "champ_elem" ;
81 const Domaine_dis_base& z = pb.domaine_dis();
82 dis.discretiser_champ(typeChamp, z, scalaire, noms , unites, N, 0, C_lift);
83 champs_compris_.ajoute_champ(C_lift);
84 }
85}
86
88{
89 if (wobble && !equation().probleme().has_champ("diametre_bulles")) Process::exit(que_suis_je() + " : there must be a bubble diameter field for there to be a wobble number !!") ;
90 if (wobble && !equation().probleme().has_champ("k")) Process::exit(que_suis_je() + " : there must be a turbulent kinetic energy field for there to be a wobble number !!") ;
91}
static void typer_lire_correlation(OWN_PTR(Correlation_base)&, const Probleme_base &, const Nom &, Entree &)
class Discret_Thyd This class is the base class representing a discretization
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 Domaine_dis_base This class is the base of the hierarchy of discretized domains.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
A character string (Nom) in uppercase.
Definition Motcle.h:26
virtual int debute_par(const char *const n) const
Definition Nom.cpp:314
An array of character strings (VECT(Nom)).
Definition Noms.h:26
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
Multiphase thermohydraulics problem of type "3*N equations":
virtual bool resolution_en_T() const
const Nom & nom_phase(int i) const
int nb_phases() const
void creer_champ(const Motcle &motlu) override
const Discretisation_base & discretisation() const
Returns the discretization associated with the problem.
int has_correlation(std::string nom_correlation) const
const Correlation_base & get_correlation(std::string nom_correlation) const
const Domaine_dis_base & domaine_dis() const
Returns the discretized domain associated with the problem (const version).
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52
Interfacial lift force source term of the form:
void completer() override
Updates internal references of the Source_base object.
Champs_compris champs_compris_
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override