TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Turbulence_paroi_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 Turbulence_paroi_base_included
17#define Turbulence_paroi_base_included
18
19#include <Champs_compris_interface.h>
20#include <Champs_compris.h>
21#include <Champ_Inc_base.h>
22#include <TRUST_Ref.h>
23#include <YAML_data.h>
24
26class Probleme_base;
27class EcrFicPartage;
28class Param;
29
30/*! @brief Base class for the hierarchy of wall-law models computing turbulent quantities near walls.
31 * Contains a reference to a turbulence model.
32 *
33 * @sa Paroi_std_hyd_VDF Paroi_std_scal_hyd_VDF
34 */
36{
37 Declare_base(Turbulence_paroi_base);
38public:
39
41
42 virtual void set_param(Param& param) const override { /* Do nothing */ }
44 virtual void associer(const Domaine_dis_base&, const Domaine_Cl_dis_base&)=0;
45 virtual void completer() { }
46 virtual int init_lois_paroi() =0;
47 inline int calculer_hyd(Champ_Inc_base&);
49 virtual int calculer_hyd(DoubleTab&) =0;
50 virtual int calculer_hyd(DoubleTab&, DoubleTab&) =0;
51 virtual int calculer_hyd_BiK(DoubleTab&, DoubleTab&) =0;
52 inline virtual DoubleTab& corriger_derivee_impl(DoubleTab& d) const { return d; }
53 inline virtual void imprimer_ustar(Sortie&) const { }
54 virtual void imprimer_premiere_ligne_ustar(int, const LIST(Nom)&, const Nom&) const;
55 virtual void imprimer_ustar_mean_only(Sortie&, int, const LIST(Nom)&, const Nom&) const;
56 // added to account for Cisaillement_paroi in the base class
57
58 inline const DoubleTab& Cisaillement_paroi() const;
59 inline const DoubleVect& tab_u_star() const;
60 inline double tab_u_star(int face) const;
61 inline const DoubleVect& tab_d_plus() const;
62 inline double tab_d_plus(int face) const;
63
64 //OC 01/2006: added save/resume functionality: useful for TBLE for now.
65 int sauvegarder(Sortie&) const override { return 0; }
66 int reprendre(Entree&) override { return 0; }
67 virtual std::vector<YAML_data> data_a_sauvegarder() const { return std::vector<YAML_data>(); }
68
69 void creer_champ(const Motcle& motlu) override;
70 const Champ_base& get_champ(const Motcle& nom) const override;
71 void get_noms_champs_postraitables(Noms& nom, Option opt = NONE) const override;
72 bool has_champ(const Motcle& nom, OBS_PTR(Champ_base) &ref_champ) const override;
73 bool has_champ(const Motcle& nom) const override;
74
75 // Writing u_star, Cisaillement_paroi, etc. to a separate file...
76 void ouvrir_fichier_partage(EcrFicPartage&, const Nom&) const;
77 void ouvrir_fichier_partage(EcrFicPartage&, const Nom&, const Nom&) const;
78 // indicates whether shear is used or not
79 virtual bool use_shear() const { return true; } // Generally true except for example for paroi_negligeable_XXX
80
81protected:
82 OBS_PTR(Modele_turbulence_hyd_base) mon_modele_turb_hyd;
83 DoubleTab Cisaillement_paroi_; // values of tangential stresses at
84 // walls computed locally from u*
85 DoubleVect tab_u_star_; // values of u* computed locally
86 DoubleVect tab_d_plus_; // values of d+ computed locally
87 mutable OWN_PTR(Champ_Fonc_base) champ_u_star_; // field for post-processing
88 mutable int nb_impr_ = 0, nb_impr0_ = 0; // print counter
89 Champs_compris champs_compris_;
90 OBS_PTR(Domaine_VF) le_dom_dis_;
92};
93
94/*! @brief Associates a turbulence model to the object.
95 *
96 * @brief Associates a hydraulic turbulence model to the object.
97 * @param (Modele_turbulence_hyd_base& le_modele) the hydraulic turbulence model to associate with the object
98 */
100{
101 mon_modele_turb_hyd = le_modele;
102}
103
104/*! @brief Simple call to int calculer_hyd(DoubleTab& ).
105 *
106 * @param (Champ_Inc_base& ch)
107 * @return (int) propagated return code
108 */
110{
111 return calculer_hyd(ch.valeurs());
112}
113
114/*! @brief Simple call to int calculer_hyd(DoubleTab&, DoubleTab&).
115 *
116 * @param (Champ_Inc_base& ch1)
117 * @param (Champ_Inc_base& ch2)
118 * @return (int) propagated return code
119 */
121{
122 return calculer_hyd(ch1.valeurs(), ch2.valeurs());
123}
124
125inline const DoubleTab& Turbulence_paroi_base::Cisaillement_paroi() const
126{
127 return Cisaillement_paroi_;
128}
129
130inline const DoubleVect& Turbulence_paroi_base::tab_u_star() const
131{
132 return tab_u_star_;
133}
134
135inline double Turbulence_paroi_base::tab_u_star(int face) const
136{
137 return tab_u_star_(face);
138}
139
140inline const DoubleVect& Turbulence_paroi_base::tab_d_plus() const
141{
142 return tab_d_plus_;
143}
144
145inline double Turbulence_paroi_base::tab_d_plus(int face) const
146{
147 return tab_d_plus_(face);
148}
149
150inline void erreur_non_convergence()
151{
152 Cerr << "TRUST stopped cause in the function calculer_u_plus of wall law." << finl;
153 Cerr << "The iterative process of u* did not converge" << finl;
155 Cerr << " on the processor" << Process::me();
156 else
157 Cerr << ".";
158 Cerr << finl << "The hydraulic calculation is may be diverging." << finl;
160}
161
162#endif
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
Class Champ_Inc_base.
DoubleTab & valeurs() override
Returns the array of field values at the current time.
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.
Base class for the turbulence model hierarchy for Navier-Stokes equations.
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
class Probleme_base It is a Probleme_U that is not a coupling.
static bool is_parallel()
Definition Process.cpp:108
static int me()
Returns the rank of the local processor in the current communication group. See Comm_Group::rank() an...
Definition Process.cpp:122
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52
Base class for the hierarchy of wall-law models computing turbulent quantities near walls....
virtual void imprimer_premiere_ligne_ustar(int, const LIST(Nom)&, const Nom &) const
Writes header line for u* (friction velocity) statistics file.
OBS_PTR(Domaine_VF) le_dom_dis_
const DoubleTab & Cisaillement_paroi() const
const DoubleVect & tab_d_plus() const
virtual int calculer_hyd(DoubleTab &, DoubleTab &)=0
const DoubleVect & tab_u_star() const
virtual void imprimer_ustar_mean_only(Sortie &, int, const LIST(Nom)&, const Nom &) const
Prints mean friction velocity (u*) statistics to a file for specified boundaries.
virtual void imprimer_ustar(Sortie &) const
OBS_PTR(Domaine_Cl_dis_base) le_dom_Cl_dis_
void ouvrir_fichier_partage(EcrFicPartage &, const Nom &) const
Opens or creates a print file for Face, uplus_, dplus_, tab_u_star, Cisaillement_paroi_.
const Champ_base & get_champ(const Motcle &nom) const override
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
virtual int init_lois_paroi()=0
virtual int calculer_hyd(DoubleTab &)=0
OWN_PTR(Champ_Fonc_base) champ_u_star_
int reprendre(Entree &) override
Restores an Objet_U from an input stream. Virtual method to override.
void creer_champ(const Motcle &motlu) override
int calculer_hyd(Champ_Inc_base &)
Simple call to int calculer_hyd(DoubleTab& ).
virtual std::vector< YAML_data > data_a_sauvegarder() const
virtual DoubleTab & corriger_derivee_impl(DoubleTab &d) const
virtual bool use_shear() const
virtual void associer(const Domaine_dis_base &, const Domaine_Cl_dis_base &)=0
void associer_modele(const Modele_turbulence_hyd_base &)
Associates a turbulence model to the object.
static void typer_lire_turbulence_paroi(OWN_PTR(Turbulence_paroi_base)&, const Modele_turbulence_hyd_base &, Entree &)
Reads the characteristics of the wall law from an input stream.
virtual int calculer_hyd_BiK(DoubleTab &, DoubleTab &)=0
int sauvegarder(Sortie &) const override
Saves an Objet_U to an output stream. Virtual method to override.
OBS_PTR(Modele_turbulence_hyd_base) mon_modele_turb_hyd
virtual void set_param(Param &param) const override