16#include <IJK_switch.h>
18#include <Probleme_base.h>
34 DoubleTab coeff_j ,IntTab Indice_j,
35 DoubleTab coeff_k ,IntTab Indice_k,
38 for (
int k = 0; k <
new_nk_; k++)
39 for (
int j = 0; j <
new_nj_; j++)
40 for (
int i = 0; i <
new_ni_; i++)
42 const int i2 = Indice_i[i];
43 const int j2 = Indice_j[j];
44 const int k2 = Indice_k[k];
46 for (
int di = 0; di < 2; di++)
47 for (
int dj = 0; dj < 2; dj++)
48 for (
int dk = 0; dk < 2; dk++)
49 x += coeff_i(i, di) * coeff_j(j, dj) * coeff_k(k, dk) *
old_velocity_[dir](i2+di, j2+dj, k2+dk);
57 DoubleTab coeff_i[3], coeff_j[3], coeff_k[3];
58 IntTab Indice_i[3], Indice_j[3], Indice_k[3];
59 for (
int dir = 0; dir < 3; dir++)
63 coeff_j[dir],Indice_j[dir],
64 coeff_k[dir],Indice_k[dir]);
67 for (
int k = 0; k <
new_nk_; k++)
71 for (
int dir = 0; dir < 3; dir++)
72 for (
int j = 0; j <
new_nj_; j++)
73 for (
int i = 0; i <
new_ni_; i++)
75 const int i2 = Indice_i[dir][i];
76 const int j2 = Indice_j[dir][j];
77 const int k2 = Indice_k[dir][k];
79 for (
int di = 0; di < 2; di++)
80 for (
int dj = 0; dj < 2; dj++)
81 for (
int dk = 0; dk < 2; dk++)
82 x += coeff_i[dir](i, di) * coeff_j[dir](j, dj) * coeff_k[dir](k, dk) *
old_velocity_[dir](i2+di, j2+dj, k2+dk);
83 tmp[(j * (
new_ni_+1) + i) * 3 + dir] = (
float)x;
85 Cerr <<
"Writing velocity, layer " << k <<
" / " <<
new_nk_ << endl;
95 Cerr <<
"Writing velocity, layer " << k <<
" / " <<
new_nk_ << endl;
188 if (mot ==
"statistiques_FT")
219 DoubleTab& coeff_j ,IntTab& Indice_j,
220 DoubleTab& coeff_k ,IntTab& Indice_k)
224 for (
int i = 0; i <
new_ni_; i++)
236 coeff_i(i,1) = 1. - coeff_i(i,0);
241 for (
int j = 0; j <
new_nj_; j++)
253 coeff_j(j,1) = 1. - coeff_j(j,0);
257 for (
int k = 0; k <
new_nk_; k++)
279 coeff_k(k,1) = 1. - coeff_k(k,0);
289 const int kmin =
old_mesh_.get_offset_local(DIRECTION_K);
290 const bool own_last = (kmin+
old_nk_ ==
old_mesh_.get_nb_elem_tot(DIRECTION_K));
312 const double s_dx =
old_mesh_.get_constant_delta(DIRECTION_I);
313 const double s_dy =
old_mesh_.get_constant_delta(DIRECTION_J);
314 const ArrOfDouble& s_dz =
old_mesh_.get_delta(DIRECTION_K);
328 double s_origin_x = old_xyz0[DIRECTION_I] ;
329 double s_origin_y = old_xyz0[DIRECTION_J] ;
330 double s_origin_z = old_xyz0[DIRECTION_K] ;
333 for (
int k=1; k <
old_nk_ ; k++)
334 old_z_[k] =
old_z_[k-1] + 0.5*s_dz[k-1] + 0.5 * s_dz[k];
342 const int kmin =
old_mesh_.get_offset_local(DIRECTION_K);
343 const bool own_last = (kmin+
old_nk_ ==
old_mesh_.get_nb_elem_tot(DIRECTION_K));
351 old_x_[-1]= s_origin_x-s_dx;
352 for (
int i =0 ; i <=
old_ni_ ; i++)
356 old_y_[-1]=s_origin_y-s_dy;
357 for (
int j =0 ; j <=
old_nj_ ; j++)
361 const double c_dx =
new_mesh_.get_constant_delta(DIRECTION_I);
362 const double c_dy =
new_mesh_.get_constant_delta(DIRECTION_J);
363 const ArrOfDouble& c_dz =
new_mesh_.get_delta(DIRECTION_K);
374 double c_origin_x = new_xyz0[DIRECTION_I] ;
375 double c_origin_y = new_xyz0[DIRECTION_J] ;
376 double c_origin_z = new_xyz0[DIRECTION_K] ;
379 for (
int k=1; k <
new_nk_ ; k++)
380 new_z_[k] =
new_z_[k-1] + 0.5*c_dz[k-1] + 0.5 * c_dz[k];
396 for (
int i =1 ; i <
new_ni_ ; i++)
401 for (
int j =1 ; j <
new_nj_ ; j++)
427 Cerr <<
"Error in calculer_coords_Vi: wrong dir" << finl;
435 Cout <<
"Dumping lata header and time into " << lata_name << finl;
441 DoubleTab coeff_i, IntTab Indice_i,
442 DoubleTab coeff_j ,IntTab Indice_j,
443 DoubleTab coeff_k ,IntTab Indice_k)
const
447 const int ni = newf.
ni();
448 const int nj = newf.
nj();
449 const int nk = newf.
nk();
450 for (
int k = 0; k < nk; k++)
451 for (
int j = 0; j < nj; j++)
452 for (
int i = 0; i < ni; i++)
454 const int i2 = Indice_i[i];
455 const int j2 = Indice_j[j];
456 const int k2 = Indice_k[k];
458 for (
int di = 0; di < 2; di++)
459 for (
int dj = 0; dj < 2; dj++)
460 for (
int dk = 0; dk < 2; dk++)
461 x += coeff_i(i, di) * coeff_j(j, dj) * coeff_k(k, dk) * oldf(i2+di, j2+dj, k2+dk);
468 const IJK_Field_double& fld,
469 DoubleTab coeff_i, IntTab Indice_i,
470 DoubleTab coeff_j ,IntTab Indice_j,
471 DoubleTab coeff_k ,IntTab Indice_k)
474 for (
int k = 0; k <
new_nk_; k++)
477 for (
int j = 0; j <
new_nj_; j++)
478 for (
int i = 0; i <
new_ni_; i++)
480 const int i2 = Indice_i[i];
481 const int j2 = Indice_j[j];
482 const int k2 = Indice_k[k];
484 for (
int di = 0; di < 2; di++)
485 for (
int dj = 0; dj < 2; dj++)
486 for (
int dk = 0; dk < 2; dk++)
487 x += coeff_i(i, di) * coeff_j(j, dj) * coeff_k(k, dk) * fld(i2+di, j2+dj, k2+dk);
488 tmp[j *
new_ni_ + i] = (float)x;
490 Cerr <<
"Writing field, layer " << k <<
" / " <<
new_nk_ << endl;
519 Cout <<
"Adding velocities to " << lata_name << finl;
528 f.
ouvrir(lata_name, ios::app);
532 n = ((
long long)
new_mesh_.get_nb_elem_tot(DIRECTION_I)+1)
533 * ((
long long)
new_mesh_.get_nb_elem_tot(DIRECTION_J)+1)
534 * ((
long long)
new_mesh_.get_nb_elem_tot(DIRECTION_K)+1);
535 snprintf(sz_string, 100,
"%lld", n);
536 f <<
"Champ VELOCITY " << (lata_name +
Nom(
".VELOCITY.data")) <<
" geometrie=" <<
new_mesh_.le_nom() <<
" size=" << sz_string
537 <<
" localisation=FACES composantes=3 nature=vector" << finl;
545 Cerr <<
"IJK_problem_double::run()" << finl;
594 Cout <<
"Forcing zero velocities at walls on the old velocity field" << finl;
605 Cout <<
"direct_write est nul ";
607 for (
int dir = 0 ; dir < 3 ; dir ++)
622 Cout <<
"Forcing zero velocities at walls on the new velocity field" << finl;
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
Localisation
Localisation sub class.
Class defining operators and methods for all reading operation in an input flow (file,...
static Objet_U & objet_global(const Nom &nom)
cherche l'objet demande dans l'Interprete_bloc courant (Interprete_bloc::interprete_courant()) et dan...
Classe de base des objets "interprete".
Cette classe implemente les operateurs et les methodes virtuelles de la classe EFichier de la facon s...
Une chaine de caractere (Nom) en majuscules.
class Nom Une chaine de caractere pour nommer les objets de TRUST
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
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.
void ajouter_non_std(const char *keyword, const Objet_U *value, Param::Nature nat=Param::OPTIONAL)
Register a keyword handled by Objet_U::lire_motcle_non_standard.
int lire_avec_accolades(Entree &is)
Alias of lire_avec_accolades_depuis.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
Cette classe est a la classe C++ ofstream ce que la classe Sortie est a la classe C++ ostream Elle re...
virtual int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::out)
Classe de base des flux de sortie.
virtual int put(const unsigned *ob, std::streamsize n, std::streamsize nb_colonnes=1)
void set_bin(bool bin) override
Change le mode d'ecriture du fichier.
virtual void ecrire_fichier_reprise(const char *fichier_sauvegarde, const bool and_lata=true)=0
int lire_motcle_non_standard(const Motcle &mot, Entree &is) override
Lecture des parametres de type non simple d'un objet_U a partir d'un flot d'entree.
void calculer_coeff(DoubleTab &coeff_i, IntTab &Indice_i, DoubleTab &coeff_j, IntTab &Indice_j, DoubleTab &coeff_k, IntTab &Indice_k)
virtual void set_param_reprise(Param ¶m)
virtual void compute_and_write_extra_fields(const Nom &lata_name, DoubleTab &coeff_i, IntTab Indice_i, DoubleTab &coeff_j, IntTab Indice_j, DoubleTab &coeff_k, IntTab Indice_k)=0
void switch_vit_direct(SFichier &binary_file)
void switch_vit(DoubleTab coeff_i, IntTab Indice_i, DoubleTab coeff_j, IntTab Indice_j, DoubleTab coeff_k, IntTab Indice_k, const int dir)
virtual void ecrire_header_lata(const Nom lata_name)
void calculer_coords_Vi(const int dir)
ArrOfDouble_with_ghost new_x_
virtual void initialise()
double terme_source_acceleration_
ArrOfDouble_with_ghost old_z_
virtual void lire_fichier_reprise(const char *fichier_reprise)
IJK_Field_vector3_double new_velocity_
virtual void prepare_run()
double terme_source_acceleration_z_
int timestep_reprise_vitesse_
ArrOfDouble_with_ghost old_x_
IJK_Field_vector3_double old_velocity_
void calculer_coords_elem()
virtual void init_thermals()
Entree & interpreter(Entree &) override
void switch_scalar_field_direct(SFichier &binary_file, const IJK_Field_double &fld, DoubleTab coeff_i, IntTab Indice_i, DoubleTab coeff_j, IntTab Indice_j, DoubleTab coeff_k, IntTab Indice_k)
virtual void set_param(Param ¶m) const override
virtual void compute_and_write_extra_fields_direct(SFichier &file, DoubleTab &coeff_i, IntTab Indice_i, DoubleTab &coeff_j, IntTab Indice_j, DoubleTab &coeff_k, IntTab Indice_k)=0
virtual void allocate_fields(double &sz_arr)
void write_velocity(const Nom lata_name) const
ArrOfDouble_with_ghost old_y_
void switch_scalar_field(const IJK_Field_double &oldf, IJK_Field_double &newf, DoubleTab coeff_i, IntTab Indice_i, DoubleTab coeff_j, IntTab Indice_j, DoubleTab coeff_k, IntTab Indice_k) const
ArrOfDouble_with_ghost new_z_
virtual void prepare_thermals(const Nom lata_name)
void calculer_coords(const Domaine_IJK::Localisation loc)
ArrOfDouble_with_ghost new_y_
_SIZE_ size_array() const
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)