TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Domaine_ALE.h
1/****************************************************************************
2* Copyright (c) 2026, 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#ifndef Domaine_ALE_included
17#define Domaine_ALE_included
18
19#include <ALE_MetricsUpdater.h>
20#include <ALE_BeamCoupling.h>
21#include <ALE_ProjectionManager.h>
22#include <ALE_CheckpointManager.h>
23
24#include <Champ_front_base.h>
25#include <TRUSTLists.h>
26#include <Champ_P1NC.h>
27#include <Structural_dynamic_mesh_model.h>
28#include <TRUST_Ref.h>
29#include <Domaine.h>
30
31class Equation_base;
32
33/////////////////////////////////////////////////////////////////////////////
34// Classe Domaine_ALE
35//
36// Central coordinator for the Arbitrary Lagrangian-Eulerian (ALE) domain.
37// Manages a deforming mesh through a pluggable motion model and delegates
38// specialized responsibilities to dedicated sub-components.
39
40// Domaine_ALE (derives from Domaine)
41// │
42// ├── ALE_MetricsUpdater geometric metric updates (VEF/EF/PolyMAC)
43// ├── ALE_BeamCoupling beam model + fluid/structure force exchange
44// ├── ALE_ProjectionManager ALE boundary projection + modal forces + Neumann BCs
45// └── ALE_CheckpointManager save/restore additional state (binary + PDI)
46//
47// Mesh motion strategy is selected at runtime via meshMotionModel_:
48// 0 = Laplacian (private methods laplacien / fill_laplacian_matrix / ...)
49// 1 = Structural dynamics (str_mesh_model)
50// -1 = Boundary-only (no interior propagation)
51
52/////////////////////////////////////////////////////////////////////////////
53
54class Domaine_ALE : public Domaine
55{
56 Declare_instanciable_sans_constructeur(Domaine_ALE);
57
58public:
59
61 void clear() override;
62
63 inline const double& get_dt() const;
64 void set_dt(double& dt) override;
65
66 inline const DoubleTab& vitesse() const; // vertex mesh velocity
67 inline DoubleTab& vitesse_faces(); // face mesh velocity (writable)
68 inline const DoubleTab& vitesse_faces() const;
69
70 void initialiser (double temps, Domaine_dis_base&, Probleme_base&) override;
71 void mettre_a_jour (double temps, Domaine_dis_base&, Probleme_base&) override;
72 void update_after_post(double temps) override;
73 void validateTimeStep() override;
74
75
77
78 //==========================================================================
79 // Mesh motion model
80 // -1 = boundary-only (no interior propagation)
81 // 0 = Laplacian (default)
82 // 1 = Structural dynamics
83 //==========================================================================
84 inline int getMeshMotionModel() const { return meshMotionModel_; }
85
86 //==========================================================================
87 // ICoCo coupling
88 //==========================================================================
90 bool getCouplingMethod() const override;
91 bool getUpdateTheGrid() override;
92 void setUpdateTheGrid(bool) override;
93
94 //==========================================================================
95 // Post-processing / field registry
96 //==========================================================================
98 void creer_champ(const Motcle&, const Probleme_base&) override;
99 void get_noms_champs_postraitables(Noms& nom, Option opt = NONE) const override;
100 const Champ_base& get_champ(const Motcle&) const override;
101 bool has_champ(const Motcle& nom, OBS_PTR(Champ_base)& ref_champ) const override;
102 bool has_champ(const Motcle& nom) const override;
103 void update_post_fields(double temps, double dt);
104
105 //==========================================================================
106 // Save / restore (delegates to checkpoint_manager_)
107 //==========================================================================
108 std::vector<YAML_data> data_a_sauvegarder(const Probleme_base&) const override;
109 int save_additional_state (Sortie&, const Probleme_base&) const override;
111
112 // Helpers forwarded from checkpoint_manager_ (kept on Domaine_ALE for API compatibility)
114 YAML_data make_yaml (const std::string&, int, const Probleme_base&) const;
115 void create_field (OWN_PTR(Champ_Inc_base)&, const std::string&,
116 int, const Motcle&, const Probleme_base&) const;
117
118 //==========================================================================
119 // Volume / surface correction (called by NS solver)
120 //==========================================================================
121 void ajouter_correctif_volumique(const DoubleTab&, const DoubleTab&,
122 double, DoubleTab&) const override;
123 void apply_old_to_new_volume_scaling(DoubleTab&, const Domaine_dis_base&) const override;
124 const DoubleVect& old_volumes_entrelaces() const override;
125 const DoubleVect& old_volumes() const override;
126
127 //==========================================================================
128 // Lagrangian external velocity coupling
129 //==========================================================================
130 void associer_vitesse_lagrangienne(const Nom& nom_pb, const Nom& nom_champ);
131
132 //==========================================================================
133 // Surface extraction on a deformable moving boundary
134 //==========================================================================
135 inline const IntTab& les_elems_extrait_surf_reference() const;
136 inline void set_les_elems_extrait_surf_reference(const IntTab&);
137 inline bool extrait_surf_dom_deformable() const;
138 inline void set_extrait_surf_dom_deformable(bool);
140
141 //==========================================================================
142 // Input reading helpers (called during data-file parsing)
143 //==========================================================================
144 void reading_vit_bords_ALE (Entree& is);
146 void reading_beam_model (Entree& is);
150
151 //==========================================================================
152 // Face velocity computation
153 //==========================================================================
154 DoubleTab& calculer_vitesse_faces(DoubleTab&, int, int, IntTab&);
155
156 //==========================================================================
157 // Beam accessors (forwarded to beam_coupling_)
158 //==========================================================================
159 const DoubleTab& getBeamDisplacement(const int&, const int&) const;
160 const DoubleTab& getBeamRotation (const int&, const int&) const;
161 DoubleTab& getBeamVelocity (const int&, const double& tps, const double& dt);
162 const int& getBeamNbModes (const int&) const;
163 const int& getBeamNbPlanes (const int&) const;
164 const Nom& getBeamName (const int&) const;
165 const int& getBeamNbBeam () const;
166 const int& getBeamLongitudinalAxis (const int&) const;
167 const int& getBeamBendingDirection (const int&, const int&) const;
168 void computeFluidForceOnBeam (const int&);
169 double computeDtBeam (Domaine_dis_base&, const int&);
170
171 DoubleTab interpolationOnThe3DSurface (const int&, const double& x, const double& y,
172 const double& z, const DoubleTab& u,
173 const DoubleTab& R) const;
174 double interpolationPhiOnThe3DSurface(const int&, const double& x, const double& y,
175 const double& z, const int& comp,
176 const DoubleTab& u) const;
177
178 //==========================================================================
179 // Structural dynamics accessors (forwarded to str_mesh_model)
180 //==========================================================================
181 const DoubleVect& getMeshPbPressure () const;
182 const DoubleVect& getMeshPbVonMises () const;
183 const DoubleTab& getMeshPbForceFace() const;
184 const DoubleTab& getMeshDisplacement() const;
185 const DoubleTab& getMeshVelocity () const;
186 const DoubleTab& getMeshAcceleration() const;
187 const DoubleTab& getMeshPosition () const;
188 const DoubleTab& getMeshReferenceConfiguration () const;
189 const DoubleTab& getMeshTransformationGradient () const;
190 const DoubleTab& getMeshStress () const;
191 const int& getMeshReferenceConfigurationNbComp() const;
192 const int& getMeshTransformationGradientNbComp() const;
193 const int& getMeshStressNbComp() const;
194
195 void resumptionCoords(DoubleTab&);
196 void resumptionStructuralDynamicsMesh(double, DoubleTab&, DoubleTab&, DoubleTab&,
197 DoubleTab&, DoubleTab&, DoubleTab&, DoubleTab&);
198
200 void update_ALE_projection(const double);
201
202
204 const Equation_base& getEquation() const;
205
206
207 // Access to the champs_compris registry
208 inline Champs_compris& get_champs_compris() { return champs_compris_; }
209
210 // True when restarting from a checkpoint
211 inline bool is_resumption() const { return resumption != 0; }
212
213 // ALE moving boundary list .
214 inline int get_nb_bords_ALE() const { return nb_bords_ALE; }
215 inline const Bords& get_bords_ALE() const { return les_bords_ALE; }
216
217protected:
218
219 double dt_ = 0.;
220 DoubleTab ALE_mesh_velocity; // vertex mesh velocity (nb_som x dim)
221 DoubleTab vf; // face mesh velocity
223 SolveurSys solv; // linear solver for Laplacian mesh motion
224
225 int resumption = 0; // 1 if restarting from checkpoint
226
230
231 mutable OBS_PTR(Equation_base) eq; // lazy-initialized reference to first equation
232
233 //==========================================================================
234 // Structural dynamics mesh model (active when meshMotionModel_ == 1)
235 //==========================================================================
237
238 //==========================================================================
239 // Sub-components
240 //==========================================================================
241
242 // Geometric metric updates after mesh motion (VEF / EF / PolyMAC).
244
245 // Beam mechanical model: fluid/structure force exchange and interpolation.
247
248 // ALE boundary projection: vibration modes, modal forces, Neumann BC list.
250
251 // Checkpoint manager: save/restore ALE-specific state.
253
254 //==========================================================================
255 // Mesh motion model selector
256 //==========================================================================
258
259 //==========================================================================
260 // ICoCo coupling state
261 //==========================================================================
263 bool UpdateTheGrid = true;
264
265 //==========================================================================
266 // Surface extraction on a deformable moving boundary
267 //==========================================================================
270
271 //==========================================================================
272 // Post-processing fields
273 //==========================================================================
274 mutable Champs_compris champs_compris_;
275 OWN_PTR(Champ_Inc_base) ALEMeshVelocity_;
276 OWN_PTR(Champ_Inc_base) ALEMeshTotalDisplacement_;
277 OWN_PTR(Champ_Inc_base) ALEMeshStructuralPressure_;
278 OWN_PTR(Champ_Inc_base) ALEMeshStructuralVonMises_;
279 OWN_PTR(Champ_Inc_base) ALEMeshStructuralForces_;
280
281private:
282
283 //==========================================================================
284 // Vertex velocity
285 //==========================================================================
286 void compute_vertex_velocities(double temps, const Probleme_base&);
287 void remplir_vitesse_bord(const Probleme_base&, double temps, DoubleTab& vit_bords);
288 void update_vertex_coordinates(double dt);
289
290 //==========================================================================
291 // Mesh motion models
292 //==========================================================================
293 void laplacien (const Probleme_base&, const DoubleTab& vit_bords);
294 void build_laplacian_matrix(const Domaine_VF&, const Domaine_Cl_dis_base&);
295 void fill_laplacian_matrix (const Domaine_VF&, const Domaine_Cl_dis_base&);
296 void laplacien_compute_vertex_velocity(const Domaine_VF&, const Domaine_Cl_dis_base&,
297 const DoubleTab& vit_bords);
298 void structural_dynamics (const Probleme_base&, const DoubleTab& vit_bords, double temps);
299
300 //==========================================================================
301 // Setup / validation
302 //==========================================================================
303 void validate_ale_setup(const Probleme_base&) const;
304 void build_lagrangian_vertex_mapping(const Probleme_base& pb_v, const Champ_base&);
305 void check_external_vertex_velocity_compatibility(const DoubleTab&) const;
306
307 //==========================================================================
308 // Laplacian data
309 //==========================================================================
310 DoubleVect laplacian_rhs_;
311 Matrice_Morse_Sym laplacian_matrix_;
312
313 //==========================================================================
314 // Lagrangian external velocity coupling
315 //==========================================================================
316 IntVect external_vertex_id_for_ale_vertex_;
317 bool lagrangian_velocity_imposed_ = false;
318 Nom external_velocity_field_name_;
319 Nom external_pb_name_;
320
321 //==========================================================================
322 // Metric snapshots
323 //==========================================================================
324 DoubleVect volumes_old_;
325 DoubleVect volumes_entrelaces_old_;
326 DoubleTab volumes_sommets_thilde_old_;
327 DoubleTab coord_old_;
328};
329
330
331inline const double& Domaine_ALE::get_dt() const { return dt_; }
332
333inline const DoubleTab& Domaine_ALE::vitesse() const { return ALE_mesh_velocity; }
334
335inline DoubleTab& Domaine_ALE::vitesse_faces() { return vf; }
336inline const DoubleTab& Domaine_ALE::vitesse_faces() const { return vf; }
337
340
343
346
349
350inline const DoubleVect& Domaine_ALE::old_volumes_entrelaces() const
351{ return volumes_entrelaces_old_; }
352
353inline const DoubleVect& Domaine_ALE::old_volumes() const
354{ return volumes_old_; }
355
356#endif /* Domaine_ALE_included */
Classe Champ_Inc_base.
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
classe Champ_front_base Classe de base pour la hierarchie des champs aux frontieres.
const int & getBeamNbModes(const int &) const
DoubleTab interpolationOnThe3DSurface(const int &, const double &x, const double &y, const double &z, const DoubleTab &u, const DoubleTab &R) const
int getCouplingMethod()
void update_coord_dom_extrait_surface()
const DoubleTab & getMeshTransformationGradient() const
const DoubleTab & getMeshPosition() const
const DoubleVect & old_volumes_entrelaces() const override
const int & getBeamNbBeam() const
void reading_vit_bords_ALE(Entree &is)
int getMeshMotionModel() const
Definition Domaine_ALE.h:84
void reading_projection_ALE_boundary(Entree &is)
Champs_compris & get_champs_compris()
void reading_beam_model(Entree &is)
bool extrait_surf_dom_deformable_
const int & getBeamNbPlanes(const int &) const
void updateMetrics(Domaine_dis_base &, Probleme_base &)
int meshMotionModel_
void set_extrait_surf_dom_deformable(bool)
void initialiser(double temps, Domaine_dis_base &, Probleme_base &) override
void create_field(OWN_PTR(Champ_Inc_base)&, const std::string &, int, const Motcle &, const Probleme_base &) const
DoubleTab vf
void update_after_post(double temps) override
const DoubleTab & getBeamRotation(const int &, const int &) const
const DoubleTab & getMeshStress() const
void apply_old_to_new_volume_scaling(DoubleTab &, const Domaine_dis_base &) const override
void validateTimeStep() override
const IntTab & les_elems_extrait_surf_reference() const
OWN_PTR(Champ_Inc_base) ALEMeshStructuralForces_
void update_post_fields(double temps, double dt)
const double & get_dt() const
IntTab som_faces_bords
Bords les_bords_ALE
void reading_solver_moving_mesh_ALE(Entree &is)
OWN_PTR(Champ_Inc_base) ALEMeshStructuralPressure_
int save_additional_state(Sortie &, const Probleme_base &) const override
const DoubleVect & getMeshPbVonMises() const
int get_nb_bords_ALE() const
YAML_data make_yaml(const std::string &, int, const Probleme_base &) const
void resumptionCoords(DoubleTab &)
const DoubleTab & getMeshDisplacement() const
Structural_dynamic_mesh_model str_mesh_model
SolveurSys solv
std::vector< YAML_data > data_a_sauvegarder(const Probleme_base &) const override
const Champ_base & get_champ(const Motcle &) const override
ALE_CheckpointManager checkpoint_manager_
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base)&ref_champ) const override
void set_dt(double &dt) override
double interpolationPhiOnThe3DSurface(const int &, const double &x, const double &y, const double &z, const int &comp, const DoubleTab &u) const
const DoubleTab & vitesse() const
const int & getBeamLongitudinalAxis(const int &) const
IntTab les_elems_extrait_surf_reference_
ALE_ProjectionManager projection_manager_
void mettre_a_jour(double temps, Domaine_dis_base &, Probleme_base &) override
void update_ALE_projection(double, Nom &, Champ_front_ALE_projection &, int)
OWN_PTR(Champ_Inc_base) ALEMeshTotalDisplacement_
const int & getMeshStressNbComp() const
void associer_vitesse_lagrangienne(const Nom &nom_pb, const Nom &nom_champ)
void reading_structural_dynamic_mesh_model(Entree &is)
void reading_ALE_Neumann_BC_for_grid_problem(Entree &is)
OBS_PTR(Equation_base) eq
const DoubleTab & getMeshPbForceFace() const
const int & getMeshTransformationGradientNbComp() const
int Coupling_ICoCo_method
const DoubleTab & getBeamDisplacement(const int &, const int &) const
const DoubleVect & old_volumes() const override
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
Equation_base & getEquation()
const DoubleTab & getMeshVelocity() const
TRUST_Vector< OWN_PTR(Champ_front_base)> les_champs_front
OWN_PTR(Champ_Inc_base) ALEMeshVelocity_
const Nom & getBeamName(const int &) const
DoubleTab & vitesse_faces()
void set_les_elems_extrait_surf_reference(const IntTab &)
const Bords & get_bords_ALE() const
bool is_resumption() const
Nom generate_field_tag(const Champ_Inc_base &, const Probleme_base &) const
ALE_MetricsUpdater metrics_updater_
void computeFluidForceOnBeam(const int &)
const int & getMeshReferenceConfigurationNbComp() const
void clear() override
Reset the Domaine completely except for its name.
DoubleTab & getBeamVelocity(const int &, const double &tps, const double &dt)
DoubleTab ALE_mesh_velocity
void ajouter_correctif_volumique(const DoubleTab &, const DoubleTab &, double, DoubleTab &) const override
bool extrait_surf_dom_deformable() const
void resumptionStructuralDynamicsMesh(double, DoubleTab &, DoubleTab &, DoubleTab &, DoubleTab &, DoubleTab &, DoubleTab &, DoubleTab &)
int restore_additional_state(Entree &, Probleme_base &) override
void creer_champ(const Motcle &, const Probleme_base &) override
bool getUpdateTheGrid() override
const DoubleTab & getMeshReferenceConfiguration() const
const int & getBeamBendingDirection(const int &, const int &) const
bool UpdateTheGrid
ALE_BeamCoupling beam_coupling_
DoubleTab & calculer_vitesse_faces(DoubleTab &, int, int, IntTab &)
void setUpdateTheGrid(bool) override
OWN_PTR(Champ_Inc_base) ALEMeshStructuralVonMises_
const DoubleTab & getMeshAcceleration() const
double computeDtBeam(Domaine_dis_base &, const int &)
const DoubleVect & getMeshPbPressure() const
Champs_compris champs_compris_
classe Domaine_Cl_dis_base Les objets Domaine_Cl_dis_base representent les conditions aux limites
class Domaine_VF
Definition Domaine_VF.h:44
void creer_champ(const Motcle &motlu) override
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
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
Classe Matrice_Morse_Sym Represente une matrice M (creuse) symetrique stockee au format Morse.
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
Un tableau de chaine de caracteres (VECT(Nom)).
Definition Noms.h:26
classe Probleme_base C'est un Probleme_U qui n'est pas un couplage.
class SolveurSys Un SolveurSys represente n'importe qu'elle classe
Definition SolveurSys.h:32
Classe de base des flux de sortie.
Definition Sortie.h:52
classe TRUST_Vector
classe YAML_data : collection of all needed information for data to save/restore in order to write th...
Definition YAML_data.h:26