16#include <Operateur_Diff_base.h>
17#include <Discretisation_base.h>
18#include <Schema_Temps_base.h>
19#include <Pb_Multiphase_HEM.h>
20#include <Champ_Composite.h>
21#include <TRUSTTab_parts.h>
22#include <QDM_Multiphase.h>
23#include <Discret_Thyd.h>
24#include <Fluide_base.h>
67 if (!sub_type(Fluide_base,le_fluide.valeur()))
69 Cerr<<
"ERROR : the QDM_Multiphase equation can be associated only to a fluid."<<finl;
72 divergence.set_description((Nom)
"Mass flow rate=Integral(rho*u*ndS) [kg.s-1]");
75 const Pb_Multiphase& pb = ref_cast(Pb_Multiphase,
probleme());
79 if (sub_type(Pb_Multiphase_HEM,
probleme()))
81 EChaine eva(
"{ homogene { alpha_res 1 alpha_res_min 0.5 } }");
86 EChaine eva(
"{ homogene { alpha_res 1e-6 } }");
149 for (n = 0; n < N; n++)
154 for (i = 0; i < std::min(psrc.size(), pdst.
size()); i++)
156 DoubleTab& src = psrc[i], &dst = pdst[i];
158 for (j = 0; j < src.
dimension_tot(0); j++) dst(j) = src(j, n);
161 for (d = 0; d < D; d++)
162 dst(j, d) = src(j, N * d + n);
168 if (la_vorticite) la_vorticite->mettre_a_jour(temps);
172 for (n = 0; n < N; n++)
178 for (i = 0; i < D; i++)
179 for (j = 0; j < D; j++)
185 for (i = 0; i < psrc.size(); i++)
186 for (j = 0; j < pdst.
size(); j++)
188 DoubleTab& src = psrc[i], &dst = pdst[j];
189 if (src.
line_size() == N * D * D && dst.line_size() == D * D)
192 for (
int dU = 0; dU < D; dU++)
193 for (
int dX = 0; dX < D; dX++)
194 dst(k, dX + D * dU) = src(k, dX, dU + n * D);
211 ConstDoubleTab_parts ppart(
pression().valeurs());
244 return le_fluide->viscosite_dynamique();
249 return le_fluide->viscosite_cinematique();
267 Cerr<<
" Navier_Stokes_std::completer_deb"<<finl;
269 Cerr<<
" Navier_Stokes_std::completer_fin"<<finl;
276 for (
auto mor : morceaux) mor->check_multiphase_compatibility();
290 if (opt==DESCRIPTION)
291 Cerr<<
" QDM_Multiphase : "<< noms_compris <<finl;
293 noms.add(noms_compris);
311 Noms noms(D * D), unites(D * D);
312 std::vector<Nom> composantsVitesse({
Nom(
"dU"),
Nom(
"dV"),
Nom(
"dW")});
313 std::vector<Nom> composantsDerivee({
Nom(
"dx"),
Nom(
"dy"),
Nom(
"dz")});
314 for (
int dU = 0 ; dU< D ; dU++)
315 for (
int dX = 0 ; dX < D ; dX++)
317 noms[ D * dU + dX]=
Nom(composantsVitesse[dU] + composantsDerivee[dX]);
318 unites[ D * dU + dX] =
Nom(
"m2/s");
321 Motcle typeChamp =
"champ_elem" ;
326 if (motlu ==
"gradient_pression")
340 Cerr <<
"Reading of initial conditions\n";
345 Cerr <<
que_suis_je() <<
": expected { instead of " << nom << finl;
348 int vit_lu = 0, press_lu = 0;
349 for (is >> nom; nom !=
"}"; is >> nom)
350 if (nom ==
"vitesse" || nom ==
"velocity")
355 if (src->que_suis_je() ==
"Champ_Composite")
358 if ( nb_dim != nb_phases)
360 Cerr <<
que_suis_je() <<
": velocity initial condition Champ_Composite should have "<< nb_phases <<
" fields and not " << nb_dim <<
" !" << finl;
366 la_vitesse->affecter(src), vit_lu = 1;
367 la_vitesse->passe() = la_vitesse->valeurs();
369 else if (nom ==
"pression" || nom ==
"pressure")
379 Cerr <<
que_suis_je() <<
": expected vitesse|velocity|pression|pressure instead of " << nom << finl;
385 Cerr <<
que_suis_je() <<
": velocity initial condition not found." << finl;
390 Cerr <<
que_suis_je() <<
": pressure initial condition not found." << finl;
416 if (!
evanescence_)
Process::exit(
"QDM_Multiphase::alpha_res : the evanescence operator should have been created already !" );
class Champ_Don_base base class of Given Fields (not calculated)
DoubleTab & futur(int i=1) override
Returns field values at instant t+i.
void mettre_a_jour(double temps) override
Performs a time update of the unknown field.
double changer_temps(const double temps) override
Sets the time of the field.
DoubleTab & valeurs() override
Returns the array of field values at the current time.
double changer_temps_futur(double, int i=1)
Sets the time of the i-th future field.
class Champ_base This class is the base of the fields hierarchy.
class Discret_Thyd This class is the base class representing a discretization
void gradient_P(const Schema_Temps_base &, Domaine_dis_base &, OWN_PTR(Champ_Inc_base)&, int nb_comp=1) const
void vitesse(const Schema_Temps_base &, Domaine_dis_base &, OWN_PTR(Champ_Inc_base)&, int nb_comp=1) const
virtual bool is_vdf() const
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,...
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.
Solveur_Masse_base & solv_masse()
Returns the mass solver associated with the equation.
virtual void mettre_a_jour(double temps)
The value of the unknown at the time step has been calculated.
virtual void abortTimeStep()
Reinitialize what must be.
virtual int preparer_calcul()
Everything that does not depend on other possible problems.
Probleme_base & probleme()
Returns the problem associated with the equation.
virtual void verifie_ch_init_nb_comp(const Champ_Inc_base &ch_ref, const int nb_comp) const
Verification of the number of components read for the specification of a field.
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
virtual bool initTimeStep(double dt)
Allocation and initialization of the unknown and boundary conditions until present+dt.
Champs_compris champs_compris_
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
const Nom & le_nom() const override
Returns the name of the field.
Matrice_Morse class - Represents a (sparse) matrix M, not necessarily square,.
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
A character string (Nom) in uppercase.
Navier_Stokes_std This class carries the terms of the momentum equation.
Operateur_Diff terme_diffusif
void dimensionner_matrice_sans_mem(Matrice_Morse &matrice) override
Operateur_Conv terme_convectif
const Champ_Inc_base & inconnue() const override
Returns the velocity (unknown field of the equation) (const version).
void creer_champ(const Motcle &motlu) override
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
void completer() override
Completes the base equation, associates the pressure with the equation,.
Champ_Inc_base & pression_pa()
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
int has_interface_blocs() const override
void set_param(Param &titi) const override
void dimensionner_blocs(matrices_t matrices, const tabs_t &semi_impl={}) const override
OWN_PTR(Assembleur_base) &assembleur_pression()
Champ_Inc_base & pression()
class Nom: a character string for naming TRUST objects.
An array of character strings (VECT(Nom)).
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.
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Generic base class in the operator hierarchy for evanescence management terms.
Helper class to factorize the readOn method of Objet_U classes.
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":
const Nom & nom_phase(int i) const
static void abort()
Abort routine for TRUST on a fatal error.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Carries the terms of the momentum equation for multiphase flow without turbulence modelling.
void completer() override
Completes the base equation, associates the pressure to the equation,.
void dimensionner_blocs(matrices_t matrices, const tabs_t &semi_impl={}) const override
bool initTimeStep(double dt) override
Allocation and initialization of the unknown and boundary conditions until present+dt.
Operateur_Evanescence evanescence_
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
const Champ_Don_base & diffusivite_pour_transport() const override
void creer_champ(const Motcle &motlu) override
Motcles noms_grad_vit_phases_
void discretiser_vitesse() override
std::vector< OWN_PTR(Champ_Inc_base)> vit_phases_
const Champ_base & vitesse_pour_transport() const override
void discretiser_grad_p() override
void abortTimeStep() override
Reinitialize what must be.
int preparer_calcul() override
cf Equation_base::preparer_calcul() Assembly of the pressure solver and
void assembler_blocs_avec_inertie(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={}) override
Entree & lire_cond_init(Entree &) override
Reading of initial conditions in an input stream.
void set_param(Param ¶m) const override
void mettre_a_jour(double temps) override
Performs a time update of the equation.
std::vector< OWN_PTR(Champ_Fonc_base)> grad_vit_phases_
int has_interface_blocs() const override
const Champ_base & diffusivite_pour_pas_de_temps() const override
void dimensionner_matrice_sans_mem(Matrice_Morse &matrice) override
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
double temps_courant() const
Returns the current time.
virtual double temps_futur(int i) const =0
virtual int nb_valeurs_futures() const =0
virtual DoubleTab & appliquer_impl(DoubleTab &x) const =0
Base class for output streams.
_SIZE_ dimension_tot(int) const override