TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Modele_turbulence_hyd_K_Eps_2_Couches.cpp
1/****************************************************************************
2* Copyright (c) 2015 - 2016, 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_hyd_K_Eps_2_Couches.h>
17#include <Schema_Temps_base.h>
18#include <Modifier_pour_fluide_dilatable.h>
19#include <Probleme_base.h>
20#include <Perf_counters.h>
21#include <Param.h>
22
23Implemente_instanciable(Modele_turbulence_hyd_K_Eps_2_Couches, "Modele_turbulence_hyd_K_Epsilon_2_Couches", Modele_turbulence_hyd_RANS_K_Eps_base);
24
26{
27 return s << que_suis_je() << " " << le_nom();
28}
29
31{
33}
34
35/*! @brief Calcule la viscosite turbulente au temps demande.
36 *
37 * @param (double temps) le temps auquel il faut calculer la viscosite
38 * @return (Champ_Fonc_base&) la viscosite turbulente au temps demande
39 * @throws erreur de taille de visco_turb_K_eps
40 */
42{
43 const Champ_base& chK_Eps = get_set_eq_transport().inconnue();
44 Nom type = chK_Eps.que_suis_je();
45 const DoubleTab& tab_K_Eps = chK_Eps.valeurs();
46 DoubleTab& visco_turb = la_viscosite_turbulente_->valeurs();
47
48 // K_Eps(i,0) = K au noeud i
49 // K_Eps(i,1) = Epsilon au noeud i
50
51 int n = tab_K_Eps.dimension(0);
52 if (visco_turb.size() != n)
53 {
54 OWN_PTR(Champ_Inc_base) visco_turb_au_format_K_eps;
55 visco_turb_au_format_K_eps.typer(type);
56 DoubleTab& visco_turb_K_eps = complete_viscosity_field(n, get_set_eq_transport().domaine_dis(), visco_turb_au_format_K_eps);
57
58 if (visco_turb_K_eps.size() != n)
59 {
60 Cerr << "visco_turb_K_eps size is " << visco_turb_K_eps.size() << " instead of " << n << finl;
62 }
63
64 fill_turbulent_viscosity_tab(n, tab_K_Eps, visco_turb_K_eps);
65 la_viscosite_turbulente_->affecter(visco_turb_au_format_K_eps.valeur());
66 }
67 else
68 fill_turbulent_viscosity_tab(n, tab_K_Eps, visco_turb);
69
70 la_viscosite_turbulente_->changer_temps(temps);
71 return la_viscosite_turbulente_;
72}
73
74void Modele_turbulence_hyd_K_Eps_2_Couches::fill_turbulent_viscosity_tab(const int n, const DoubleTab& tab_K_Eps, DoubleTab& turbulent_viscosity)
75{
76 for (int i = 0; i < n; i++)
77 {
78 if (tab_K_Eps(i, 1) <= EPS_MIN_)
79 turbulent_viscosity[i] = 0.;
80 else
81 turbulent_viscosity[i] = CMU * tab_K_Eps(i, 0) * tab_K_Eps(i, 0) / tab_K_Eps(i, 1);
82 }
83}
84
86{
88 calculer_viscosite_turbulente(equation().schema_temps().temps_courant());
91 la_viscosite_turbulente_->valeurs().echange_espace_virtuel();
92 return 1;
93}
94
99
100/*! @brief Effectue une mise a jour en temps du modele de turbulence.
101 *
102 * Met a jour l'equation de transport K-epsilon,
103 * calcule la loi de paroi et la viscosite turbulente
104 * au nouveau temps.
105 *
106 * @param (double temps) le temps de mise a jour
107 */
109{
114 statistics().begin_count(STD_COUNTERS::turbulent_viscosity, statistics().get_last_opened_counter_level()+1);
116 statistics().end_count(STD_COUNTERS::turbulent_viscosity);
117}
118
119/*! @brief Simple appel a Transport_K_Eps::completer()
120 *
121 */
127
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
Class Champ_Inc_base.
virtual DoubleTab & valeurs()=0
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
virtual void mettre_a_jour(double temps)
Performs a time update of all boundary conditions.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual void mettre_a_jour(double temps)
The value of the unknown at the time step has been calculated.
virtual void completer()
Completes the construction (initialization) of objects associated with the equation.
virtual int preparer_calcul()
Everything that does not depend on other possible problems.
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the discretized boundary condition domain associated with the equation.
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
virtual bool initTimeStep(double dt)
Allocation and initialization of the unknown and boundary conditions until present+dt.
Classe Modele_turbulence_hyd_K_Eps_2_Couches Cette classe represente le modele de turbulence (k,...
Champ_Fonc_base & calculer_viscosite_turbulente(double temps)
Calcule la viscosite turbulente au temps demande.
int preparer_calcul() override
Prepares the computation.
void completer() override
Simple appel a Transport_K_Eps::completer().
void mettre_a_jour(double) override
Effectue une mise a jour en temps du modele de turbulence.
DoubleTab & complete_viscosity_field(const int, const Domaine_dis_base &, Champ_Inc_base &)
std::enable_if_t<(M_TYPE==MODELE_TYPE::K_EPS||M_TYPE==MODELE_TYPE::K_EPS_REALISABLE||M_TYPE==MODELE_TYPE::K_OMEGA), void > calculate_limit_viscosity(Champ_Inc_base &, double)
Classe Modele_turbulence_hyd_RANS_K_Eps_base Classe de base des modeles de type RANS_keps.
OWN_PTR(Modele_Fonc_Bas_Reynolds_Base) &associe_modele_fonction()
virtual int preparer_calcul()
Prepares the computation.
Equation_base & equation()
Returns the equation associated with the turbulence model.
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual const Nom & le_nom() const
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Objet_U.cpp:317
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
class Schema_Temps_base
virtual int faire_un_pas_de_temps_eqn_base(Equation_base &)=0
Base class for output streams.
Definition Sortie.h:52
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
_SIZE_ size() const
Definition TRUSTVect.tpp:45
const Champ_Inc_base & inconnue() const override
Renvoie le champ inconnue de l'equation.
int controler_K_Eps()
Controle le champ inconnue K-epsilon en forcant a zero les valeurs du champ.