TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Modele_turbulence_hyd_LES_Fst_VEF.cpp
1/****************************************************************************
2* Copyright (c) 2024, 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
17#include <Modele_turbulence_hyd_LES_Fst_VEF.h>
18#include <Schema_Temps_base.h>
19#include <Domaine_Cl_VEF.h>
20#include <Domaine_VEF.h>
21#include <Champ_P1NC.h>
22#include <TRUSTTrav.h>
23#include <Debog.h>
24
25Implemente_instanciable_sans_constructeur(Modele_turbulence_hyd_LES_Fst_VEF, "Modele_turbulence_hyd_sous_maille_fst_VEF", Modele_turbulence_hyd_LES_VEF_base);
26
31
32Sortie& Modele_turbulence_hyd_LES_Fst_VEF::printOn(Sortie& s) const { return s << que_suis_je() << " " << le_nom(); }
33
35
37{
38 const Domaine_VEF& domaine_VEF = ref_cast(Domaine_VEF, le_dom_VF_.valeur());
39 const int nb_elem_tot = domaine_VEF.nb_elem_tot();
40 double temps = mon_equation_->inconnue().temps();
41 DoubleTab& visco_turb = la_viscosite_turbulente_->valeurs();
42 const int nb_elem = domaine_VEF.nb_elem();
43
44 Racine_.resize(nb_elem_tot);
45
47
48 if (visco_turb.size() != nb_elem)
49 {
50 Cerr << "Size error for the array containing the values of the turbulent viscosity." << finl;
52 }
53
54 Debog::verifier("Modele_turbulence_hyd_LES_Fst_VEF::calculer_viscosite_turbulente visco_turb 0", visco_turb);
55
56 for (int elem = 0; elem < nb_elem; elem++)
57 visco_turb(elem) = C1_ * l_(elem) * l_(elem) * sqrt(Racine_[elem]);
58
59 Debog::verifier("Modele_turbulence_hyd_LES_Fst_VEF::calculer_viscosite_turbulente visco_turb 1", visco_turb);
60
61 la_viscosite_turbulente_->changer_temps(temps);
62 return la_viscosite_turbulente_;
63}
64
66{
67 const DoubleTab& la_vitesse = mon_equation_->inconnue().valeurs();
68 const Domaine_Cl_VEF& domaine_Cl_VEF = ref_cast(Domaine_Cl_VEF, le_dom_Cl_.valeur());
69 const Domaine_VEF& domaine_VEF = ref_cast(Domaine_VEF, le_dom_VF_.valeur());
70 const int nb_elem = domaine_VEF.nb_elem();
71 const int nb_elem_tot = domaine_VEF.nb_elem_tot();
72 const DoubleVect& vol = domaine_VEF.volumes();
73
74 DoubleTab Sij(nb_elem_tot, dimension, dimension);
75
76 // MAINTENANT : on prend la racine cubique du volume
77
78 for (int elem = 0; elem < nb_elem; elem++)
79 l_(elem) = exp(log(vol[elem]) / double(dimension));
80
81 DoubleTab duidxj(nb_elem, dimension, dimension);
82 Champ_P1NC::calcul_gradient(la_vitesse, duidxj, domaine_Cl_VEF);
83
84 for (int elem = 0; elem < nb_elem_tot; elem++)
85 for (int i = 0; i < dimension; i++)
86 for (int j = 0; j < dimension; j++)
87 Sij(elem, i, j) = 0.5 * (duidxj(elem, i, j) + duidxj(elem, j, i));
88
89 DoubleTrav vorticite(nb_elem, dimension);
90 vorticite = 0;
91 Champ_P1NC& vit = ref_cast(Champ_P1NC, mon_equation_->inconnue());
92 vit.cal_rot_ordre1(vorticite);
93
94 // On calcule Racine
95 for (int elem = 0; elem < nb_elem; elem++)
96 {
97 double temp = 0.;
98 for (int i = 0; i < dimension; i++)
99 {
100 for (int j = 0; j < dimension; j++)
101 temp += 2. * Sij(elem, i, j) * Sij(elem, i, j);
102
103 temp += vorticite(elem, i) * vorticite(elem, i);
104 }
105 Racine_(elem) = temp;
106 }
107}
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
void cal_rot_ordre1(DoubleTab &) const
static DoubleTab & calcul_gradient(const DoubleTab &, DoubleTab &, const Domaine_Cl_VEF &)
static void verifier(const char *const msg, double)
Definition Debog.cpp:21
class Domaine_VEF
Definition Domaine_VEF.h:53
double volumes(int i) const
Definition Domaine_VF.h:113
int nb_elem_tot() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Modele_turbulence_hyd_LES_Fst_VEF Cette classe correspond a la mise en oeuvre du modele sous
Class Modele_turbulence_hyd_LES_VEF_base.
static int dimension
Definition Objet_U.h:94
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
Base class for output streams.
Definition Sortie.h:52
_SIZE_ size() const
Definition TRUSTVect.tpp:45