16#include <Echange_contact_PolyMAC_CDO.h>
17#include <Champ_front_calc.h>
18#include <Probleme_base.h>
19#include <Champ_Uniforme.h>
20#include <Schema_Euler_Implicite.h>
21#include <Milieu_base.h>
22#include <Domaine_PolyMAC_CDO.h>
23#include <Equation_base.h>
24#include <Champ_Elem_PolyMAC_CDO.h>
25#include <Op_Diff_PolyMAC_CDO_Elem.h>
39 T_autre_pb_.typer(
"Champ_front_calc");
40 Champ_front_calc& ch=ref_cast(Champ_front_calc,
T_autre_pb());
42 le_champ_front.typer(
"Ch_front_var_instationnaire_dep");
64 int i, j, k, l, e, f, N = ch.
nb_comp(), o_n_f = o_e_f.dimension(1);
70 h_imp_.typer(
"Champ_front_fonc");
71 h_imp_->fixer_nb_comp(N);
72 h_imp_->valeurs().resize(0, N);
89 DoubleTrav o_proc(0, o_n_f), o_item(0, o_n_f), proc(0, o_n_f), l_item(0, o_n_f);
93 for (i = 0; i < o_fvf.nb_faces(); i++)
95 f = o_fvf.num_face(i), e = o_f_e(f, 0);
96 for (j = 0; j < o_n_f && o_e_f(e, j) != f; ) j++;
97 o_proc(f, 0) = src(e, 0), o_item(f, 0) = src(e, 1);
98 for (k = o_domaine.
w2i(o_domaine.
m2d(e) + j) + 1, l = 1; k < o_domaine.
w2i(o_domaine.
m2d(e) + j + 1); k++, l++)
101 o_proc(f, l) = src(idx, 0), o_item(f, l) = src(idx, 1);
103 for (c_max = std::max(c_max, l); l < o_n_f; l++) o_proc(f, l) = o_item(f, l) = -1;
108 if (o_fvf.frontiere().que_suis_je() ==
"Raccord_distant_homogene")
109 o_fvf.frontiere().trace_face_distant(o_proc, proc), o_fvf.frontiere().trace_face_distant(o_item, l_item);
110 else o_fvf.frontiere().trace_face_local(o_proc, proc), o_fvf.frontiere().trace_face_local(o_item, l_item);
114 for (i = 0; i < fvf.
nb_faces(); i++)
115 for (j = 0; j < c_max && l_item(i, j) >= 0; j++)
116 if (proc(i, j) ==
Process::me())
item(i, j) = (int)std::lrint(l_item(i, j));
119 if (o_domaine.
virt_ef_map.count({{ (int) proc(i, j), (int) l_item(i, j) }}))
121 item(i, j) = o_domaine.
virt_ef_map.at({{ (int) proc(i, j), (int) l_item(i, j) }});
123 else Process::exit(
Nom(
"Echange_contact_PolyMAC_CDO: missing item opposite face ") +
Nom(fvf.
num_face(i)) +
" on " + fvf.
le_nom() +
" ! Have you used Decouper_multi?");
127 coeff.resize(0, 1 + item.dimension(1), N), delta_int.resize(0, N, 2),
128 fvf.frontiere().creer_tableau_faces(coeff);
132 delta.resize(0, item.dimension(1), N);
133 fvf.frontiere().creer_tableau_faces(delta_int), fvf.frontiere().creer_tableau_faces(delta);
135 coeffs_a_jour_ = 0, delta_a_jour_ = (stab_ ? 1 : 0);
158 DoubleTrav o_Text, o_Himp, o_coeff, o_delta_int, nu_ef(e_f.
dimension(1), N);
161 for (
int i = 0; i < o_fvf.
nb_faces(); i++)
164 for (j = 0; j < e_f.
dimension(1) && (fb = e_f(e, j)) >= 0; j++)
165 if (fb == f) i_f = j;
169 for (j = o_domaine.
w2i(o_domaine.
m2d(e) + i_f), idx = 0; j < o_domaine.
w2i(o_domaine.
m2d(e) + i_f + 1); j++, idx++)
170 for (fb = e_f(e, o_domaine.
w2j(j)), n = 0; n < N; n++)
172 double fac = fs(fb) / ve(e) * o_domaine.
w2c(j) * nu_ef(o_domaine.
w2j(j), n);
174 o_coeff(f, idx ? idx + 1 : 0, n) += fs(f) * fac, o_coeff(f, 1, n) -= fs(f) * fac;
177 if (f == fb) o_Himp(f, n) += fac;
178 else o_Text(f, n) -= fac * o_inc.
valeurs()(ne_tot + fb, n);
179 o_Text(f, n) += fac * o_inc.
valeurs()(e, n);
183 for (k = 0; k < 2; k++) o_delta_int(f, n, k) = o_op_diff.
delta_f_int(f, n, k);
185 if (o_Himp(f, n) > 1e-10) o_Text(f, n) /= o_Himp(f, n);
186 for (n = 0;
h_paroi < 1e9 && n < N; n++)
191 if (
stab_) o_delta_int(f, n, 0) *= fac;
192 for (j = 0; j < o_coeff.
dimension(1); j++) o_coeff(f, j, n) *= fac;
194 else o_Himp(f, n) *= fac;
231 DoubleTrav o_delta(o_domaine.
nb_faces(),
item.dimension(1), N);
232 for (i = 0; i < o_fvf.
nb_faces(); i++)
235 for (j = 0; j < e_f.
dimension(1) && (fb = e_f(e, j)) >= 0; j++)
236 if (fb == f) i_f = j;
237 for (n = 0; n < N; n++) o_delta(f, 0, n) = o_op_diff.
delta_e(e, n);
238 for (j = o_domaine.
w2i(o_domaine.
m2d(e) + i_f) + 1, idx = 1; j < o_domaine.
w2i(o_domaine.
m2d(e) + i_f + 1); j++, idx++)
239 for (n = 0; n < N; n++) o_delta(f, idx, n) = o_op_diff.
delta_f(e_f(e, o_domaine.
w2j(j)), n);
245 delta.echange_espace_virtuel();
DoubleTab & valeurs() override
Returns the array of field values at the current time.
virtual void associer_fr_dis_base(const Frontiere_dis_base &)
Associates a discretized boundary with the field.
virtual DoubleTab & valeurs() override
Returns the array of field values.
class Champ_front_calc Derived class of Champ_front_var representing
const Frontiere_dis_base & front_dis() const
Returns the discretized boundary corresponding to the domain on which the trace is taken.
void creer(const Nom &, const Nom &, const Motcle &)
Create the Champ_front_calc object representing the trace of an unknown field on a boundary from name...
int initialiser(double, const Champ_Inc_base &) override
Initialization at the beginning of calculation.
const Equation_base & equation() const
Returns the equation associated with the unknown whose trace is taken.
const Champ_Inc_base & inconnue() const
Returns the associated unknown field.
const Domaine_dis_base & domaine_dis() const override
Returns the discretized domain associated with the equation carrying the unknown field whose trace is...
Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the domain of discretized boundary conditions to which the object belongs.
virtual void completer()
DOES NOTHING must be overridden in derived classes.
virtual Frontiere_dis_base & frontiere_dis()
Returns the discretized boundary to which the boundary conditions apply.
void init_virt_ef_map() const
std::map< std::array< int, 2 >, int > virt_ef_map
MD_Vector mdv_elems_faces
virtual const DoubleVect & face_surfaces() const
int nb_faces() const
Returns the total number of faces.
void creer_tableau_faces(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
double volumes(int i) const
int elem_faces(int i, int j) const
Returns the index of the i-th face of element num_elem; the face numbering convention is.
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
Classe Echange_externe_impose: This class represents the special case of the class.
int initialiser(double temps) override
Initialization at the beginning of the calculation.
virtual Champ_front_base & T_ext()
Returns the T_ext field of temperature imposed at the boundary.
void mettre_a_jour(double) override
Performs a time update of the boundary conditions.
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....
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
virtual const Operateur & operateur(int) const =0
virtual const Motcle & domaine_application() const
Returns "indeterminate" Navier_Stokes_standard for example overrides this method.
virtual void fixer_nb_comp(int i)
Sets the number of components of the field.
virtual int nb_comp() const
int num_face(const int) const
virtual void trace_face_distant(const DoubleTab &, DoubleTab &) const
virtual void trace_face_local(const DoubleTab &, DoubleTab &) const
virtual void creer_tableau_faces(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
Creates an array with one "row" per face of this boundary.
const Frontiere & frontiere() const
Returns the associated geometric boundary.
const Nom & le_nom() const override
Returns the name of the geometric boundary.
class Nom: a character string for naming TRUST objects.
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.
void update_delta() const
void update_delta_int() const
void remplir_nu_ef(int e, DoubleTab &nu_ef) const
void update_nu() const override
virtual Operateur_base & l_op_base()=0
static double mp_max(double)
static int me()
Returns the rank of the local processor in the current communication group. See Comm_Group::rank() an...
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Base class for output streams.
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
_SIZE_ dimension_tot(int) const override
_SIZE_ dimension(int d) const
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")