16#include <EcritureLectureSpecial.h>
17#include <Pb_Multiphase_HEM.h>
18#include <Masse_Multiphase.h>
19#include <Champ_Uniforme.h>
20#include <Matrice_Morse.h>
21#include <Discret_Thyd.h>
22#include <Fluide_base.h>
23#include <Domaine_VF.h>
44 terme_convectif.set_description((Nom)
"Mass flow rate=Integral(-alpha*rho*u*ndS) [kg/s] if SI units used");
50 if (sub_type(Pb_Multiphase_HEM,
probleme()))
52 bool check_source_FICC =
false;
54 for (
int ii = 0; ii <
sources().size(); ii++)
56 check_source_FICC =
true;
58 if (!check_source_FICC)
60 EChaine source_FI(
"{ flux_interfacial }");
73 param.
ajouter_condition(
"is_read_convection",
"The convection operator must be read, select negligeable type if you want to neglect it.");
87 Cerr <<
"Masse_Multiphase : wrong operator number " << i << finl;
97 Cerr <<
"Masse_Multiphase : wrong operator number " << i << finl;
154 Op_Grad_.l_op_base().associer_eqn(*
this);
157 Op_Grad_->associer(zdis, zcl, inco);
160 verifier_somme_alpha();
163void Masse_Multiphase::verifier_somme_alpha()
165 const DoubleTab& vals = l_inco_ch_->valeurs();
167 DoubleVect vals_somme(ne);
170 for (
int i = 0; i < ne; i++)
171 for (
int j = 0; j < nl; j++)
172 vals_somme(i) += vals(i, j);
174 const double min_a = mp_min_vect(vals_somme), max_a = mp_max_vect(vals_somme);
176 if (min_a < 1. - 1.e-12 || max_a > 1. + 1.e-12)
178 Cerr <<
"WHAT ?? The sum of the void fraction (per cell) is not 1 !!!! You should do something !" << finl;
191 Cerr <<
"Volume fraction discretization" << finl;
197 l_inco_ch_->fixer_nom_compo(i,
Nom(
"alpha_") + pb.
nom_phase(i));
201 Cerr <<
"Masse_Multiphase::discretiser() ok" << finl;
238 Cerr <<
"You forgot to associate the fluid to the problem named " <<
probleme().
le_nom() << finl;
241 return le_fluide_.valeur();
253 return le_fluide_.valeur();
264 static Motcle domaine =
"Fraction_volumique";
285 const DoubleTab& alpha = ch_alpha.
valeurs(),
293 for (
int i = 0; i < nl; i++)
294 for (
int n = 0; n < N; n++)
295 val(i, n) = alpha(i, n) * rho(!cR * i, n);
305 DoubleTab& d_a = deriv[
"alpha"];
308 for (
int i = 0; i < nl; i++)
309 for (
int n = 0; n < N; n++)
310 d_a(i, n) = rho(!cR * i, n);
313 for (
auto &&d_c : pch_rho->derivees())
315 DoubleTab& der = deriv[d_c.first];
318 for (
int i = 0; i < nl; i++)
319 for (
int n = 0; n < N; n++)
320 der(i, n) = d_c.second(i, n) * alpha(i, n);
330 const DoubleTab& alpha = ch_alpha.
valeurs(), &rho = ch_rho.
valeurs();
336 for (
int i = 0; i < nl; i++)
337 for (
int n = 0; n < N; n++)
350 for (
int i = 0; i < n2; i++)
351 for (
int n = 0; n < N; n++)
354 tab_multiply_any_shape(bval, calpha, VECT_ALL_ITEMS);
357 DoubleTab& d_a = deriv[
"alpha"];
360 for (
int i = 0; i < nl; i++)
361 for (
int n = 0; n < N; n++)
362 d_a(i, n) = rho(!cR * i, n);
365 for (
auto &&d_c : pch_rho->derivees())
367 DoubleTab& der = deriv[d_c.first];
370 for (
int i = 0; i < nl; i++)
371 for (
int n = 0; n < N; n++)
372 der(i, n) = d_c.second(i, n) * alpha(i, n);
388 champ_convecte_->associer_eqn(*
this);
390 champ_convecte_->nommer(nom_fonc.first);
391 champ_convecte_->init_champ_calcule(*
this, nom_fonc.second);
virtual int nb_valeurs_temporelles() const
Returns the number of temporal values currently kept.
DoubleTab & valeurs() override
Returns the array of field values at the current time.
DoubleTab valeur_aux_bords() const override
Returns the field value at the boundary faces.
virtual DoubleTab & valeurs()=0
class Champ_base This class is the base of the fields hierarchy.
virtual int a_un_domaine_dis_base() const
virtual DoubleTab valeur_aux_bords() const
Returns the field value at the boundary faces.
virtual DoubleTab & valeur_aux(const DoubleTab &positions, DoubleTab &valeurs) const
Causes an error! Must be overridden by derived classes.
Convection_Diffusion_std This class is the base for equations modelling the transport.
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
Operateur_Conv terme_convectif
class Discret_Thyd This class is the base class representing a discretization
static void creer_champ(OWN_PTR(Champ_Inc_base)&ch, const Domaine_dis_base &z, const Nom &type, const Nom &nom, const Nom &unite, int nb_comp, int nb_ddl, int nb_pas_dt, double temps, const Nom &directive=NOM_VIDE, const Nom &nom_discretisation=NOM_VIDE)
Static method that creates an OWN_PTR(Champ_Inc_base) of the specified type.
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_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
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,...
class Equation_base The role of an equation is the calculation of one or more fields....
virtual void set_param(Param &titi) const override
virtual const Milieu_base & milieu() const =0
virtual void dimensionner_matrice_sans_mem(Matrice_Morse &mat_morse)
Sources & sources()
Returns the source terms associated with the equation.
virtual void assembler_blocs_avec_inertie(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={})
const Discretisation_base & discretisation() const
Returns the discretization associated with the equation.
virtual const Champ_Inc_base & inconnue() const =0
virtual void dimensionner_blocs(matrices_t matrices, const tabs_t &semi_impl={}) const
virtual void completer()
Completes the construction (initialization) of objects associated with the equation.
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the discretized boundary condition domain associated with the equation.
Probleme_base & probleme()
Returns the problem associated with the equation.
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
virtual void discretiser()
Discretizes the equation.
virtual Entree & lire_sources(Entree &)
Reading of source terms in an input stream.
virtual int has_interface_blocs() const
Champs_compris champs_compris_
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
Base class for an incompressible fluid and its properties:
Specialisation of Convection_Diffusion_std for multiphase flows where the transported scalar is the v...
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
static void calculer_alpha_rho(const Objet_U &obj, DoubleTab &val, DoubleTab &bval, tabs_t &deriv)
const Operateur & operateur(int) const override
Returns the operator at the given index: returns terme_diffusif if i = 0,.
void discretiser() override
Discretizes the equation.
const Motcle & domaine_application() const override
Returns the name of the application domain of the equation.
Operateur_Evanescence evanescence_
static void calculer_alpha_rho_conv(const Objet_U &obj, DoubleTab &val, DoubleTab &bval, tabs_t &deriv)
const Champ_Inc_base & inconnue() const override
Returns the unknown field representing the unknown (alpha) (const version).
const Milieu_base & milieu() const override
Returns the physical medium associated with the equation.
void associer_milieu_base(const Milieu_base &) override
Associates a physical medium to the equation; the medium is cast to Fluide_base.
int has_interface_blocs() const override
void dimensionner_matrice_sans_mem(Matrice_Morse &matrice) override
void associer_fluide(const Fluide_base &)
Associates a fluid of type Fluide_base with the equation.
void init_champ_convecte() const override
void assembler_blocs_avec_inertie(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={}) override
void completer() override
Associates the unknown of the equation to the state law.
const Fluide_base & fluide() const
Returns the incompressible fluid associated with the equation (const version).
void dimensionner_blocs(matrices_t matrices, const tabs_t &semi_impl={}) const override
std::pair< std::string, fonc_calc_t > get_fonc_champ_convecte() const
void set_param(Param ¶m) const override
Matrice_Morse class - Represents a (sparse) matrix M, not necessarily square,.
Milieu_base This class is the base of the (physical) medium hierarchy.
virtual const Champ_base & masse_volumique() const
Returns the mass density of the medium (const version).
A character string (Nom) in uppercase.
class Nom: a character string for naming TRUST objects.
const Nom & que_suis_je() const
Returns the string identifying the class.
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
class Operateur Generic class of the operator hierarchy.
Helper class to factorize the readOn method of Objet_U classes.
void ajouter_condition(const char *condition, const char *message, const char *name=0)
Declare a post-read logical condition that must hold on the parameter values.
void ajouter_non_std(const char *keyword, const Objet_U *value, Param::Nature nat=Param::OPTIONAL)
Register a keyword handled by Objet_U::lire_motcle_non_standard.
Multiphase thermohydraulics problem of type "3*N equations":
double alpha_inf_phase(int i) const
const Nom & nom_phase(int i) const
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
double temps_courant() const
Returns the current time.
virtual int nb_valeurs_temporelles() const =0
Base class for output streams.
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
_SIZE_ dimension_tot(int) const override
_SIZE_ dimension(int d) const
_SIZE_ size_reelle_ok() const