16#include <Op_Diff_VDF_Elem_base.h>
17#include <Echange_contact_VDF.h>
18#include <Champ_P0_VDF.h>
19#include <Matrix_tools.h>
20#include <Array_tools.h>
21#include <Perf_counters.h>
43 double dt_stab = DMAXFLOAT;
50 if (
equation().diffusion_multi_scalaire())
52 const int nb_comp =
static_cast<int>(std::sqrt(diffu.
line_size()));
53 std::vector<double> diff_vect(nb_comp);
55 for (
int i = 0; i < nb_comp; i++)
56 for (
int j = 0; j < nb_comp; j++)
57 diff_vect[i] += std::abs(diffu(0, nb_comp * i + j));
59 alpha = *std::max_element(diff_vect.begin(), diff_vect.end());
64 alpha = max_array(diffu);
67 double coef = 1 / (domaine_VDF.
h_x() * domaine_VDF.
h_x()) + 1 / (domaine_VDF.
h_y() * domaine_VDF.
h_y());
70 coef += 1 / (domaine_VDF.
h_z() * domaine_VDF.
h_z());
75 dt_stab = 0.5 / (alpha * coef);
80 if (
equation().diffusion_multi_scalaire())
89 const IntTab& f_e = domaine.face_voisins();
94 for (
int i = 0; i < domaine.nb_front_Cl(); i++)
97 if (!la_cl->que_suis_je().debute_par(
"Paroi_Echange_contact"))
continue;
101 std::map<int, std::pair<int, int>> f2e;
104 if ((l = cl.
item(j)) >= 0)
107 int e = f_e(f, 0) == -1 ? f_e(f, 1) : f_e(f, 0);
108 f2e[f] = std::make_pair(e, l);
110 iter_->ajouter_contribution_autre_pb(inco, matrice, la_cl, f2e);
118 const IntTab& f_e = domaine.face_voisins();
119 const Conds_lim& cls = iter_->domaine_Cl().les_conditions_limites();
122 Stencil stencil(0, 2);
124 for (i = 0; i < cls.size(); i++)
133 if ((l = cl.
item(j)) >= 0)
136 int e = f_e(f, 0) == -1 ? f_e(f, 1) : f_e(f, 0);
137 for (n = 0; n < N; n++) stencil.
append_line(N * e + n, N * l + n);
141 tableau_trier_retirer_doublons(stencil);
148 if (semi_impl.count(nom_inco))
return;
151 int n_ext = (int)
op_ext.size();
153 std::vector<Matrice_Morse *> mat(n_ext);
154 std::vector<int> N(n_ext);
155 for (
int i = 0; i < n_ext; i++)
157 N[i] =
op_ext[i]->equation().inconnue().valeurs().line_size();
159 std::string nom_mat = i ? nom_inco +
"/" +
op_ext[i]->equation().probleme().le_nom().getString() : nom_inco;
160 mat[i] = matrices.count(nom_mat) ? matrices.at(nom_mat) :
nullptr;
161 if(!mat[i])
continue;
166 int nl = N[0] * iter_->domaine().nb_elem_tot();
167 int nc = N[i] *
op_ext[i]->equation().domaine_dis().nb_elem_tot();
170 mat[i]->nb_colonnes() ? *mat[i] += mat2 : *mat[i] = mat2;
179 iter_->ajouter_blocs(matrices, secmem, semi_impl);
185 if ((
int)
op_ext.size() > 1) ajouter_blocs_pour_monolithique(matrices, secmem, semi_impl);
188void Op_Diff_VDF_Elem_base::ajouter_blocs_pour_monolithique(matrices_t matrices, DoubleTab& secmem,
const tabs_t& semi_impl)
const
191 int n_ext = (int)
op_ext.size() - 1;
192 std::vector<Matrice_Morse *> mat(n_ext);
193 std::vector<const DoubleTab *> inco(n_ext);
195 for (
int i = 0; i < n_ext; i++)
197 std::string nom_mat = nom_inco +
"/" +
op_ext[i + 1]->equation().probleme().le_nom().getString();
198 mat[i] = matrices.count(nom_mat) ? matrices.at(nom_mat) :
nullptr;
201 inco[i] = semi_impl.count(nom_mat) ? &semi_impl.at(nom_mat) : &
op_ext[i + 1]->equation().inconnue().valeurs();
DoubleTab & valeurs() override
Returns the array of field values at the current time.
class Champ_P0_VDF Class representing a P0 discrete field per element associated with a discretized d...
virtual DoubleTab & valeurs()=0
virtual Frontiere_dis_base & frontiere_dis()
Returns the discretized boundary to which the boundary conditions apply.
class Cond_lim Generic class used to represent any class
class Conds_lim This class represents a vector of boundary conditions.
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
const Domaine & domaine() const
Class defining operators and methods for all reading operation in an input flow (file,...
virtual const Champ_Inc_base & inconnue() const =0
const Nom & le_nom() const override
Returns the name of the field.
int num_face(const int) const
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.
const std::string & getString() const
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_VDF_Elem_base This class represents the diffusion operator associated with a transport ...
void dimensionner_blocs(matrices_t matrices, const tabs_t &semi_impl) const override
void contribuer_termes_croises(const DoubleTab &inco, const Probleme_base &autre_pb, const DoubleTab &autre_inco, Matrice_Morse &matrice) const override
void dimensionner_termes_croises(Matrice_Morse &, const Probleme_base &autre_pb, int nl, int nc) const override
void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl) const override
double calculer_dt_stab() const override
Computes dt_stab.
class Op_Diff_VDF_base Classe de base des operateurs de diffusion VDF
double calculer_dt_stab_(const Domaine_VDF &zone_VDF) const
void init_op_ext() const override
void ajoute_terme_pour_axi(matrices_t, DoubleTab &, const tabs_t &) const
void dimensionner(const Domaine_VDF &, const Domaine_Cl_VDF &, Matrice_Morse &, const bool) const
std::vector< const Operateur_Diff_base * > op_ext
virtual const Champ_base & diffusivite() const =0
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...
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
class Probleme_base It is a Probleme_U that is not a coupling.
static double mp_min(double)
Base class for output streams.
virtual int has_champ_masse_volumique() const
Returns 1 if the density field has been associated, 0 otherwise.
_SIZE_ dimension(int d) const