TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
IJK_switch_FT.cpp
1/****************************************************************************
2* Copyright (c) 2015 - 2016, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#include <IJK_switch_FT.h>
17#include <init_forcage_THI.h>
18#include <corrections_qdm.h>
19#include <Force_sp.h>
20
21
22Implemente_instanciable(Switch_FT_double, "Switch_FT_double", Switch_double);
23// XD Switch_FT_double Switch_double Switch_FT_double BRACE not_set
25{
26 return s;
27}
28
30{
31 return s;
32}
33
35{
37
38 // Parametres pour le FT:
39 param.ajouter("interfaces", &interfaces_);
40 param.ajouter("old_ijk_splitting_ft_extension", &old_ijk_splitting_ft_extension_); // XD_ADD_P entier
41 // XD_CONT not_set
42
43 // Parametres pour la thermique:
44 param.ajouter("thermals", &thermals_);
45
46 /*
47 * GAB : gabriel.ramirez@cea.fr
48 * Parametres pour le forcage spectral
49 * Voir reprendre probleme dans Probleme_FTD_IJK_base.cpp
50 */
51 param.ajouter("forcage", &old_forcage_);
52 // Parametres pour la correction de qdm
53 param.ajouter("corrections_qdm", &old_qdm_corrections_);
54 param.ajouter("reprise_vap_velocity_tmoy", &vap_velocity_tmoy_);
55 param.ajouter("reprise_liq_velocity_tmoy", &liq_velocity_tmoy_);
56 param.ajouter("vitesse_upstream_reprise", &vitesse_upstream_reprise_);
57 param.ajouter("velocity_bubble_old", &velocity_bubble_old_);
58}
59
61{
63 Nom prefix = dirname(nom_reprise_);
65 interfaces_.set_fichier_reprise(prefix + interfaces_.get_fichier_reprise());
66 if (!thermals_.est_vide())
67 thermals_.set_fichier_reprise(prefix + thermals_.get_fichier_reprise());
69}
70
71
73{
74 Cout << que_suis_je() <<"::initialise() Pb of type Probleme_FTD_IJK_base detected." << finl;
75
76 // Probleme of type FT:
77 // old_mesh_ and new_mesh_ are acutally splittings...
78 const double dx = old_mesh_.get_constant_delta(DIRECTION_I);
79 const double dy = old_mesh_.get_constant_delta(DIRECTION_J);
80
81 const double new_dx = new_mesh_.get_constant_delta(DIRECTION_I);
82 const double new_dy = new_mesh_.get_constant_delta(DIRECTION_J);
83 const Nom& vdf_name = new_mesh_.le_nom()+Nom("_VDF");
84
85 const double old_to_new_ratio = std::min(dx/new_dx, dy/new_dy);
86 const int new_ijk_splitting_ft_extension = (int) std::lrint(std::ceil(old_ijk_splitting_ft_extension_* old_to_new_ratio));
87
88 Cerr << "Extended splitting dimensions. old = " << old_ijk_splitting_ft_extension_
89 << " new = " << new_ijk_splitting_ft_extension << finl;
90 Cerr << "Construction du domaine VDF..." << finl;
91 Domaine_IJK splitting_ft;
92 build_extended_splitting(new_mesh_, splitting_ft, new_ijk_splitting_ft_extension);
93
94 // Le probleme ft disc qui porte le maillage vdf pour les algorithmes front-tracking
95 Probleme_base& refprobleme_ft_disc = creer_domaine_vdf(splitting_ft, vdf_name);
96 const Domaine_dis_base& domaine_dis = refprobleme_ft_disc.domaine_dis();
97
99 {
100 interfaces_.initialize(splitting_ft /* splitting_FT */,
101 new_mesh_ /* splitting_NS */,
102 domaine_dis,
103 0,
104 false,
105 true);
106 //interfaces_.associer_switch(*this);
107 interfaces_.set_reprise(1);
108 interfaces_.lire_maillage_ft_dans_lata();
109 }
111
112 // GAB
113 const int nproc_tot = Process::nproc();
114 old_forcage_.compute_initial_chouippe(nproc_tot,old_mesh_,old_ni_,old_nj_,old_nk_,splitting_ft,nom_sauvegarde_);
115 new_forcage_.compute_initial_chouippe(nproc_tot,new_mesh_,new_ni_,new_nj_,new_nk_,splitting_ft,nom_sauvegarde_);
116 Cout << "new_forcage_.get_semi_gen()" << new_forcage_.get_semi_gen() << finl;
117 Cout << "old_forcage_.get_semi_gen()" << old_forcage_.get_semi_gen() << finl;
118 Cout << "new_forcage_.get_b_flt()" << new_forcage_.get_b_flt() << finl;
119}
120
122{
123 // init_thermals() does both the allocate and the initialize()
124 // thermals_.associer_switch(*this);
125 thermals_.init_switch_thermals(old_mesh_);
126}
127
129{
130 thermals_.prepare_thermals(lata_name);
131}
132
133// flag and_lata to know if we also create the associated lata
134void Switch_FT_double::ecrire_fichier_reprise(const char *fichier_sauvegarde, const bool and_lata)
135{
136 Nom lata_name(fichier_sauvegarde);
137 lata_name += ".lata";
138
140 {
141 Cerr << "T= " << current_time_ << " Checkpointing dans le fichier " << fichier_sauvegarde << finl;
142 SFichier fichier(fichier_sauvegarde);
143 fichier.precision(17);
144 fichier.setf(std::ios_base::scientific);
145 fichier << "{\n"
146 << " tinit " << current_time_ << "\n"
147 << " terme_acceleration_init " << terme_source_acceleration_ << "\n"
148 << " terme_acceleration_init_z " << terme_source_acceleration_z_ << "\n"
149 << " reprise_vap_velocity_tmoy " << vap_velocity_tmoy_ << "\n"
150 << " reprise_liq_velocity_tmoy " << liq_velocity_tmoy_ << "\n"
151 << " velocity_bubble_old " << velocity_bubble_old_ << "\n"
152 << " vitesse_upstream_reprise " << vitesse_upstream_reprise_ << "\n"
153 << " fichier_reprise_vitesse " << lata_name << "\n"
154 << " timestep_reprise_vitesse 1\n";
155
156 interfaces_.set_fichier_sauvegarde(lata_name);
157 Cerr << " saving interfaces... " << finl;
158 fichier << " interfaces " << interfaces_ << "\n";
159 fichier << " forcage " << new_forcage_;
160 fichier << " corrections_qdm " << new_qdm_corrections_;
161
162 Cerr << " potentially saving temperature fields... " << finl;
163
164 thermals_.ecrire_fichier_reprise(fichier, lata_name);
165
166 fichier << "}\n";
167 }
168
169 if (and_lata)
170 {
171 ecrire_header_lata(lata_name);
172 write_velocity(lata_name);
173 }
174}
175
176void Switch_FT_double::ecrire_header_lata(const Nom lata_name) // const
177{
180 {
181 Cout << "Adding interfaces into " << lata_name << finl;
182 interfaces_.sauvegarder_interfaces(lata_name);
183 }
184 // Le bloc suivant aurait pour consequence d'ecrire la temperature initiale (sur le maillage relu)
185 // (car c'est pour lui qu'on a fait un allocate dans l'objet thermique pour le relire)
186 // dans le fichier de sauvegarde des champs exrits pour la reprise. Ce n'est pas ce que l'on veut.
187 // On avait pu se permettre cela pour l'interface car on ecrit directement celui qu'on a relu, meme
188 // s'il n'a pas le bon support (le vieux geom).
189}
190
192{
194 param.ajouter("interfaces", & interfaces_);
195 param.ajouter("thermals", & thermals_);
196 // GAB : gabriel.rmairez@cea.fr
197 /* Voir reprendre probleme dans Probleme_FTD_IJK_base.cpp */
198 param.ajouter("forcage", &new_forcage_);
199 param.ajouter("corrections_qdm", &new_qdm_corrections_);
200 param.ajouter("reprise_vap_velocity_tmoy", &vap_velocity_tmoy_);
201 param.ajouter("reprise_liq_velocity_tmoy", &liq_velocity_tmoy_);
202 // fin GAB : gabriel.ramirez@cea.fr
203 param.ajouter("vitesse_upstream_reprise", &vitesse_upstream_reprise_);
204 param.ajouter("velocity_bubble_old", &velocity_bubble_old_);
205}
206
208 DoubleTab& coeff_i, IntTab Indice_i,
209 DoubleTab& coeff_j, IntTab Indice_j,
210 DoubleTab& coeff_k, IntTab Indice_k)
211{
212 thermals_.compute_new_thermal_field((*this),
213 new_mesh_,
214 lata_name,
215 coeff_i,
216 Indice_i,
217 coeff_j,
218 Indice_j,
219 coeff_k,
220 Indice_k);
221}
222
224 DoubleTab& coeff_i, IntTab Indice_i,
225 DoubleTab& coeff_j, IntTab Indice_j,
226 DoubleTab& coeff_k, IntTab Indice_k)
227{
228 // Use writing_direct = 0 instead...
229}
230
231
232
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
Definition Domaine_IJK.h:47
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
static bool DISABLE_DIPHASIQUE
Definition Option_IJK.h:26
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
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 int nproc()
renvoie le nombre de processeurs dans le groupe courant Voir Comm_Group::nproc() et PE_Groups::curren...
Definition Process.cpp:104
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
Definition Process.cpp:86
Cette classe est a la classe C++ ofstream ce que la classe Sortie est a la classe C++ ostream Elle re...
Definition SFichier.h:27
void precision(int pre) override
void setf(IOS_FORMAT code) override
Classe de base des flux de sortie.
Definition Sortie.h:52
corrections_qdm old_qdm_corrections_
init_forcage_THI old_forcage_
void set_param_reprise(Param &param) override
init_forcage_THI new_forcage_
void initialise() override
IJK_Interfaces interfaces_
double vap_velocity_tmoy_
int old_ijk_splitting_ft_extension_
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) override
double liq_velocity_tmoy_
void prepare_run() override
double vitesse_upstream_reprise_
double velocity_bubble_old_
corrections_qdm new_qdm_corrections_
void ecrire_header_lata(const Nom lata_name) override
void set_param(Param &param) const override
void prepare_thermals(const Nom lata_name) override
void init_thermals() override
void ecrire_fichier_reprise(const char *fichier_sauvegarde, const bool and_lata=true) override
IJK_Thermals thermals_
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) override
virtual void set_param_reprise(Param &param)
double current_time_
Definition IJK_switch.h:129
virtual void ecrire_header_lata(const Nom lata_name)
Domaine_IJK old_mesh_
Definition IJK_switch.h:95
virtual void initialise()
double terme_source_acceleration_
Definition IJK_switch.h:130
virtual void prepare_run()
double terme_source_acceleration_z_
Definition IJK_switch.h:131
Nom fichier_old_vitesse_
Definition IJK_switch.h:154
virtual void set_param(Param &param) const override
void write_velocity(const Nom lata_name) const
Domaine_IJK new_mesh_
Definition IJK_switch.h:94