16#include <Diffusion_croisee_echelle_temp_taux_diss_turb_PolyMAC_MPFA.h>
18#include <Dissipation_type_helpers.h>
19#include <Energie_cinetique_turbulente.h>
20#include <Champ_Elem_PolyMAC_MPFA.h>
21#include <Echange_impose_base.h>
22#include <Domaine_PolyMAC_MPFA.h>
23#include <Domaine_Cl_PolyMAC_family.h>
24#include <Probleme_base.h>
25#include <Neumann_paroi.h>
69 const DoubleTab& field_passe,
71 const int nf,
const int N,
const int nb_elem_tot,
81 const DoubleTab& f_w = ch.
fgrad_w;
82 const IntTab& fcl = ch.
fcl();
85 for (
int f = 0; f < nf; f++)
86 for (
int n = 0; n < N; n++)
89 for (
int j = f_d(f); j < f_d(f + 1); j++)
92 const int f_bord = e - nb_elem_tot;
94 grad_f(f, n) += f_w(j) * field_passe(e, n);
95 else if (fcl(f_bord, 0) == 1 || fcl(f_bord, 0) == 2)
96 grad_f(f, n) += (f_w(j) ? f_w(j, n) * ref_cast(
Echange_impose_base, cls[fcl(f_bord, 1)].valeur()).T_ext(fcl(f_bord, 2), n) : 0);
97 else if (fcl(f_bord, 0) == 4)
98 grad_f(f, n) += (f_w(j) ? f_w(j, n) * ref_cast(
Neumann_paroi, cls[fcl(f_bord, 1)].valeur()).flux_impose(fcl(f_bord, 2), n) : 0);
99 else if (fcl(f_bord, 0) == 6)
100 grad_f(f, n) += f_w(j) * ref_cast(
Dirichlet, cls[fcl(f_bord, 1)].valeur()).val_imp(fcl(f_bord, 2), n);
109 const DoubleTab& k_passe = ch_k.
passe();
110 const DoubleTab& xp = domaine.xp();
111 const DoubleTab& xv = domaine.xv();
113 const IntTab& e_f = domaine.elem_faces();
114 const IntTab& f_e = domaine.face_voisins();
116 const DoubleVect& ve = domaine.volumes();
117 const DoubleVect& fs = domaine.face_surfaces();
120 const DoubleTab& diss_passe = ch_diss.
passe();
121 const DoubleTab& diss = ch_diss.
valeurs();
123 const int nf = domaine.nb_faces();
125 const int nb_elem = domaine.nb_elem();
126 const int nb_elem_tot = domaine.nb_elem_tot();
129 const std::string Type_diss = get_dissipation_type(
equation());
131 assert(N == 1 || k_passe.
line_size() == 1);
135 DoubleTrav grad_f_diss(nf, N);
138 DoubleTrav grad_f_k(nf, N);
139 compute_face_gradient(ch_k, k_passe,
f_grad_k_fixe_, nf, N, nb_elem_tot, grad_f_k);
143 DoubleTrav grad_f_diss_dot_grad_f_k(nb_elem, N);
144 for (
int e = 0; e < nb_elem; e++)
145 for (
int n = 0; n < N; n++)
147 std::array grad_diss = {0., 0., 0.};
148 std::array grad_k = {0., 0., 0.};
151 for (
int j = 0; j < e_f.
dimension(1) && (f = e_f(e, j)) >= 0; j++)
153 const double coeff = (e == f_e(f, 0) ? 1 : -1) * fs(f) / ve(e);
154 for (
int d = 0; d < D; d++)
156 const double w = coeff * (xv(f, d) - xp(e, d));
157 grad_diss.at(d) += w * grad_f_diss(f, n);
158 grad_k.at(d) += w * grad_f_k(f, n);
163 for (
int d = 0; d < D; d++)
164 dot += grad_diss.at(d) * grad_k.at(d);
165 grad_f_diss_dot_grad_f_k(e, n) = dot;
172 for (
int e = 0; e < nb_elem; e++)
173 for (
int n = 0; n < N; n++)
175 const double peve = pe(e) * ve(e);
177 if (Type_diss ==
"tau")
179 const double dot_min = std::min(grad_f_diss_dot_grad_f_k(e, n), 0.);
180 secmem(e, n) += peve *
sigma_d_ * diss(e, n) * dot_min;
182 (*M)(N * e + n, N * e + n) -= peve *
sigma_d_ * dot_min;
184 else if (Type_diss ==
"omega")
186 if (diss(e, n) > 1.e-8)
188 const double dp = std::max(diss_passe(e, n), 1.e-6);
189 const double dot_max = std::max(grad_f_diss_dot_grad_f_k(e, n), 0.);
190 secmem(e, n) += peve *
sigma_d_ / dp * (2 - diss(e, n) / dp) * dot_max;
192 (*M)(N * e + n, N * e + n) -= peve *
sigma_d_ * (-1. / (dp * dp)) * dot_max;
: class Champ_Elem_PolyMAC_MPFA
void calc_grad(int full_stencil) const
void init_grad(int full_stencil) const
const IntTab & fcl() const
DoubleTab & passe(int i=1) override
Returns field values at instant t-i.
const Domaine_Cl_dis_base & domaine_Cl_dis() const
DoubleTab & valeurs() override
Returns the array of field values at the current time.
class Cond_lim Generic class used to represent any class
class Conds_lim This class represents a vector of boundary conditions.
class Diffusion_croisee_echelle_temp_taux_diss_turb_PolyMAC_MPFA
int f_grad_tau_omega_fixe_
void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={}) const override
void completer() override
Updates internal references of the Source_base object.
Dirichlet This class is the base class of the hierarchy of Dirichlet-type boundary conditions.
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
Echange_impose_base: This boundary condition is used only for the energy equation.
classe Echelle_temporelle_turbulente Equation de transport de l'echelle temporelle turbulente (modele...
classe Energie_cinetique_turbulente Equation de transport d'une energie cinetique turbulente (modeles...
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 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.
const Nom & le_nom() const override
Returns the name of the field.
Matrice_Morse class - Represents a (sparse) matrix M, not necessarily square,.
DoubleVect & porosite_elem()
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Classe Neumann_paroi This boundary condition corresponds to an imposed flux for the.
const std::string & getString() const
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 Probleme_base It is a Probleme_U that is not a coupling.
virtual int nombre_d_equations() const =0
virtual const Equation_base & equation(int) const =0
Base class for output streams.
class Source_Diffusion_croisee_echelle_temp_taux_diss_turb
const Champ_base & get_champ(const Motcle &nom) const override
_SIZE_ dimension(int d) const
classe Taux_dissipation_turbulent Equation de transport du taux de dissipation turbulen (modele k-ome...