TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Turbulence_paroi_scal_base.h
1/****************************************************************************
2* Copyright (c) 2025, 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 Turbulence_paroi_scal_base_included
17#define Turbulence_paroi_scal_base_included
18
19#include <Champs_compris_interface.h>
20#include <Champ_Fonc_base.h>
21#include <Champs_compris.h>
22#include <TRUSTVects.h>
23#include <TRUST_Ref.h>
24
28class Probleme_base;
29class EcrFicPartage;
30class Domaine_VF;
31
32/*! @brief Base class for the hierarchy of scalar wall-law models computing turbulent quantities near walls.
33 * The main method to implement in derived classes is calculer_scal,
34 * which must compute and fill the equivalent_distance_ array of equivalent wall distances.
35 *
36 * @sa abstract class
37 */
39{
40 Declare_base_sans_constructeur(Turbulence_paroi_scal_base);
41public:
43
45
46 /* XXX Elie Saikali : re-mets ici et pas dans Objet_U */
47 int sauvegarder(Sortie& os) const override { return 0; }
48 int reprendre(Entree& is) override { return 1; }
49 virtual std::vector<YAML_data> data_a_sauvegarder() const { return std::vector<YAML_data>(); }
50
52 virtual void associer(const Domaine_dis_base&, const Domaine_Cl_dis_base&)=0;
53 virtual void completer() { }
54 virtual int init_lois_paroi() =0;
56 virtual void compute_nusselt() const =0;
57 virtual void imprimer_nusselt(Sortie&) const
58 {
59 Cerr << "imprimer_nusselt not implemented for " << que_suis_je() << finl;
60 }
61 void imprimer_premiere_ligne_nusselt(int, const LIST(Nom)&, const Nom&) const;
62 void imprimer_nusselt_mean_only(Sortie&, int, const LIST(Nom)&, const Nom&) const;
63
64 void creer_champ(const Motcle& motlu) override;
65 const Champ_base& get_champ(const Motcle& nom) const override;
66 void get_noms_champs_postraitables(Noms& nom, Option opt = NONE) const override;
67 bool has_champ(const Motcle& nom, OBS_PTR(Champ_base) &ref_champ) const override;
68 bool has_champ(const Motcle& nom) const override;
69
70 // Writing u_star, Cisaillement_paroi, etc. to a separate file...
71 void ouvrir_fichier_partage(EcrFicPartage&, const Nom&) const;
72 void ouvrir_fichier_partage(EcrFicPartage&, const Nom&, const Nom&) const;
74
75 virtual bool use_equivalent_distance() const;
76 virtual DoubleVect& equivalent_distance_name(DoubleVect& d_eq, const Nom& nom_bord) const = 0;
77
78 inline const DoubleVects& equivalent_distance() const { return equivalent_distance_; }
79 inline const DoubleVect& equivalent_distance(int bord) const
80 {
81 assert(bord < equivalent_distance_.size());
82 return equivalent_distance_[bord];
83 }
84 inline double equivalent_distance(int bord, int face) const
85 {
86 assert(bord < equivalent_distance_.size());
87 assert(face < equivalent_distance_[bord].size());
88 return equivalent_distance_[bord](face);
89 }
90
91 inline const DoubleVects& tab_equivalent_distance() const { return equivalent_distance_; }
92 inline int tab_equivalent_distance_size() { return equivalent_distance_.size(); }
93
94 inline const DoubleVect& tab_equivalent_distance(int bord) const
95 {
96 assert(bord < equivalent_distance_.size());
97 return equivalent_distance_[bord];
98 }
99
100protected:
102 mutable int nb_impr_ = 0, nb_impr0_ = 0; // print counter
103 int calcul_ldp_en_flux_impose_; // flag defining whether the wall law is used with imposed flux, 0 by default
104 double Prdt_sur_kappa_; // constant in the wall law
105 KOKKOS_INLINE_FUNCTION
106 double T_plus(double y_plus, double Pr, double Prdt_sur_kappa);
107
109 // array of equivalent distances on each boundary
110 // computed during the application of wall laws
111 // and to be used in the computation of
112 // wall heat transfer coefficients
113 // In VDF, unlike VEF, contributions from virtual boundary faces are not needed
114 // because the scalar is at the cell center in VDF whereas
115 // it is at the face center in VEF
116 // Since virtual boundary faces must be accounted for
117 // in VEF when applying the diffusion operator
118 // of equivalent_distance_, one array per boundary is used and
119 // each array is dimensioned to the total number of boundary faces (real+virtual)
120 mutable DoubleTab tab_; // Array containing the Nusset fields
121 int nb_fields_ = 6; // Number of Nusselt fields
122
123 OBS_PTR(Domaine_VF) le_dom_dis_;
125private:
126
127 Champs_compris champs_compris_;
128
129};
130
131// Analytical law with matching of the asymptotic behaviors
132// of the dimensionless temperature T+
133// using Kader:
134// conductive sub-layer: T+=Pr y+
135// logarithmic region: T+=2.12*ln(y+)+Beta
136KOKKOS_INLINE_FUNCTION
137double Turbulence_paroi_scal_base::T_plus(double y_plus, double Pr, double Prdt_sur_kappa)
138{
139 double Gamma = (0.01 * pow(Pr * y_plus, 4.)) / (1. + 5. * pow(Pr, 3.) * y_plus);
140 double Beta = pow(3.85 * pow(Pr, 1. / 3.) - 1.3, 2.) + Prdt_sur_kappa * log(Pr);
141 return Pr * y_plus * exp(-Gamma) + (Prdt_sur_kappa * log(1. + y_plus) + Beta) * exp(-1. / (Gamma + 1e-20));
142}
143
144/*! @brief Associates a turbulence model to the object.
145 *
146 * @brief Associates a scalar turbulence model to the object.
147 * @param (Modele_turbulence_scal_base& le_modele) the scalar turbulence model to associate with the object
148 */
150{
151 mon_modele_turb_scal = le_modele;
152}
153
154#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
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class Domaine_VF
Definition Domaine_VF.h:44
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
Base class for scalar turbulence models coupled to a Navier-Stokes convection-diffusion equation.
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
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
Definition Objet_U.cpp:54
class Probleme_base It is a Probleme_U that is not a coupling.
Base class for output streams.
Definition Sortie.h:52
Base class for the hierarchy of scalar wall-law models computing turbulent quantities near walls....
OBS_PTR(Domaine_VF) le_dom_dis_
int reprendre(Entree &is) override
Restores an Objet_U from an input stream. Virtual method to override.
double equivalent_distance(int bord, int face) const
int sauvegarder(Sortie &os) const override
Saves an Objet_U to an output stream. Virtual method to override.
KOKKOS_INLINE_FUNCTION double T_plus(double y_plus, double Pr, double Prdt_sur_kappa)
virtual bool use_equivalent_distance() const
Give a boolean indicating if we need to use equivant distance by default we consider that we use the ...
void imprimer_premiere_ligne_nusselt(int, const LIST(Nom)&, const Nom &) const
Writes header line for Nusselt number and heat transfer statistics file.
static void typer_lire_turbulence_paroi_scal(OWN_PTR(Turbulence_paroi_scal_base)&, const Modele_turbulence_scal_base &, Entree &)
Reads the characteristics of the scalar wall law from an input stream.
virtual std::vector< YAML_data > data_a_sauvegarder() const
void creer_champ(const Motcle &motlu) override
virtual DoubleVect & equivalent_distance_name(DoubleVect &d_eq, const Nom &nom_bord) const =0
const DoubleVect & tab_equivalent_distance(int bord) const
OBS_PTR(Domaine_Cl_dis_base) le_dom_Cl_dis_
const Champ_base & get_champ(const Motcle &nom) const override
OBS_PTR(Modele_turbulence_scal_base) mon_modele_turb_scal
virtual int init_lois_paroi()=0
void imprimer_nusselt_mean_only(Sortie &, int, const LIST(Nom)&, const Nom &) const
Prints mean Nusselt number and heat transfer statistics to a file for specified boundaries.
const DoubleVects & tab_equivalent_distance() const
void associer_modele(const Modele_turbulence_scal_base &)
Associates a turbulence model to the object.
const DoubleVect & equivalent_distance(int bord) const
const DoubleVects & equivalent_distance() const
virtual int calculer_scal(Champ_Fonc_base &)=0
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
virtual void compute_nusselt() const =0
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
const int & get_flag_calcul_ldp_en_flux_impose() const
virtual void imprimer_nusselt(Sortie &) const
virtual void associer(const Domaine_dis_base &, const Domaine_Cl_dis_base &)=0
void ouvrir_fichier_partage(EcrFicPartage &, const Nom &) const
Opens or creates a print file for Face, d_eq, local Nu, h.