TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Modele_turbulence_scal_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_scal_base_included
17#define Modele_turbulence_scal_base_included
18
19#include <Turbulence_paroi_scal_base.h>
20#include <TRUST_Deriv.h>
21#include <TRUST_Ref.h>
22
25class Equation_base;
26class Champ_base;
27class Motcle;
28class Param;
29
30/*! @brief Base class for scalar turbulence models coupled to a Navier-Stokes convection-diffusion equation.
31 *
32 * Two main derived categories exist: k-epsilon models and sub-grid scale models.
33 * Both share the computation of a turbulent diffusivity.
34 *
35 * @sa Modele_turbulence_scal_Prandtl Modele_turb_scal_Prandtl_sous_maille
36 */
38{
39 Declare_base(Modele_turbulence_scal_base);
40public:
41 virtual int preparer_calcul();
42 virtual bool initTimeStep(double dt);
43 virtual void mettre_a_jour(double) =0;
44 inline const Champ_Fonc_base& conductivite_turbulente() const { return conductivite_turbulente_; }
46 inline const Turbulence_paroi_scal_base& loi_paroi() const;
47 inline int loi_paroi_non_nulle() const;
49 virtual void discretiser();
50 //void discretiser_diff_turb(const Schema_Temps_base&, Domaine_dis_base&, Champ_Fonc_base&) const;
51 void associer_eqn(const Equation_base&);
52 virtual void completer();
53 virtual void associer(const Domaine_dis_base&, const Domaine_Cl_dis_base&);
54 void a_faire(Sortie&) const;
55 virtual std::vector<YAML_data> data_a_sauvegarder() const;
56 int sauvegarder(Sortie&) const override;
57 int reprendre(Entree&) override;
59 inline const Convection_Diffusion_std& equation() const;
60
61 void creer_champ(const Motcle& motlu) override;
62 const Champ_base& get_champ(const Motcle& nom) const override;
63 void get_noms_champs_postraitables(Noms& nom, Option opt = NONE) const override;
64 bool has_champ(const Motcle& nom, OBS_PTR(Champ_base) &ref_champ) const override;
65 bool has_champ(const Motcle& nom) const override;
66
67 int limpr_nusselt(double, double, double, double) const;
68 virtual void imprimer(Sortie&) const;
69
70 virtual void set_param(Param&) const override;
71 int lire_motcle_non_standard(const Motcle&, Entree&) override;
72
73protected:
77 double dt_impr_nusselt_ = DMAXFLOAT, dt_impr_nusselt_mean_only_ = DMAXFLOAT;
78 int boundaries_ = 0;
79 LIST(Nom) boundaries_list_;
81 Champs_compris champs_compris_;
82};
83
84/*! @brief Returns the scalar wall-law turbulence model (const version).
85 *
86 * @return (Turbulence_paroi_scal_base&) the scalar wall-law turbulence model
87 */
89{
90 return loipar_.valeur();
91}
92
93/*! @brief Returns whether a wall law is set (const version).
94 *
95 * @return (int) 1 if a wall law is set, 0 otherwise
96 */
98{
99 return bool(loipar_);
100}
101
102/*! @brief Returns the scalar wall-law turbulence model.
103 *
104 * @return (Turbulence_paroi_scal_base&) the scalar wall-law turbulence model
105 */
107{
108 return loipar_.valeur();
109}
110
112{
113 if (!mon_equation_)
114 {
115 Cerr << "\nError in Modele_turbulence_scal_base::equation() : The equation is unknown !" << finl;
117 }
118 return mon_equation_.valeur();
119}
120
122{
123 if (!mon_equation_)
124 {
125 Cerr << "\nError in Modele_turbulence_scal_base::equation() : The equation is unknown !" << finl;
127 }
128 return mon_equation_.valeur();
129}
130
131#endif
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
Convection_Diffusion_std This class is the base for equations modelling the transport.
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 scalar turbulence models coupled to a Navier-Stokes convection-diffusion equation.
OBS_PTR(Convection_Diffusion_std) mon_equation_
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
virtual void mettre_a_jour(double)=0
virtual void completer()
Completes the turbulence model: updates object references.
Convection_Diffusion_std & equation()
const Champ_base & get_champ(const Motcle &nom) const override
OWN_PTR(Turbulence_paroi_scal_base) loipar_
void associer_eqn(const Equation_base &)
Associates the equation passed as parameter to the turbulence model.
virtual bool initTimeStep(double dt)
To be overridden in derived classes that own one or more equations. Calls preparer_pas_de_temps on th...
const Champ_Fonc_base & conductivite_turbulente() const
virtual void imprimer(Sortie &) const
Performs printing if necessary.
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
int reprendre(Entree &) override
Does nothing.
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
virtual void associer(const Domaine_dis_base &, const Domaine_Cl_dis_base &)
Does nothing.
const Turbulence_paroi_scal_base & loi_paroi() const
Returns the scalar wall-law turbulence model (const version).
void creer_champ(const Motcle &motlu) override
OWN_PTR(Champ_Fonc_base) conductivite_turbulente_
int sauvegarder(Sortie &) const override
Does nothing.
LIST(Nom) boundaries_list_
int limpr_nusselt(double, double, double, double) const
Indicates whether local Nusselt values should be printed.
const Champ_Fonc_base & diffusivite_turbulente() const
virtual void set_param(Param &) const override
virtual std::vector< YAML_data > data_a_sauvegarder() const
for PDI IO: retrieve name, type and dimensions of the fields to save/restore
virtual int preparer_calcul()
Does nothing.
virtual void discretiser()
Discretizes the turbulence model.
int loi_paroi_non_nulle() const
Returns whether a wall law is set (const version).
void a_faire(Sortie &) const
Writes an identity string to the output stream if necessary.
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
friend class Entree
Definition Objet_U.h:71
friend class Sortie
Definition Objet_U.h:70
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
Base class for the hierarchy of scalar wall-law models computing turbulent quantities near walls....