16#include <Modele_turbulence_scal_base.h>
17#include <Echange_externe_impose.h>
18#include <Op_Diff_PolyMAC_CDO_base.h>
19#include <Check_espace_virtuel.h>
20#include <Champ_Elem_PolyMAC_CDO.h>
21#include <Champ_Fonc_P0_base.h>
22#include <Domaine_Cl_PolyMAC_family.h>
23#include <Champ_Uniforme.h>
24#include <Milieu_base.h>
35 const Domaine& mon_dom = le_dom_poly_->domaine();
36 double dt_stab = DMAXFLOAT;
38 const int nb_elem = mon_dom.
nb_elem();
47 const DoubleVect& valeurs_diffusivite = champ_diffusivite.
valeurs();
48 double alpha_max = local_max_vect(valeurs_diffusivite);
51 double h_imp_max = -1, h_imp_temp = -2;
54 for (
int i = 0; i < le_dom_cl_poly.
nb_cond_lim(); i++)
63 const DoubleVect& tab = le_ch_front.
valeurs();
66 h_imp_temp = local_max_vect(tab);
67 h_imp_temp = std::fabs(h_imp_temp);
68 h_imp_max = (h_imp_temp > h_imp_max) ? h_imp_temp : h_imp_max;
74 if (alpha_max != 0.0 && nb_elem != 0)
76 double min_delta_h_carre = le_dom_poly_->carre_pas_du_maillage();
83 double max_conductivity = local_max_vect(tab_lambda);
86 double Bi = h_imp_max * sqrt(min_delta_h_carre) / max_conductivity;
89 alpha_max *= h_imp_max * sqrt(min_delta_h_carre) / max_conductivity;
91 dt_stab = min_delta_h_carre / (2. *
dimension * alpha_max);
99 const DoubleTab& valeurs_diffu = champ_diffu.
valeurs();
101 const DoubleTab& valeurs_rho = champ_rho.
valeurs();
108 const IntTab& e_f = le_dom_poly_->elem_faces();
110 for (
int elem = 0; elem < nb_elem; elem++)
112 const double diffu = valeurs_diffu(elem);
113 const double rho = valeurs_rho(elem);
119 for (
int i = 0; i < e_f.
dimension(1); i++)
120 if (e_f(elem, i) != -1)
122 flag = (nb_rf == deux_dim);
125 flag = (e_f.
dimension(1) == deux_dim || e_f(elem, deux_dim) == -1);
131 for (
int f = 0; f < deux_dim; f++)
133 int face = e_f(elem, f);
134 const double d = le_dom_poly_->volumes(elem) / le_dom_poly_->surface(face);
139 dt = 0.5 * rho / ((diffu + DMINFLOAT) * h);
144 dt = le_dom_poly_->carre_pas_maille(elem) * rho / (deux_dim * (diffu + DMINFLOAT));
160 le_dom_poly_->domaine().creer_tableau_elements(
nu_);
161 le_dom_poly_->creer_tableau_faces(
nu_fac_);
170 const Conds_lim& cls = la_zcl_poly_->les_conditions_limites();
181 int n =
nu_.dimension_tot(0), nb_comp =
nu_.line_size();
183 const DoubleVect& arr_diffu = diffu;
184 DoubleVect& arr_nu =
nu_;
185 for (i = 0; i < n; i++)
186 for (j = 0; j < nb_comp; j++)
187 arr_nu[i * nb_comp + j] = arr_diffu[j];
192 assert_espace_virtuel_vect(diffu);
193 nu_.inject_array(diffu);
204 double val_nu = diffu(0, 0);
205 for (i = 0; i < diffu_turb.
dimension(0); i++)
206 for (j = 0; j < 2; j++)
209 val_nu = diffu(i, 0);
210 nu_(i, j) = val_nu + diffu_turb(i, j);
218 int n =
nu_.dimension_tot(0), nb_comp =
nu_.line_size();
220 const DoubleVect& arr_diffu_turb = diffu_turb;
221 DoubleVect& arr_nu =
nu_;
222 for (i = 0; i < n; i++)
223 for (j = 0; j < nb_comp; j++)
224 arr_nu[i * nb_comp + j] += arr_diffu_turb[j];
229 assert_espace_virtuel_vect(diffu_turb);
241 for (i = 0; i <= cls.size(); i++)
243 int deb = i < cls.size() ? ref_cast(
Front_VF, cls[i]->frontiere_dis()).num_premiere_face() : domaine.premiere_face_int(), num =
244 i < cls.size() ? ref_cast(
Front_VF, cls[i]->frontiere_dis()).nb_faces() : domaine.nb_faces() - domaine.premiere_face_int();
245 for (f = deb; f < deb + num; f++)
247 if (i < cls.size() && loi_par)
255 nu_fac_.echange_espace_virtuel();
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
virtual DoubleTab & valeurs()=0
class Champ_base This class is the base of the fields hierarchy.
class Champ_front_base Base class for the hierarchy of boundary fields.
virtual DoubleTab & valeurs() override
Returns the array of field values.
class Cond_lim_base Base class for the hierarchy of classes that represent the different boundary con...
class Conds_lim This class represents a vector of boundary conditions.
int nb_cond_lim() const
Returns the number of boundary conditions.
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
Classe Echange_externe_impose: This class represents the special case of the class.
virtual double h_imp(int num) const
Returns the value of the imposed heat exchange coefficient on the i-th component.
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 const Milieu_base & milieu() const =0
virtual const RefObjU & get_modele(Type_modele type) const
Milieu_base This class is the base of the (physical) medium hierarchy.
virtual const Champ_Don_base & conductivite() const
Returns the conductivity of the medium (const version).
DoubleVect & porosite_face()
Base class for scalar turbulence models coupled to a Navier-Stokes convection-diffusion equation.
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
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.
class Op_Diff_PolyMAC_CDO_Gen_base
const Champ_base & diffusivite() const override
double calculer_dt_stab() const override
Computes dt_stab.
void update_nu() const override
void completer() override
Associates the operator with the domaine_dis, the domaine_Cl_dis, and the unknown of its equation.
bool has_diffusivite_turbulente() const
const Champ_Fonc_base & diffusivite_turbulente() const
virtual const Champ_base & diffusivite_pour_pas_de_temps() const
Returns the field corresponding to the true diffusivity of the medium used for the time step computat...
virtual void completer()
Associates the operator with the domaine_dis, the domaine_Cl_dis, and the unknown of its equation.
static double mp_min(double)
static double mp_max(double)
Base class for output streams.
virtual const Champ_base & get_champ_masse_volumique() const
Returns the density field.
virtual int has_champ_masse_volumique() const
Returns 1 if the density field has been associated, 0 otherwise.
_SIZE_ dimension(int d) const
virtual const MD_Vector & get_md_vector() const
const Objet_U & valeur() const