TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Modele_turbulence_scal_Schmidt.cpp
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#include <Modele_turbulence_scal_Schmidt.h>
17#include <Modifier_pour_fluide_dilatable.h>
18#include <Convection_Diffusion_std.h>
19#include <Param.h>
20
21Implemente_instanciable(Modele_turbulence_scal_Schmidt, "Modele_turbulence_scal_Schmidt", Modele_turbulence_scal_diffturb_base);
22// XD schmidt modele_turbulence_scal_base schmidt INHERITS_BRACE The Schmidt model. For the scalar equations, only the
23// XD_CONT model based on Reynolds analogy is available. If K_Epsilon was selected in the hydraulic equation, Schmidt
24// XD_CONT must be selected for the convection-diffusion temperature equation coupled to the hydraulic equation and
25// XD_CONT Schmidt for the concentration equations.
26
28
30{
32 Cerr << "The value of the turbulent Schmidt number is " << LeScturb_ << finl;
33 return is;
34}
35
37{
38 param.ajouter("ScTurb", &LeScturb_); // XD_ADD_P floattant
39 // XD_CONT Keyword to modify the constant (Sct) of Schmlidt model : Dt=Nut/Sct Default value is 0.7.
41}
42
43/*! @brief Returns 1 if the keyword passed as parameter is a field name of the object.
44 *
45 * @param mot The keyword to compare against known field names.
46 * @return 0 if the keyword is not a field name, 1 otherwise.
47 */
49{
50 if (mot == Motcle("diffusion_turbulente"))
51 return 1;
52 else
53 return 0;
54}
55
56/*! @brief Returns 1 if a functional field (Champ_Fonc) with the specified name is owned by the turbulence model, 0 otherwise.
57 *
58 * @param mot Name of a functional field of the turbulence model.
59 * @param ch_ref Reference to the found field (if found).
60 * @return 1 if a functional field with the given name was found, 0 otherwise.
61 */
63 OBS_PTR(Champ_base) &ch_ref) const
64{
65 if (mot == Motcle("diffusion_turbulente"))
66 {
67 ch_ref = diffusivite_turbulente_.valeur();
68 return 1;
69 }
70 return 0;
71}
72
73/*! @brief Computes the turbulent coefficient used in the equation and the wall law.
74 *
75 * @param Unused time parameter.
76 */
78{
80 const Milieu_base& mil = equation().probleme().milieu();
82 loipar_->calculer_scal(diffusivite_turbulente_);
83
84 DoubleTab& lambda_t = conductivite_turbulente_->valeurs();
85 lambda_t = diffusivite_turbulente_->valeurs();
86 if (equation().probleme().is_dilatable())
87 multiplier_par_rho_si_dilatable(lambda_t, mil);
88 conductivite_turbulente_->valeurs().echange_espace_virtuel();
89 diffusivite_turbulente_->valeurs().echange_espace_virtuel();
90}
91
92/*! @brief Computes the turbulent diffusion.
93 *
94 * turbulent_diffusion = turbulent_viscosity / turbulent_Schmidt_number
95 *
96 * @return The newly computed turbulent diffusion field.
97 * @throws If diffusivite_turbulente and viscosite_turbulente fields do not have the same number of nodal values.
98 */
100{
101 DoubleTab& alpha_t = diffusivite_turbulente_->valeurs();
102 const DoubleTab& nu_t = la_viscosite_turbulente_->valeurs();
103 double temps = la_viscosite_turbulente_->temps();
104 int n = alpha_t.size();
105 if (nu_t.size() != n)
106 {
107 Cerr << "The DoubleTab arrays of diffusivite_turbulente and viscosite_turbulente fields" << finl;
108 Cerr << "must have the same number of nodal values" << finl;
109 exit();
110 }
111
112 for (int i = 0; i < n; i++)
113 alpha_t[i] = nu_t[i] / LeScturb_;
114 diffusivite_turbulente_->changer_temps(temps);
115 if (equation().probleme().is_dilatable())
116 diviser_par_rho_si_dilatable(diffusivite_turbulente_->valeurs(), equation().probleme().milieu());
118}
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 defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Probleme_base & probleme()
Returns the problem associated with the equation.
Milieu_base This class is the base of the (physical) medium hierarchy.
Definition Milieu_base.h:50
Scalar turbulence model using the turbulent Schmidt number to compute turbulent diffusion:
virtual int a_pour_Champ_Fonc(const Motcle &, OBS_PTR(Champ_base)&) const
Returns 1 if a functional field (Champ_Fonc) with the specified name is owned by the turbulence model...
void mettre_a_jour(double) override
Computes the turbulent coefficient used in the equation and the wall law.
virtual int comprend_champ(const Motcle &) const
Returns 1 if the keyword passed as parameter is a field name of the object.
Champ_Fonc_base & calculer_diffusion_turbulente()
Computes the turbulent diffusion.
Convection_Diffusion_std & equation()
virtual void set_param(Param &) const override
int loi_paroi_non_nulle() const
Returns whether a wall law is set (const version).
Base class for scalar turbulence models that compute turbulent diffusivity as:
OBS_PTR(Champ_Fonc_base) la_viscosite_turbulente_
A character string (Nom) in uppercase.
Definition Motcle.h:26
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
virtual const Milieu_base & milieu() const
Returns the physical medium associated with the problem (const version).
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
_SIZE_ size() const
Definition TRUSTVect.tpp:45