15#include <Convection_Diffusion_Concentration_Turbulent_FT_Disc.h>
16#include <Champ_P1NC.h>
17#include <Probleme_base.h>
18#include <Transport_Interfaces_FT_Disc.h>
19#include <Domaine_VEF.h>
20#include <Champ_Inc_P0_base.h>
21#include <Check_espace_virtuel.h>
24#include <Sous_Domaine.h>
27#include <Constituant.h>
28#include <Modele_turbulence_scal_Schmidt.h>
29#include <Fluide_Diphasique.h>
30#include <Fluide_Incompressible.h>
58 Cerr <<
"Missing EQUATION_NU_T" << finl;
62 Cerr <<
"The kinematic model used is : modele_cinetique " <<
modele_cinetique_ << finl;
68 nom_fic +=
"_bilan.out";
71 snprintf(s, 1000,
"#%15s %16s %16s %16s %16s",
109 param.
ajouter_condition(
"(value_of_phase_eq_0)_or_(value_of_phase_eq_1)",
"phase must be set to 0 or 1");
121 if (mot==
"equation_interface")
125 ref_eq_transport_ = mon_probleme->get_equation_by_name(nom);
128 Cerr <<
" Error: the equation indicated for keyword equation_interface "<<finl;
129 Cerr <<
" is not of type (or sub type) of Transport_Interfaces_FT_Disc." << finl;
135 else if (mot==
"option")
139 if (motbis ==
"RAMASSE_MIETTES_SIMPLE")
141 else if (motbis ==
"RIEN")
145 Cerr <<
"Error: expected RAMASSE_MIETTES_SIMPLE or RIEN after keyword OPTION" << finl;
166 const DoubleTab& val = ch.
valeurs();
171 for (
int i = 0; i < sz; i++)
173 const double v = volumes[i];
174 const double c = val(i);
175 const double fact = faces_doubles[i] ? 0.5 : 1.;
176 somme += v * c * fact;
181 Cerr <<
"Method integrale is not developped for " << ch.
que_suis_je() << finl;
194static void calculer_indicatrice_comme(
const Champ_base& src, DoubleTab& dest,
const Champ_base& champ_modele)
201 const int nb_faces = domaine_vf.
nb_faces();
203 const DoubleTab& indic = src.
valeurs();
204 assert_espace_virtuel_vect(indic);
205 for (
int i = 0; i < nb_faces; i++)
207 const int elem0 = face_voisins(i, 0);
208 const int elem1 = face_voisins(i, 1);
214 s *= ((elem0>=0) && (elem1>=0)) ? 0.5 : 1.;
220 Cerr <<
"Error calculer_indicatrice_comme" << finl;
235 DoubleTab& inco = champ_inco.
valeurs();
238 calculer_indicatrice_comme(eq.
inconnue(), tmp, champ_inco);
241 const double masse_totale = integrale(champ_inco);
245 const int sz = inco.
size();
247 for (
int i = 0; i < sz; i++)
249 double facteur = tmp[i];
251 facteur = 1. - facteur;
252 assert(facteur > -1e-6 && facteur < 1.+1e-6);
257 const double masse_restante = integrale(champ_inco);
260 Journal() <<
"C_D_concentration_ft_disc::ramasse_miette_simple t= " << temps
261 <<
" masse_totale= " << masse_totale
262 <<
" masse_restante= " << masse_restante << finl;
265 if (masse_restante > 0.)
266 inco *= (masse_totale / masse_restante);
276 Cerr <<
"Error for method Convection_Diffusion_Concentration_Turbulent_FT_Disc::mettre_a_jour_chimie()\n"
277 <<
"It implies two equations_source_chimie" << finl;
288 const int nb_faces = champ1.
dimension(0);
291 const DoubleTab *champ_nu_t = 0;
295 const RefObjU& modele_turbulence_hydr = eq.
get_modele(TURBULENCE);
301 const RefObjU& modele_turbulence_scal = eq_scal.
get_modele(TURBULENCE);
307 Cerr <<
"Reaction model dependent of the turbulent Schmidt number which is defined as " << sc_t << finl;
310 double coeff_diffusivite = tab_diffusivite(0,0);
319 const double nu_phase_0 = tab_nu_phase_0(0,0);
320 const double nu_phase_1 = tab_nu_phase_1(0,0);
321 const double delta_nu = nu_phase_1 - nu_phase_0;
323 DoubleTab indic_faces;
324 calculer_indicatrice_comme(ref_eq_transport_->inconnue(),
327 for (
int face = 0; face < nb_faces; face++)
332 int elem1 = face_voisins(face,0);
333 int elem2 = face_voisins(face,1);
334 if (elem1 < 0) elem1 = elem2;
335 if (elem2 < 0) elem2 = elem1;
336 nu_t = ((*champ_nu_t)(elem1) + (*champ_nu_t)(elem2)) * 0.5;
338 double c1 = std::max(0., champ1(face));
339 double c2 = std::max(0., champ2(face));
340 double c3 = std::max(0., champ3(face));
346 double Rdt = std::min(omega * dt, c1);
347 Rdt = std::min(Rdt, c2);
350 champ1(face) = c1 - Rdt;
351 champ2(face) = c2 - Rdt;
352 champ3(face) = c3 + Rdt;
360 double l_carac = 2.0*pow(6.*volumes_entrelaces(face),1./
double(dim)) ;
361 double tm = l_carac*l_carac/(coeff_diffusivite + nu_t/sc_t);
363 double omega = std::min(c1,c2);
364 omega = omega/std::max(dt,tm);
365 double Rdt = omega * dt;
368 champ1(face) = c1 - Rdt;
369 champ2(face) = c2 - Rdt;
370 champ3(face) = c3 + Rdt;
377 const double indic = indic_faces[face];
378 const double nu = indic * delta_nu + nu_phase_0;
381 double l_carac = 2.0*pow(6.*volumes_entrelaces(face),1./
double(dim)) ;
383 const double Ci = 0.07;
384 double schm = nu/coeff_diffusivite;
386 double tm = l_carac*l_carac*Ci*schm/(nu + nu_t);
388 double omega = std::min(c1,c2);
389 omega = omega/std::max(dt,tm);
390 double Rdt = omega * dt;
393 champ1(face) = c1 - Rdt;
394 champ2(face) = c2 - Rdt;
395 champ3(face) = c3 + Rdt;
404 double l_carac = 2.0*pow(6.*volumes_entrelaces(face),1./
double(dim)) ;
406 double tm = l_carac*l_carac/nu_t;
408 double omega = std::min(c1,c2);
409 omega = omega/std::max(dt,tm);
410 double Rdt = omega * dt;
413 champ1(face) = c1 - Rdt;
414 champ2(face) = c2 - Rdt;
415 champ3(face) = c3 + Rdt;
420 Cerr <<
"MODELE_CINETIQUE not implemented ==> Please specify model 1 -- 4" << finl;
438 const int nb_faces = domaine_vef.
nb_faces();
441 int modif = (facteur != 1.);
442 double integrale = 0.;
443 for (
int i = 0; i < nb_faces; i++)
445 if (marqueurs_faces[i])
447 double vol = (i < nb_faces_non_std) ? volumes_cl[i] : volumes[i];
448 double f = faces_doubles[i] ? 0.5 : 1.;
450 integrale += vol * f * x;
452 tab(i) = facteur * x;
455 integrale_avant =
mp_sum(integrale);
460 int sans_faces_non_std_volume_nul)
const
463 const IntTab& elem_faces = domaine_vef.
elem_faces();
466 const int nb_faces_elem = elem_faces.
dimension(1);
470 const int nb_elem_sous_domaine = sous_domaine.
nb_elem_tot();
473 for (i = 0; i < nb_elem_sous_domaine; i++)
475 if (sans_faces_non_std_volume_nul && i < nb_faces_non_std)
477 if (volumes_cl[i] == 0.)
481 const int elem = sous_domaine[i];
482 for (
int j = 0; j < nb_faces_elem; j++)
484 const int face = elem_faces(elem,j);
495 Debog::verifier(
"Convection_Diffusion_Concentration_Turbulent_FT_Disc::mettre_a_jour c1",
inconnue().valeurs());
506 Cerr <<
"Internal error for method Convection_Diffusion_Concentration_Turbulent_FT_Disc::mettre_a_jour" << finl;
516 double integrale_sortie = 0.;
517 double integrale0 = 0.;
518 double integrale1 = 0.;
529 DoubleTab indic_faces;
530 calculer_indicatrice_comme(ref_eq_transport_->inconnue(),
535 const int nb_faces = domaine_vef.
nb_faces();
539 for (
int i = 0; i < nb_faces; i++)
541 double vol = (i < nb_faces_non_std) ? volumes_cl[i] : volumes[i];
542 double f = faces_doubles[i] ? 0.5 : 1.;
543 double indic = indic_faces(i);
544 double x = inco(i) * f * vol;
545 integrale0 += x * (1.-indic);
546 integrale1 += x * indic;
548 integrale0 =
mp_sum(integrale0);
549 integrale1 =
mp_sum(integrale1);
555 nom_fic +=
"_bilan.out";
556 SFichier f(nom_fic, ios::out | ios::app);
558 snprintf(s, 1000,
"%16.8f %16.8g %16.8g %16.8g %16.8g",
563 integrale_sortie / dt);
566 Debog::verifier(
"Convection_Diffusion_Concentration_Turbulent_FT_Disc::mettre_a_jour c2",
inconnue().valeurs());
ArrOfBit_32_64 & resize_array(int_t n)
Changes the size of the array and copies existing data.
void setbit(int_t i) const
Set bit e to 1.
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
: class Champ_Inc_P0_base
DoubleTab & valeurs() override
Returns the array of field values at the current time.
virtual DoubleTab & valeurs()=0
class Champ_base This class is the base of the fields hierarchy.
virtual const Domaine_dis_base & domaine_dis_base() const
const Champ_Don_base & diffusivite_constituant() const
Cette equation corrige le champ de concentration pour tenir compte de la presence d'une interface.
void ramasse_miette_simple(double temps)
void multiplier_valeurs_faces(const ArrOfBit marqueurs_faces, double facteur, double &integrale_avant, DoubleTab &tab)
void set_param(Param &titi) const override
Noms equations_source_chimie_
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
void marquer_faces_sous_domaine(const Nom &nom_sous_domaine, ArrOfBit &marqueur, int sans_faces_non_std_volume_nul) const
void mettre_a_jour_chimie()
double constante_cinetique_nu_t_
Convection_Diffusion_Concentration_Turbulent_FT_Disc()
double constante_cinetique_
void mettre_a_jour(double temps) override
appel a mettre_a_jour() de l'ancetre et application de l' "option_" choisie pour traiter la presence ...
Turbulent convection-diffusion equation when the unknown is a concentration or a vector of concentrat...
void mettre_a_jour(double) override
Time update of the equation via a double call to: Convection_Diffusion_Concentration::mettre_a_jour(d...
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
void set_param(Param &titi) const override
const Constituant & constituant() const
Returns the constituent (if one has been associated).
const Champ_Inc_base & inconnue() const override
Returns the unknown field of the equation: the concentration.
static void verifier(const char *const msg, double)
const Sous_Domaine_t & ss_domaine(int i) const
int nb_faces_non_std() const
int nb_faces() const
Returns the total number of faces.
DoubleVect & volumes_entrelaces()
int nb_faces_tot() const
Returns the total number of faces.
ArrOfInt & faces_doubles()
Returns 1 for faces belonging to a periodic boundary or a shared item, 0 by default.
int elem_faces(int i, int j) const
Returns the index of the i-th face of element num_elem; the face numbering convention is.
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
const Domaine & domaine() const
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....
const Nom & le_nom() const override
Returns the name of the equation.
virtual const RefObjU & get_modele(Type_modele type) const
virtual const Champ_Inc_base & inconnue() const =0
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.
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
const Fluide_Incompressible & fluide_phase(int la_phase) const
Represents an incompressible fluid and its properties:
const Champ_Don_base & viscosite_cinematique() const
Base class for the turbulence model hierarchy for Navier-Stokes equations.
const Champ_Fonc_base & viscosite_turbulente() const
Scalar turbulence model using the turbulent Schmidt number to compute turbulent diffusion:
double get_Scturb() const
Base class for scalar turbulence models coupled to a Navier-Stokes convection-diffusion equation.
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.
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
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(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
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.
class Probleme_base It is a Probleme_U that is not a coupling.
virtual const Milieu_base & milieu() const
Returns the physical medium associated with the problem (const version).
const Schema_Temps_base & schema_temps() const
Returns the time scheme associated with the problem.
virtual const Equation_base & get_equation_by_name(const Nom &) const
(B. Math): Virtual method added for problems having several equations of the same type (Probleme_FT_D...
virtual Equation_base & getset_equation_by_name(const Nom &)
(B. Math): Virtual method added for problems having several equations of the same type (Probleme_FT_D...
static Sortie & Journal(int message_level=0)
Returns a static Sortie object used as an event journal.
static double mp_sum(double)
Computes the sum of x over all processors in the current group.
static void barrier()
Synchronizes all processors in the current group (waits until all processors have reached the barrier...
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
static int je_suis_maitre()
Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
SFichier is to the C++ ofstream class what Sortie is to the C++ ostream class.
double pas_de_temps() const
Returns the current time step (delta_t).
Base class for output streams.
int_t nb_elem_tot() const
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
_SIZE_ dimension(int d) const
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")
const Objet_U & valeur() const
const Champ_Inc_base & inconnue() const override