16#include <Discretisation_base.h>
17#include <Equation_IBM_proto.h>
18#include <Schema_Temps_base.h>
19#include <Source_PDF_base.h>
20#include <Operateur_base.h>
21#include <Probleme_base.h>
22#include <Equation_base.h>
26#include <Perf_counters.h>
38 int nb_source_pdf = 0;
39 int nb_source = eq.
sources().size();
40 Cerr <<
"nb_source : " << nb_source << finl;
41 for(
int i = 0; i<nb_source; i++)
44 if ((eq.
sources())[i]->que_suis_je().find(
"Source_PDF") > -1)
52 Cerr<<
"(IBM) More than one Source_PDF_base detected."<<finl;
53 Cerr<<
"(IBM) Case not supported."<<finl;
54 Cerr<<
"Aborting..."<<finl;
60 Cerr<<
"(IBM) Immersed Interface with Source_PDF_base for equation : "<< eq_IBM_->le_nom()<<finl;
61 eq.
sources()[
i_source_pdf_]->set_description((
Nom)
"Sum of the PDF source term on the obstacle (~= force/power induced by the obstacle under some assumptions)");
68 if (
i_source_pdf_ == -1 && eq_IBM_->que_suis_je().debute_par(
"Navier_Stokes"))
70 Cerr <<
"No PDF source term read in your equation " << eq_IBM_->que_suis_je() <<
" !!!"<< finl;
71 Cerr <<
"Either add this source term or use a non_IBM problem !!!"<< finl;
81 Cerr<<
"(IBM) initTimeStep_IBM: update of immersed values for equation : "<< eq_IBM_->le_nom() <<finl;
87 Cerr<<
"(IBM) PDF_mobile : updating the shape following shape velocity"<<finl;
92 double delta_t = eq_IBM_->schema_temps().pas_de_temps();
93 double temps= eq_IBM_->schema_temps().temps_courant();
99 double raid = my_model.
raid();
108 Cerr<<
"(IBM) Immersed Interface: Dirichlet value in Equation for PDF (if any)."<<finl;
112 DoubleTab secmem_pdf(derivee);
114 derivee -= secmem_pdf;
119 if (pdf_bilan == 1|| pdf_bilan == 2)
121 int i_traitement_special = 101;
127 if (eq_IBM_->nombre_d_operateurs() > 1)
130 i_traitement_special = 101;
133 else if (nb_comp == 1)
136 i_traitement_special = 1;
140 Cerr <<
"Equation_IBM_proto: for scalar or vector only; dim = " <<nb_comp<< finl;
144 DoubleTrav secmem_pdf_time(derivee);
145 src.
calculer(secmem_pdf_time, i_traitement_special);
146 secmem_pdf += secmem_pdf_time;
148 else if(pdf_bilan != 0 )
150 Cerr<<
"Source_PDF_EF: Model pdf_bilan must be 0; 1 or 2 only"<<finl;
170 Cerr<<
"(IBM) preparer_calcul_IBM: Min/max coeff : "<< mp_min_vect(coeff) <<
" " << mp_max_vect(coeff) <<finl;
179 Cerr<<
"(IBM) Immersed Interface: modified initial variable."<<finl;
189 const double rhoCp = eq_IBM_->get_time_factor();
190 int size_s = eq_IBM_->sources().size();
193 for (
int op=0; op<eq_IBM_->nombre_d_operateurs(); op++)
194 eq_IBM_->operateur(op).l_op_base().tester_contribuer_a_avec(inco, matrice);
204 if ( eq_IBM_->probleme().discretisation().que_suis_je() ==
"EF")
209 eq_IBM_->sources().contribuer_a_avec(inco, matrice);
212 for (
int i = 0; i < size_s; i++)
214 if (eq_IBM_->sources()(i).valeur().que_suis_je().find(
"Source_PDF") <= -1)
216 const Source_base& src_base = eq_IBM_->sources()(i).valeur();
221 statistics().end_count(STD_COUNTERS::matrix_assembly);
223 eq_IBM_->sources().ajouter(resu);
226 for (
int i = 0; i < size_s; i++)
227 if (eq_IBM_->sources()(i).valeur().que_suis_je().find(
"Source_PDF") <= -1)
228 eq_IBM_->sources()(i).ajouter(resu);
230 statistics().begin_count(STD_COUNTERS::matrix_assembly,statistics().get_last_opened_counter_level()+1);
232 for (
int op = 0; op < eq_IBM_->nombre_d_operateurs(); op++)
234 eq_IBM_->operateur(op).l_op_base().contribuer_a_avec(inco, matrice);
235 eq_IBM_->operateur(op).l_op_base().contribuer_au_second_membre(resu);
240 Cerr <<
"VIA_CONTRIBUER_AU_SECOND_MEMBRE not coded for " << eq_IBM_->que_suis_je() <<
":assembler" << finl;
241 Cerr <<
"with discretisation " << eq_IBM_->probleme().discretisation().que_suis_je() <<
"" << finl;
260 for (
int op=0; op<eq_IBM_->nombre_d_operateurs(); op++)
264 eq_IBM_->operateur(op).l_op_base().contribuer_a_avec(inco, mat);
265 if (op == 1) mat *= rhoCp;
267 statistics().end_count(STD_COUNTERS::matrix_assembly);
269 DoubleTab resu_tmp(resu);
271 eq_IBM_->operateur(op).ajouter(inco, resu_tmp);
272 if (op == 1) resu_tmp *= rhoCp;
275 statistics().begin_count(STD_COUNTERS::matrix_assembly,statistics().get_last_opened_counter_level()+1);
278 eq_IBM_->sources().contribuer_a_avec(inco,matrice);
281 for (
int i = 0; i < size_s; i++)
282 if (eq_IBM_->sources()(i).valeur().que_suis_je().find(
"Source_PDF") <= -1)
284 const Source_base& src_base = eq_IBM_->sources()(i).valeur();
288 statistics().end_count(STD_COUNTERS::matrix_assembly);
290 eq_IBM_->sources().ajouter(resu);
293 for (
int i = 0; i < size_s; i++)
294 if (eq_IBM_->sources()(i).valeur().que_suis_je().find(
"Source_PDF") <= -1)
295 eq_IBM_->sources()(i).ajouter(resu);
297 statistics().begin_count(STD_COUNTERS::matrix_assembly,statistics().get_last_opened_counter_level()+1);
305 Cerr <<
"Unknown value in Convection_Diffusion_Temperature_IBM::assembler for " << (int)type_codage << finl;
311 for (
int i = 0; i < size_s; i++)
313 if (eq_IBM_->sources()(i).valeur().que_suis_je().find(
"Source_PDF") > -1)
315 const Source_base& src_base = eq_IBM_->sources()(i).valeur();
@ VIA_CONTRIBUER_AU_SECOND_MEMBRE
const DoubleTab_t & coord_sommets() const
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
const Domaine & domaine() const
Class defining operators and methods for all reading operation in an input flow (file,...
bool initTimeStep_ibm_proto(double ddt)
void modify_initial_variable_ibm_proto(DoubleTab &)
Entree & readOn_ibm_proto(Entree &is, Equation_base &eq)
void assembler_ibm_proto(Matrice_Morse &mat_morse, const DoubleTab &present, DoubleTab &secmem)
DoubleTab champ_coeff_pdf_som_
void preparer_calcul_ibm_proto()
void set_param_ibm_proto(Param ¶m) const
DoubleTab & derivee_en_temps_inco_ibm_proto(DoubleTab &)
int correction_variable_initiale_
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
Sources & sources()
Renvoie les termes sources asssocies a l'equation.
virtual DoubleVect & ajouter_multvect(const DoubleVect &x, DoubleVect &r) const
Operation de multiplication-accumulation (saxpy) matrice vecteur.
Classe Matrice_Morse Represente une matrice M (creuse), non necessairement carree.
class Nom Une chaine de caractere pour nommer les objets de TRUST
const Nom getSuffix(const char *const) const
const Nom & le_nom() const override
Renvoie *this;.
void affecter_vitesse_shape_IBM(Domaine_VF &, const DoubleTab &, double)
const DoubleTab & get_vitesse_shape_IBM() const
bool get_PDF_mobile() const
int is_vitesse_PDF_donnee() const
Helper class to factorize the readOn method of Objet_U classes.
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
classe Probleme_base C'est un Probleme_U qui n'est pas un couplage.
const Domaine_dis_base & domaine_dis() const
Renvoie le domaine discretise associe au probleme.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
class Source_PDF_base Base class for the source terms for the penalisation of the momentum in the Imm...
const PDF_model & get_modele() const
void set_sec_mem_pdf(DoubleTab &it)
void calculer_variable_imposee()
void update_elem_IBM(DoubleTab &, double, double)
DoubleTab & calculer_pdf(DoubleTab &) const
virtual DoubleTab compute_coeff_matrice() const
virtual void correct_variable(const DoubleTab &, DoubleTab &) const
DoubleTab & calculer(DoubleTab &) const override
classe Source_base Un objet Source_base est un terme apparaissant au second membre d'une
virtual void contribuer_a_avec(const DoubleTab &, Matrice_Morse &) const
contribution a la matrice implicite des termes sources par defaut pas de contribution
_SIZE_ dimension(int d) const
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")