TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Modele_turbulence_hyd_base.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 Modele_turbulence_hyd_base_included
17#define Modele_turbulence_hyd_base_included
18
19#include <Support_Champ_Masse_Volumique.h>
20#include <Turbulence_paroi_base.h>
21
23class Equation_base;
24class Motcle;
25class Param;
26
27static constexpr double CMU = 0.09;
28
29/*! @brief Base class for the turbulence model hierarchy for Navier-Stokes equations.
30 *
31 * Two derived classes already exist representing the (k,e) turbulence model and the
32 * subgrid-scale turbulence model. Both models share the computation of a turbulent viscosity.
33 *
34 * B.Mat.: the class inherits from Support_Champ_Masse_Volumique.
35 * In Front-Tracking (and later in QC), it provides the mechanism to retrieve rho.
36 *
37 */
39{
40 Declare_base(Modele_turbulence_hyd_base);
41public:
42 inline const Champ_Fonc_base& viscosite_turbulente() const { return la_viscosite_turbulente_; }
43 inline Champ_Fonc_base& viscosite_turbulente() { return la_viscosite_turbulente_; }
44 inline Equation_base& equation();
45 inline const Equation_base& equation() const;
46 inline const Turbulence_paroi_base& loi_paroi() const { return loipar_.valeur(); }
47 inline Turbulence_paroi_base& loi_paroi() { return loipar_.valeur(); }
48 bool utiliser_loi_paroi() const { return loipar_ ? loipar_->use_shear() : false; }
49 bool has_loi_paroi_hyd() const { return bool(loipar_); }
50 virtual bool calcul_tenseur_Re(const DoubleTab& nu_turb, const DoubleTab& grad, DoubleTab& Re) const { return false; }
51 virtual void set_param(Param& param) const override;
52 int lire_motcle_non_standard(const Motcle&, Entree&) override;
53 virtual int preparer_calcul();
54 virtual bool initTimeStep(double dt);
55 virtual void mettre_a_jour(double) =0;
56 virtual void discretiser();
59 void discretiser_K(const Schema_Temps_base&, Domaine_dis_base&, OWN_PTR(Champ_Fonc_base)&) const; // Used by turbulence models in TrioCFD
60 virtual void completer() { /* Do nothing */ }
61 void associer_eqn(const Equation_base&);
62 virtual void associer(const Domaine_dis_base&, const Domaine_Cl_dis_base&) { /* Do nothing */ }
63 int reprendre(Entree&) override;
64
65 void creer_champ(const Motcle& motlu) override;
66 const Champ_base& get_champ(const Motcle& nom) const override;
67 void get_noms_champs_postraitables(Noms& nom, Option opt = NONE) const override;
68 bool has_champ(const Motcle& nom, OBS_PTR(Champ_base) &ref_champ) const override;
69 bool has_champ(const Motcle& nom) const override;
70 inline Champs_compris& champs_compris() { return champs_compris_; }
71
72 virtual void imprimer(Sortie&) const;
73 void a_faire(Sortie&) const;
74 int sauvegarder(Sortie&) const override;
75 virtual std::vector<YAML_data> data_a_sauvegarder() const;
76
77 int limpr_ustar(double, double, double, double) const;
78 inline double get_Cmu() const { return LeCmu_; }
80
82
83protected:
84 double LeCmu_ = CMU;
85 OWN_PTR(Champ_Fonc_base) la_viscosite_turbulente_, wall_length_;
86 OBS_PTR(Equation_base) mon_equation_;
89 int boundaries_ = 0;
90 LIST(Nom) boundaries_list_;
92 Champs_compris champs_compris_;
93
94private:
95 double XNUTM_ = 1.E8, dt_diff_sur_dt_conv_ = -1;
96 bool calcul_borne_locale_visco_turb_ = false;
97 OWN_PTR(Champ_Fonc_base) corr_visco_turb_;
98 DoubleVect borne_visco_turb_;
99};
100
101/*! @brief Returns the equation associated with the turbulence model.
102 *
103 * @brief Returns the equation associated with the turbulence model (of type Equation_base).
104 * @return (Equation_base&) the equation associated with the turbulence model
105 */
107{
108 if (!mon_equation_)
109 {
110 Cerr << "Error in Modele_turbulence_hyd_base::equation() : The equation is unknown !" << finl;
112 }
113 return mon_equation_.valeur();
114}
115
117{
118 if (!mon_equation_)
119 {
120 Cerr << "Error in Modele_turbulence_hyd_base::equation() : The equation is unknown !" << finl;
122 }
123 return mon_equation_.valeur();
124}
125
126#endif /* Modele_turbulence_hyd_base_included */
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
class Champs_compris_interface This class contains an interface of methods intended to manage
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Equation_base The role of an equation is the calculation of one or more fields....
Base class for the turbulence model hierarchy for Navier-Stokes equations.
OBS_PTR(Equation_base) mon_equation_
int limpr_ustar(double, double, double, double) const
virtual void associer(const Domaine_dis_base &, const Domaine_Cl_dis_base &)
LIST(Nom) boundaries_list_
virtual std::vector< YAML_data > data_a_sauvegarder() const
for PDI IO: retrieve name, type and dimensions of the fields to save/restore
void associer_eqn(const Equation_base &)
Associates the equation passed as parameter to the turbulence model.
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
OWN_PTR(Champ_Fonc_base) la_viscosite_turbulente_
virtual int preparer_calcul()
Prepares the computation.
virtual bool calcul_tenseur_Re(const DoubleTab &nu_turb, const DoubleTab &grad, DoubleTab &Re) const
OWN_PTR(Turbulence_paroi_base) loipar_
void discretiser_visc_turb(const Schema_Temps_base &, Domaine_dis_base &, OWN_PTR(Champ_Fonc_base)&) const
virtual void set_param(Param &param) const override
void discretiser_K(const Schema_Temps_base &, Domaine_dis_base &, OWN_PTR(Champ_Fonc_base)&) const
int reprendre(Entree &) override
Restores the wall law from a checkpoint.
void discretiser_corr_visc_turb(const Schema_Temps_base &, Domaine_dis_base &, OWN_PTR(Champ_Fonc_base)&) const
int sauvegarder(Sortie &) const override
Saves the turbulence model to an output stream.
virtual void mettre_a_jour(double)=0
const Turbulence_paroi_base & loi_paroi() const
const Champ_Fonc_base & viscosite_turbulente() const
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
void creer_champ(const Motcle &motlu) override
void lire_distance_paroi()
Reads the domain Wall_length.xyz file to populate the wall_length field for distance_paroi post-proce...
Turbulence_paroi_base & loi_paroi()
Equation_base & equation()
Returns the equation associated with the turbulence model.
virtual void discretiser()
Discretizes the turbulence model.
void a_faire(Sortie &) const
Writes an identity record to the output stream if required.
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
virtual void imprimer(Sortie &) const
Performs printing if necessary.
const Champ_base & get_champ(const Motcle &nom) const override
A character string (Nom) in uppercase.
Definition Motcle.h:26
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
An array of character strings (VECT(Nom)).
Definition Noms.h:26
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
Definition Objet_U.cpp:54
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
class Schema_Temps_base
Base class for output streams.
Definition Sortie.h:52
Support_Champ_Masse_Volumique()
Constructor of the class.
Base class for the hierarchy of wall-law models computing turbulent quantities near walls....