15#include <ALE_ProjectionManager.h>
16#include <Domaine_VEF.h>
17#include <Navier_Stokes_std.h>
18#include <Operateur_Diff.h>
19#include <Operateur_Grad.h>
20#include <communications.h>
22#include <Schema_Temps_base.h>
23#include <Probleme_base.h>
24#include <Equation_base.h>
30 name_ALE_boundary_projection_ =
Noms();
31 name_boundary_with_Neumann_BC_ =
Noms();
36 Motcle accolade_ouverte(
"{"), accolade_fermee(
"}"), motlu;
41 if (motlu != accolade_ouverte)
43 Cerr <<
"Error reading 'Projection_ALE_boundary': expected "
44 << accolade_ouverte <<
", got " << motlu << finl;
49 Cerr <<
"Number of ALE projection boundaries : " << nb_projection << finl;
50 field_ALE_projection_.dimensionner(nb_projection);
57 if (motlu == accolade_fermee)
break;
58 name_ALE_boundary_projection_.add(nomlu);
59 is >> field_ALE_projection_[compteur++];
65 Motcle accolade_ouverte(
"{"), accolade_fermee(
"}"), motlu;
70 if (motlu != accolade_ouverte)
72 Cerr <<
"Error reading 'ALE_Neumann_BC_for_grid_problem': expected "
73 << accolade_ouverte <<
", got " << motlu << finl;
78 Cerr <<
"Number of Neumann BC boundaries for grid problem : " << nb_boundary << finl;
84 if (motlu == accolade_fermee)
break;
85 name_boundary_with_Neumann_BC_.add(nomlu);
88 if (nb_boundary != name_boundary_with_Neumann_BC_.size())
90 Cerr <<
"Error in ALE_Neumann_BC_for_grid_problem: declared count ("
91 << nb_boundary <<
") differs from list size ("
92 << name_boundary_with_Neumann_BC_.size() <<
")." << finl;
99 for (
int i = 0; i < name_boundary_with_Neumann_BC_.size(); i++)
100 if (nom == name_boundary_with_Neumann_BC_[i])
106 int nb_bords_ALE,
const Bords& les_bords_ALE,
109 const int size = field_ALE_projection_.size();
110 if (size == 0)
return;
112 Cerr <<
"ALE_ProjectionManager::update" << finl;
118 const DoubleTab& xv = le_dom_vef.
xv();
119 DoubleTab& flux_bords_grad = op_grad.
flux_bords();
120 DoubleTab& flux_bords_diff = op_diff.
flux_bords();
122 DoubleVect modalForce(size);
126 for (
int n = 0; n < nb_bords_ALE; n++)
128 const Nom& le_nom_bord = les_bords_ALE(n).le_nom();
129 for (
int i = 0; i < size; i++)
131 if (name_ALE_boundary_projection_[i] != le_nom_bord)
continue;
132 if (flux_bords_grad.
size() != flux_bords_diff.
size() || flux_bords_grad.
size() == 0)
135 const int ndeb = les_bords_ALE(n).num_premiere_face();
136 const int nfin = ndeb + les_bords_ALE(n).
nb_faces();
138 for (
int face = ndeb; face < nfin; face++)
139 for (
int comp = 0; comp < dimension; comp++)
141 const double phi = field_ALE_projection_[i].evaluate(
142 temps, xv(face,0), xv(face,1), xv(face,2), comp);
143 modalForce[i] += (flux_bords_grad(face, comp) + flux_bords_diff(face, comp)) * phi;
152 const bool first_writing = (!eqn_hydr.
probleme().reprise_effectuee() &&
154 Nom filename(nom_cas);
155 filename +=
"_ModalFluideForce.out";
157 if (!modalForceProjectionALE_.is_open())
159 modalForceProjectionALE_.ouvrir(filename, (first_writing ? ios::out : ios::app));
160 modalForceProjectionALE_.setf(ios::scientific);
165 modalForceProjectionALE_ <<
"# Time t Boundary ";
166 for (
int i = 0; i < size; i++)
167 modalForceProjectionALE_ << name_ALE_boundary_projection_[i] <<
" ";
168 modalForceProjectionALE_ << finl;
171 modalForceProjectionALE_ << temps <<
" ";
172 for (
int i = 0; i < size; i++)
173 modalForceProjectionALE_ << modalForce[i] <<
" ";
174 modalForceProjectionALE_ << finl;
179 Nom& name_ALE_boundary_projection,
182 int nb_bords_ALE,
const Bords& les_bords_ALE,
185 Cerr <<
"ALE_ProjectionManager::update (single boundary)" << finl;
191 const DoubleTab& xv = le_dom_vef.
xv();
192 DoubleTab& flux_bords_grad = op_grad.
flux_bords();
193 DoubleTab& flux_bords_diff = op_diff.
flux_bords();
195 double modalForce = 0.;
197 for (
int n = 0; n < nb_bords_ALE; n++)
199 if (les_bords_ALE(n).le_nom() != name_ALE_boundary_projection)
continue;
200 if (flux_bords_grad.
size() != flux_bords_diff.
size() || flux_bords_grad.
size() == 0)
203 const int ndeb = les_bords_ALE(n).num_premiere_face();
204 const int nfin = ndeb + les_bords_ALE(n).
nb_faces();
206 for (
int face = ndeb; face < nfin; face++)
207 for (
int comp = 0; comp < dimension; comp++)
209 const double phi = field_ALE_projection.
evaluate(
210 temps, xv(face,0), xv(face,1), xv(face,2), comp);
211 modalForce += (flux_bords_grad(face, comp) + flux_bords_diff(face, comp)) * phi;
219 const bool first_writing = (!eqn_hydr.
probleme().reprise_effectuee() &&
221 Nom filename(nom_cas);
222 filename +=
"_ModalFluideForce_";
223 filename += name_ALE_boundary_projection;
225 filename += std::to_string(nb_mode);
228 if (!modalForceProjectionALE_.is_open())
230 modalForceProjectionALE_.ouvrir(filename, (first_writing ? ios::out : ios::app));
231 modalForceProjectionALE_.setf(ios::scientific);
235 modalForceProjectionALE_ <<
"# Time t Boundary "
236 << name_ALE_boundary_projection << finl;
238 modalForceProjectionALE_ << temps <<
" " << modalForce <<
" " << finl;
void read_projection_boundary(Entree &is)
void update(double temps, int nb_bords_ALE, const Bords &les_bords_ALE, const Nom &nom_cas, Equation_base &eqn)
bool is_neumann_boundary(const Nom &nom) const
void read_neumann_bc(Entree &is)
int_t nb_faces() const
Returns the total number of faces of all boundaries in the list.
double evaluate(double, double, double, int)
double xv(int num_face, int k) const
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....
Probleme_base & probleme()
Returns the problem associated with the equation.
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
A character string (Nom) in uppercase.
Navier_Stokes_std This class carries the terms of the momentum equation.
Operateur_Grad & operateur_gradient()
Returns the gradient operator associated with the equation.
Operateur_Diff & operateur_diff()
class Nom: a character string for naming TRUST objects.
An array of character strings (VECT(Nom)).
Operateur_base & l_op_base() override
Returns the underlying object upcast to Operateur_base.
Operateur_base & l_op_base() override
Returns the underlying object upcast to Operateur_base.
class Operateur_base This class is the base of the hierarchy of objects representing an
const Schema_Temps_base & schema_temps() const
Returns the time scheme associated with the problem.
static void mp_sum_for_each_item(TRUSTArray< _TYPE_ > &x, int n=-1)
static double mp_sum(double)
Computes the sum of x over all processors in the current group.
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.
int nb_pas_dt() const
Returns the number of time steps performed.