16#ifndef Iterateur_VDF_Elem_bis_TPP_included
17#define Iterateur_VDF_Elem_bis_TPP_included
19template <
class _TYPE_>
20void Iterateur_VDF_Elem<_TYPE_>::modifier_flux()
const
22 if (op_base->equation().inconnue().le_nom().debute_par(
"temperature")
25 DoubleTab& flux_bords=op_base->flux_bords();
27 const Champ_base& rho = (op_base->equation()).milieu().masse_volumique();
28 const Champ_Don_base& Cp = (op_base->equation()).milieu().capacite_calorifique();
31 int is_rho_u=op_base->equation().probleme().is_dilatable();
40 for (
int face = 0; face < nb_faces_bords; face++)
41 for(
int k = 0; k < flux_bords.
dimension(1); k++)
43 int e = (face_voisins(face, 0) != -1) ? face_voisins(face, 0) : face_voisins(face, 1);
44 const double rho_ = (is_rho_u) ? 1.0 : rho.valeurs()(!rho_uniforme * e, k);
45 flux_bords(face, k) *= rho_ * Cp.
valeurs()(!cp_uniforme * e, k);
50template <
class _TYPE_>
54 const Domaine& madomaine=le_dom->domaine();
55 const int impr_bord=(madomaine.bords_a_imprimer().est_vide() ? 0:1);
58 DoubleTab& flux_bords=op_base->flux_bords();
59 DoubleVect bilan(flux_bords.
dimension(1));
61 int nb_front_Cl=le_dom->nb_front_Cl();
62 DoubleTrav flux_bords2( 3, nb_front_Cl , flux_bords.
dimension(1));
67 for (
int num_cl=0; num_cl<nb_front_Cl; num_cl++)
69 const Cond_lim& la_cl = la_zcl->les_conditions_limites(num_cl);
72 int nfin = ndeb + frontiere_dis.
nb_faces();
73 int periodicite = (
type_cl(la_cl)==periodique?1:0);
74 for (face=ndeb; face<nfin; face++)
77 flux_bords2(0,num_cl,k)+=flux_bords(face, k);
80 if( face < (ndeb+frontiere_dis.
nb_faces()/2) ) flux_bords2(1,num_cl,k)+=flux_bords(face, k);
81 else flux_bords2(2,num_cl,k)+=flux_bords(face, k);
88 op_base->ouvrir_fichier(
Flux,
"",1);
90 for (
int num_cl=0; num_cl<nb_front_Cl; num_cl++)
92 const Cond_lim& la_cl = la_zcl->les_conditions_limites(num_cl);
93 int periodicite = (
type_cl(la_cl)==periodique?1:0);
96 bilan(k)+=flux_bords2(0,num_cl,k);
99 Flux.add_col(flux_bords2(1,num_cl,k));
100 Flux.add_col(flux_bords2(2,num_cl,k));
102 else Flux.add_col(flux_bords2(0,num_cl,k));
106 Flux.add_col(bilan(k));
109 const LIST(
Nom)& Liste_bords_a_imprimer = le_dom->domaine().bords_a_imprimer();
110 if (!Liste_bords_a_imprimer.est_vide())
113 op_base->ouvrir_fichier_partage(Flux_face,
"",impr_bord);
114 for (
int num_cl=0; num_cl<nb_front_Cl; num_cl++)
116 const Frontiere_dis_base& la_fr = la_zcl->les_conditions_limites(num_cl)->frontiere_dis();
117 const Cond_lim& la_cl = la_zcl->les_conditions_limites(num_cl);
120 if (madomaine.bords_a_imprimer().contient(la_fr.
le_nom()))
122 Flux_face <<
"# Flux par face sur " << la_fr.
le_nom() <<
" au temps " << temps <<
" : " << finl;
123 for (face=ndeb; face<nfin; face++)
126 Flux_face <<
"# Face a x= " << le_dom->xv(face,0) <<
" y= " << le_dom->xv(face,1);
128 Flux_face <<
"# Face a x= " << le_dom->xv(face,0) <<
" y= " << le_dom->xv(face,1) <<
" z= " << le_dom->xv(face,2);
133 Flux_face <<
" surface_face(m2)= " << le_dom_vdf.
face_surfaces(face);
134 Flux_face <<
" flux_par_surface(W/m2)= " << flux_bords(face, k)/le_dom_vdf.
face_surfaces(face);
136 Flux_face <<
" flux(W)= " << flux_bords(face, k);
149template <
class _TYPE_>
154 assert(resu.
nb_dim() < 3 && la_zcl && le_dom);
155 assert(op_base->flux_bords().dimension(0)==le_dom->nb_faces_bord());
158 contribuer_au_second_membre_bords<SingleDouble>(ncomp,resu);
159 contribuer_au_second_membre_interne<SingleDouble>(ncomp,resu);
163 contribuer_au_second_membre_bords<ArrOfDouble>(ncomp,resu);
164 contribuer_au_second_membre_interne<ArrOfDouble>(ncomp,resu);
168template <
class _TYPE_>
template <
typename Type_Double>
169void Iterateur_VDF_Elem<_TYPE_>::contribuer_au_second_membre_bords(
const int ncomp, DoubleTab& resu)
const
171 for (
int num_cl = 0; num_cl < le_dom->nb_front_Cl(); num_cl++)
173 const Cond_lim& la_cl = la_zcl->les_conditions_limites(num_cl);
176 switch(type_cl(la_cl))
179 contribuer_au_second_membre_bords_<_TYPE_::CALC_FLUX_FACES_SYMM,Type_Double>((
const Symetrie&) la_cl.valeur(),ndeb,nfin,ncomp,resu);
182 contribuer_au_second_membre_bords_<_TYPE_::CALC_FLUX_FACES_SORTIE_LIB,Type_Double>((
const Neumann_sortie_libre&) la_cl.valeur(),ndeb,nfin,ncomp,resu);
185 contribuer_au_second_membre_bords_<_TYPE_::CALC_FLUX_FACES_ENTREE_FL,Type_Double>((
const Dirichlet_entree_fluide&) la_cl.valeur(),ndeb,nfin,ncomp,resu);
188 contribuer_au_second_membre_bords_<_TYPE_::CALC_FLUX_FACES_PAR_FIXE,Type_Double>((
const Dirichlet_paroi_fixe&) la_cl.valeur(),ndeb,nfin,ncomp,resu);
190 case paroi_defilante :
191 contribuer_au_second_membre_bords_<_TYPE_::CALC_FLUX_FACES_PAR_DEFIL,Type_Double>((
const Dirichlet_paroi_defilante&) la_cl.valeur(),ndeb,nfin,ncomp,resu);
193 case paroi_adiabatique :
194 contribuer_au_second_membre_bords_<_TYPE_::CALC_FLUX_FACES_PAR_ADIAB,Type_Double>((
const Neumann_paroi_adiabatique&) la_cl.valeur(),ndeb,nfin,ncomp,resu);
197 contribuer_au_second_membre_bords_<_TYPE_::CALC_FLUX_FACES_PAR,Type_Double>((
const Neumann_paroi&) la_cl.valeur(),ndeb,nfin,ncomp,resu);
199 case echange_global_impose :
200 contribuer_au_second_membre_bords_<_TYPE_::CALC_FLUX_FACES_ECH_GLOB_IMP,Type_Double>((
const Echange_global_impose&) la_cl.valeur(),ndeb,nfin,ncomp,resu);
203 contribuer_au_second_membre_bords_<_TYPE_::CALC_FLUX_FACES_PERIO,Type_Double>((
const Periodique&) la_cl.valeur(),ndeb,nfin,ncomp,resu);
205 case echange_externe_impose :
206 contribuer_au_second_membre_bords_<Type_Double>((
const Echange_externe_impose&)la_cl.valeur(), ndeb,nfin,num_cl,ncomp,frontiere_dis,resu);
209 Cerr <<
"On ne reconnait pas la condition limite : " << la_cl.valeur() <<
" , dans T_It_VDF_Elem<_TYPE_>::contribuer_au_second_membre_bords" << finl;
216template <
class _TYPE_>
template <
typename Type_Double>
217void Iterateur_VDF_Elem<_TYPE_>::contribuer_au_second_membre_interne(
const int ncomp, DoubleTab& resu)
const
219 Type_Double flux(ncomp);
222 for (
int face = ndeb; face < nfin; face++)
224 const int elem0 = elem(face,0), elem1 = elem(face,1);
225 flux_evaluateur.secmem_faces_interne(face, flux);
226 for (
int k = 0; k < ncomp; k++)
228 resu(elem0,k) += flux[k];
229 resu(elem1,k) -= flux[k];
234template <
class _TYPE_>
template <
bool should_calc_flux,
typename Type_Double,
typename BC>
235void Iterateur_VDF_Elem<_TYPE_>::contribuer_au_second_membre_bords_(
const BC& cl,
const int ndeb,
const int nfin,
const int ncomp, DoubleTab& resu)
const
237 constexpr bool is_Periodique = std::is_same<BC,Periodique>::value;
238 if (should_calc_flux)
240 Type_Double flux(ncomp);
241 for (
int face = ndeb; face < nfin; face++)
243 flux_evaluateur.secmem_face(face, cl, ndeb, flux);
244 is_Periodique ? fill_flux_tables_(face,ncomp,0.5 ,flux,resu) : fill_flux_tables_(face,ncomp,1.0 ,flux,resu);
249template <
class _TYPE_>
template <
typename Type_Double>
250void Iterateur_VDF_Elem<_TYPE_>::contribuer_au_second_membre_bords_(
const Echange_externe_impose& cl,
const int ndeb,
const int nfin,
const int num_cl,
const int ncomp,
const Front_VF& frontiere_dis, DoubleTab& resu)
const
252 if (_TYPE_::CALC_FLUX_FACES_ECH_EXT_IMP)
254 Type_Double flux(ncomp);
255 int boundary_index=-1;
256 if (le_dom->front_VF(num_cl).le_nom() == frontiere_dis.
le_nom()) boundary_index = num_cl;
257 for (
int face = ndeb; face < nfin; face++)
259 int local_face=le_dom->front_VF(boundary_index).num_local_face(face);
260 flux_evaluateur.secmem_face(boundary_index,face,local_face, cl, ndeb, flux);
261 fill_flux_tables_(face,ncomp,1.0 ,flux,resu);
class Champ_Don_base base class of Given Fields (not calculated)
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
class Champ_base This class is the base of the fields hierarchy.
class Cond_lim Generic class used to represent any class
Dirichlet_entree_fluide This class represents a boundary condition imposing a quantity.
Dirichlet_paroi_defilante Imposes the wall velocity in an equation of type Navier_Stokes.
Dirichlet_paroi_fixe Represents a fixed wall in a Navier-Stokes type equation.
virtual const DoubleVect & face_surfaces() const
int nb_faces() const
Returns the total number of faces.
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.
int nb_faces_bord() const
Returns the number of faces on which boundary conditions are applied:
Classe Echange_externe_impose: This class represents the special case of the class.
Classe Echange_global_impose This class represents the special case of the class.
Sortie & syncfile() override
Triggers writing to disk of the data accumulated on the different processors since the last call to s...
int num_premiere_face() const
class Frontiere_dis_base Class representing a discretized boundary.
const Nom & le_nom() const override
Returns the name of the geometric boundary.
int impr(Sortie &os) const override
void contribuer_au_second_membre(DoubleTab &) const override
Type_Cl_VDF type_cl(const Cond_lim &) const
Classe Neumann_paroi_adiabatique This boundary condition corresponds to an adiabatic wall in a.
Classe Neumann_paroi This boundary condition corresponds to an imposed flux for the.
Neumann_sortie_libre This class represents an open boundary without imposed velocity.
class Nom: a character string for naming TRUST objects.
class Op_Conv_VDF_base Classe de base des operateurs de convection VDF
Operateur_Diff_base This class is the base of the hierarchy of operators representing.
class Operateur_base This class is the base of the hierarchy of objects representing an
class Periodique This class represents a periodic boundary condition.
static void mp_sum_for_each_item(TRUSTArray< _TYPE_ > &x, int n=-1)
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
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.
Symetrie On symmetry faces, the following properties hold:
_SIZE_ dimension(int d) const