17#include <Navier_Stokes_Variable_Density.h>
18#include <Fluide_Incompressible.h>
19#include <Probleme_base.h>
20#include <Schema_Implicite_base.h>
34 const Navier_Stokes_Variable_Density::Interface_Milieu&
milieu =
dynamic_cast<const Navier_Stokes_Variable_Density::Interface_Milieu&
>(le_fluide.valeur());
43 Cerr <<
"implicit scheme not available (yet) with Navier_Stokes_Variable_Density variant of the Navier-Stokes equations" << finl;
44 Cerr <<
"you should use an explicit scheme and, if you wish, activate the implicit treatment of the diffusion operator in the velocity prediction step" << finl;
52 return le_fluide->viscosite_dynamique();
59 rho_faces_.typer(
"Champ_Fonc_Face");
63 assembleur_pression_->set_resoudre_increment_pression(1);
64 assembleur_pression_->set_resoudre_en_u(0);
75 const DoubleTab& tab_rho =
milieu.masse_volumique_variable().valeurs();
76 DoubleTab& tab_rho_faces = rho_faces_->valeurs();
77 rho_aux_faces(tab_rho, tab_rho_faces);
87 le_dom_Cl_dis->mettre_a_jour(temps);
94 Cout <<
"Estimation du champ de pression au demarrage:" << finl;
109 if (le_schema_en_temps->pas_de_temps() == 0)
112 dt = std::min(dt, le_schema_en_temps->pas_temps_max());
113 le_schema_en_temps->set_dt() = (dt);
118 le_schema_en_temps->set_dt() = 0;
121 solveur_masse->appliquer(vpoint);
127 assembleur_pression_->modifier_secmem_pour_incr_p(
la_pression->valeurs(), 1, secmem);
130 Cerr <<
"Pressure increment computed successfully" << finl;
133 operator_add(
la_pression->valeurs(), inc_pre, VECT_ALL_ITEMS);
152 if (le_traitement_particulier)
153 le_traitement_particulier->preparer_calcul_particulier();
163 const double dt = le_schema_en_temps->pas_de_temps();
165 const DoubleTab& tab_rho =
milieu.masse_volumique_variable().valeurs();
166 DoubleTab& tab_rho_faces = rho_faces_->valeurs();
167 rho_aux_faces(tab_rho, tab_rho_faces);
185 DoubleTrav conv(vpoint);
203 DoubleTrav secmem(vpoint);
205 solveur_masse->appliquer(secmem);
207 secmem *= tab_rho_faces;
210 vpoint = la_vitesse->valeurs();
220 DoubleTrav diff(vpoint);
222 diff /= tab_rho_faces;
224 solveur_masse->appliquer(vpoint);
234 divergence.calculer(la_vitesse->valeurs(), secmem);
239 assembleur_pression_->modifier_secmem(secmem);
247 assembleur_pression_->modifier_solution(
la_pression->valeurs());
256 solveur_masse->appliquer(
gradient_P->valeurs());
261 gradient_P->valeurs().echange_espace_virtuel();
265 solveur_masse->appliquer(gradP);
288 DoubleTab& tab_rho_faces = rho_faces_->valeurs();
289 operator_divide(gradP, tab_rho_faces, VECT_ALL_ITEMS);
292void Navier_Stokes_Variable_Density::rho_aux_faces(
const DoubleTab& tab_rho, DoubleTab& tab_rho_face)
296 const DoubleVect& volumes = domaineVF.
volumes();
302 for (
int fac = 0; fac < nbfaces_bord; fac++)
304 el0 = face_voisins(fac, 0);
307 tab_rho_face(fac) = tab_rho(el0);
311 el1 = face_voisins(fac, 1);
312 tab_rho_face(fac) = tab_rho(el1);
316 for (
int fac = nbfaces_bord; fac < nbfaces; fac++)
318 el0 = face_voisins(fac, 0);
319 el1 = face_voisins(fac, 1);
322 tab_rho_face(fac) = (vol0 * tab_rho(el0) + vol1 * tab_rho(el1)) / (vol0 + vol1);
class Champ_Don_base base class of Given Fields (not calculated)
DoubleTab & valeurs() override
Returns the array of field values at the current time.
static void verifier(const char *const msg, double)
void nommer_completer_champ_physique(const Domaine_dis_base &domaine_vdf, const Nom &nom_champ, const Nom &unite, Champ_base &champ, const Probleme_base &pbi) const
int nb_faces() const
Returns the total number of faces.
double volumes(int i) const
int premiere_face_int() const
A face is internal if and only if it separates two elements.
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
Class defining operators and methods for all reading operation in an input flow (file,...
virtual const Milieu_base & milieu() const =0
DoubleTab & derivee_en_temps_conv(DoubleTab &, const DoubleTab &)
Add convection term In: solution is the unknown I.
Sources & sources()
Returns the source terms associated with the equation.
int calculate_time_derivative() const
virtual int preparer_calcul()
Everything that does not depend on other possible problems.
virtual const Champ_Inc_base & derivee_en_temps() const
Probleme_base & probleme()
Returns the problem associated with the equation.
virtual void associer_sch_tps_base(const Schema_Temps_base &)
Associates the time scheme with the equation.
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
void Gradient_conjugue_diff_impl(DoubleTrav &secmem, DoubleTab &solution)
Champs_compris champs_compris_
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
virtual double calculer_pas_de_temps() const
Calculation of the next time step.
: class Navier_Stokes_Variable_Density
int preparer_calcul() override
cf Equation_base::preparer_calcul() Assembly of the pressure solver and
void modify_initial_gradP(DoubleTrav &) override
DoubleTab & derivee_en_temps_inco(DoubleTab &) override
Returns the time derivative of the unknown I of the equation: dI/dt = M-1*(sum(operators(I) + sources...
void associer_sch_tps_base(const Schema_Temps_base &) override
Associates the time scheme with the equation.
void discretiser() override
Discretizes the equation.
virtual void calculer_la_pression_en_pa() override
Computes "la_pression_en_pa" from "la_pression".
const Champ_Don_base & diffusivite_pour_transport() const override
Navier_Stokes_std This class carries the terms of the momentum equation.
Operateur_Diff terme_diffusif
const Milieu_base & milieu() const override
Returns the physical medium of the equation (Fluide_base upcast to Milieu_base).
Operateur_Conv terme_convectif
const Champ_Inc_base & inconnue() const override
Returns the velocity (unknown field of the equation) (const version).
virtual void projeter()
Computes the solution U of the equations: | M(U-V)/dt + BtP = 0.
Matrice matrice_pression_
virtual int projection_a_faire()
void discretiser() override
Discretizes the equation.
const Operateur & operateur(int) const override
Returns the i-th operator of the equation: - terme_diffusif if i = 0.
SolveurSys solveur_pression_
int nombre_d_operateurs() const override
Returns the number of operators in the equation: 2 for the standard Navier-Stokes equations.
int methode_calcul_pression_initiale_
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.
virtual DoubleTab & ajouter(const DoubleTab &, DoubleTab &) const =0
const Discretisation_base & discretisation() const
Returns the discretization associated with the problem.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
class Schema_Implicite_base Base class for all implicit time schemes.
double temps_courant() const
Returns the current time.
virtual void modifier_second_membre(const Equation_base &eqn, DoubleTab &secmem)
Base class for output streams.
void mettre_a_jour(double temps)
Time update of all sources in the list.
DoubleTab & ajouter(DoubleTab &) const
Adds the contribution of all sources in the list to the array passed as parameter,...
_SIZE_ dimension(int d) const
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")