16#include <Op_Grad_EF.h>
17#include <Neumann_sortie_libre.h>
19#include <Navier_Stokes_std.h>
20#include <Probleme_base.h>
21#include <Schema_Temps_base.h>
22#include <EcrFicPartage.h>
24#include <Champ_P0_EF.h>
25#include <Check_espace_virtuel.h>
27#include <Discretisation_base.h>
30#include <interface_INITGAUSS.h>
31#include <interface_CALCULSI.h>
58#undef lire_valimp_dans_med_
72#ifdef lire_valimp_dans_med_
81 EChaine ee(
"champ_fonc_med last_time termes.med MAILLAGE_GENEPI terme_pression_limite_qdm_10 som 0.");
83 int_P_bord_->affecter(champ_lu);
94void test(
const DoubleTab& pression, DoubleTab& grad,
const Op_Grad_EF& op)
99 DoubleTab pe(pression);
122 resu+= int_P_bord_->valeurs();
139 DoubleTab xgau(npgau,3),frgau(npgau,nbnn),dfrgau(npgau,nbnn,(
int)3),poigau(npgau);
142 init_gauss.
Compute(dim,nbnn,npgau,xgau,frgau,dfrgau,poigau);
145 DoubleTab xl(3,8),poro(4),detj(npgau), cnorm(3),si(4);
152 for (
int n_bord=0; n_bord<domaine_EF.
nb_front_Cl(); n_bord++)
163 for (
int ind_face=0; ind_face<nfin; ind_face++)
165 int face=le_bord.
num_face(ind_face);
166 for (
int i=0; i<3; i++)
167 cnorm(i)=face_normales(face,i);
168 cnorm/=norme_array(cnorm);
172 for (
int i=0; i<nbnn; i++)
174 num[i]=face_sommets(face,filter[i]);
177 for (
int i=0; i<nbnn; i++)
180 xl(d,i)=coord(num[i],d);
181 poro(i)=porosite_sommet[num[i]];
185 CALCULSI.Compute(nbnn, xl,
187 npgau, xgau, frgau, dfrgau,
188 poigau,detj, cnorm,si);
189 for (
int i=0; i<nbnn; i++)
195 const double r_f = domaine_EF.
xv(face,0);
196 const double r_s = xs(som,0);
197 const double corr = (
axi && r_f>0.) ? (r_s / r_f) : 1.0;
198 resu(som,d) += corr * si(i) * cnorm(d) * val_imp;
206 for (
int n_bord=0; n_bord<domaine_EF.
nb_front_Cl(); n_bord++)
217 for (
int ind_face=0; ind_face<nfin; ind_face++)
219 int face=le_bord.
num_face(ind_face);
222 val_imp/=nb_som_face;
223 const double r_f = domaine_EF.
xv(face,0);
224 for (
int s=0; s<nb_som_face; s++)
226 int som=face_sommets(face,s);
227 const double r_s = xs(som,0);
228 const double corr = (
axi && r_f>0.) ? (r_s / r_f) : 1.0;
230 resu(som,dir)+=corr*val_imp*face_normales(face,dir)*porosite_sommet(som);
243 test(pression,grad,(*
this));
248 assert_espace_virtuel_vect(pression);
253 const DoubleTab& Bij_thilde=domaine_ef.
Bij_thilde();
259 for (
int elem=0; elem<nb_elem_tot; elem++)
261 double pe=pression(elem);
262 const double r_e = domaine_ef.
xp(elem,0);
263 for (
int s=0; s<nb_som_elem; s++)
265 int som=elems(elem,s);
268 const double r_s = xs(som,0);
269 const double w =
bidim_axi ? (r_s / r_e) : 1.0;
270 grad(som,i) -= w * Bij_thilde(elem,s,i) * pe;
276 int nb_som_face=faces_sommets.
dimension(1);
285 for (
int n_bord=0; n_bord<domaine_ef.
nb_front_Cl()*1; n_bord++)
296 for (
int ind_face=num1; ind_face<num2; ind_face++)
298 int face=le_bord.
num_face(ind_face);
299 for (
int s=0; s<nb_som_face; s++)
301 int som=faces_sommets(face,s);
309 for (
int ind_face=num1; ind_face<num2*0; ind_face++)
311 int face=le_bord.
num_face(ind_face);
312 if (domaine_ef.
surface(face) < 1e-10)
continue;
316 for (
int s=0; s<nb_som_face; s++)
318 int som=faces_sommets(face,s);
322 grad_n+=grad(som,comp)*face_normales(face,comp);
325 grad(som,comp) -= grad_n*face_normales(face,comp);
344 const Domaine_EF& domaine_EF = le_dom_EF.valeur();
349 const DoubleTab& pression_P0 = la_pression_P0.
valeurs();
352 for (
int n_bord=0; n_bord<domaine_EF.
nb_front_Cl(); n_bord++)
357 int nfin = ndeb + le_bord.
nb_faces();
358 for (
int face=ndeb; face<nfin; face++)
360 int elem = face_voisins(face,0);
362 flux_bords_(face,i) = pression_P0(elem)*face_normales(face,i);
369 const int impr_mom=le_dom_EF->domaine().moments_a_imprimer();
370 const int impr_sum=(le_dom_EF->domaine().bords_a_imprimer_sum().est_vide() ? 0:1);
371 const int impr_bord=(le_dom_EF->domaine().bords_a_imprimer().est_vide() ? 0:1);
375 const Domaine_EF& domaine_EF = le_dom_EF.valeur();
391 for ( n_bord=0; n_bord<domaine_EF.
nb_front_Cl(); n_bord++)
397 int nfin = ndeb + le_bord.
nb_faces();
399 double fluxx_s = 0. ;
400 double fluxy_s = 0. ;
401 double fluxz_s = 0. ;
402 double fluxx_sum_s = 0. ;
403 double fluxy_sum_s = 0. ;
404 double fluxz_sum_s = 0. ;
405 double moment_x = 0.;
406 double moment_y = 0.;
407 double moment_z = 0.;
408 for (face=ndeb; face<nfin; face++)
418 if (domaine_EF.
domaine().bords_a_imprimer_sum().contient(le_bord.
le_nom()))
434 if (domaine_EF.
domaine().bords_a_imprimer_sum().contient(le_bord.
le_nom()))
465 tmp[3] = fluxx_sum_s;
466 tmp[4] = fluxy_sum_s;
467 tmp[5] = fluxz_sum_s;
475 fluxx_sum_s = tmp[3];
476 fluxy_sum_s = tmp[4];
477 fluxz_sum_s = tmp[5];
507 for ( n_bord=0; n_bord<domaine_EF.
nb_front_Cl(); n_bord++)
513 int nfin = ndeb + le_bord.
nb_faces();
514 if (domaine_EF.
domaine().bords_a_imprimer().contient(le_bord.
le_nom()))
516 if (
je_suis_maitre()) Flux_grad_face <<
"# Force par face sur " << le_bord.
le_nom() <<
" au temps " << temps <<
" : " << finl;
517 for (face=ndeb; face<nfin; face++)
520 Flux_grad_face <<
"# Face a x= " << domaine_EF.
xv(face,0) <<
" y= " << domaine_EF.
xv(face,1) <<
" flux_x= " <<
flux_bords_(face,0) <<
" flux_y= " <<
flux_bords_(face,1) << finl;
522 Flux_grad_face <<
"# Face a x= " << domaine_EF.
xv(face,0) <<
" y= " << domaine_EF.
xv(face,1) <<
" z= " << domaine_EF.
xv(face,3) <<
" flux_x= " <<
flux_bords_(face,0) <<
" flux_y= " <<
flux_bords_(face,1) <<
" flux_z= " <<
flux_bords_(face,2) << finl;
class Champ_Don_base base class of Given Fields (not calculated)
DoubleTab & valeurs() override
Returns the array of field values at the current time.
class Champ_P0_EF Represents a P0-per-element discrete field associated with a domain discretized as ...
class Cond_lim Generic class used to represent any class
static void verifier(const char *const msg, double)
Dirichlet This class is the base class of the hierarchy of Dirichlet-type boundary conditions.
void discretiser_champ(const Motcle &directive, const Domaine_dis_base &z, const Nom &nom, const Nom &unite, int nb_comp, int nb_pas_dt, double temps, OWN_PTR(Champ_Inc_base)&champ, const Nom &sous_type=NOM_VIDE) const
int nb_som_elem() const
Returns the number of vertices of the geometric elements that make up the domain.
int_t nb_elem_tot() const
DoubleTab_t & les_sommets()
const DoubleTab_t & coord_sommets() const
const ArrOfDouble & cg_moments() const
void imposer_symetrie(DoubleTab &, int tous_les_sommets_sym=0) const
Imposes symmetry conditions, i.e. cancels the field components along the normal(s).
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
const DoubleVect & porosite_sommet() const
const DoubleTab & Bij_thilde() const
virtual double face_normales(int face, int comp) const
double xv(int num_face, int k) const
int face_sommets(int i, int j) const
Returns the index of the i-th vertex of face num_face.
virtual double surface(int i) const
int nb_som_face() const
Returns the number of vertices per face.
double xp(int num_elem, int k) const
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
int nb_faces_bord() const
Returns the number of faces on which boundary conditions are applied:
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
const Domaine & domaine() const
An input stream whose source is a character string.
Sortie & syncfile() override
Triggers writing to disk of the data accumulated on the different processors since the last call to s...
Class defining operators and methods for all reading operation in an input flow (file,...
Probleme_base & probleme()
Returns the problem associated with the equation.
int num_premiere_face() const
int num_face(const int) const
const Nom & le_nom() const override
Returns the name of the geometric boundary.
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Navier_Stokes_std This class carries the terms of the momentum equation.
Champ_Inc_base & pression_pa()
Neumann_sortie_libre This class represents an open boundary without imposed velocity.
virtual double flux_impose(int i) const
Returns the value of the imposed flux on the i-th component of the field representing the flux at the...
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.
DoubleTab & calculer(const DoubleTab &, DoubleTab &) const override
DoubleTab & ajouter(const DoubleTab &, DoubleTab &) const override
OWN_PTR(Champ_Don_base) int_P_bord_
void associer(const Domaine_dis_base &, const Domaine_Cl_dis_base &, const Champ_Inc_base &) override
void mettre_a_jour(double) override
DOES NOTHING - to override in derived classes.
void ajouter_bord(DoubleTab &resu, const Domaine_EF &domaine_EF, const Domaine_Cl_EF &domaine_Cl_EF) const
int impr(Sortie &os) const override
DOES NOTHING - to override in derived classes.
void calculer_flux_bords() const override
Classe Operateur_Grad_base This class is the base of the hierarchy of operators representing.
SFichier Flux_grad_moment
virtual void mettre_a_jour(double temps)
DOES NOTHING - to override in derived classes.
void ouvrir_fichier_partage(EcrFicPartage &, const Nom &, const int flag=1) const
Opening/creation of a shared file for printing an operator. To override in derived classes.
void ouvrir_fichier(SFichier &os, const Nom &, const int flag=1) const
Opening/creation of a file for printing an operator. To override in derived classes.
const Discretisation_base & discretisation() const
Returns the discretization associated with the problem.
const Schema_Temps_base & schema_temps() const
Returns the time scheme associated with the problem.
static void mp_sum_for_each(T &arg1, T &arg2)
C++14 compatible mp_sum_for_each: combine multiple mp_sum calls into one collective operation Usage: ...
static void mp_sum_for_each_item(TRUSTArray< _TYPE_ > &x, int n=-1)
static int je_suis_maitre()
Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
double temps_courant() const
Returns the current time.
Base class for output streams.
_SIZE_ dimension(int d) const
_TYPE_ mp_max_abs_vect(Mp_vect_options opt=VECT_REAL_ITEMS) const
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")
void Compute(const int idimg, const int nbnn, const int npgau, ArrOfDouble &xgau, ArrOfDouble &frgau, ArrOfDouble &dfrgau, ArrOfDouble &poigau) const