TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Reynolds_maille_Champ_Face.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#include <Reynolds_maille_Champ_Face.h>
17#include <Champ_Face_VDF.h>
18
19#include <Domaine_VDF.h>
20
21Implemente_instanciable(Reynolds_maille_Champ_Face, "Reynolds_maille_Champ_Face", Champ_Fonc_Face_VDF);
22
23Sortie& Reynolds_maille_Champ_Face::printOn(Sortie& s) const { return s << que_suis_je() << " " << le_nom(); }
24
26
27void Reynolds_maille_Champ_Face::associer_champ(const Champ_Face_VDF& la_vitesse, const Champ_Don_base& la_viscosite_cinematique)
28{
29 vitesse_ = la_vitesse;
30 nu_ = la_viscosite_cinematique;
31}
32
33// Methode de calcul de la valeur sur une face d'un champ uniforme ou non a plusieurs composantes
34inline double valeur(const DoubleTab& champ, const int face, const int compo, const Domaine_VDF& le_dom_VDF)
35{
36 if (champ.dimension(0) == 1) return champ(0, compo); // Champ uniforme
37 else
38 {
39 int elem0 = le_dom_VDF.face_voisins(face, 0), elem1 = le_dom_VDF.face_voisins(face, 1);
40 if (elem0 < 0) elem0 = elem1; // face frontiere
41 if (elem1 < 0) elem1 = elem0; // face frontiere
42 return 0.5 * (champ(elem0, compo) + champ(elem1, compo));
43 }
44}
45
47{
48 const int nb_faces = domaine_vdf().nb_faces();
49 DoubleTab& re = valeurs(); // Reynolds de maille
50 for (int face = 0; face < nb_faces; face++)
51 {
52 // Calcul de la viscosite face
53 double nu_face = valeur(nu_->valeurs(), face, 0, domaine_vdf());
54 // Calcul de la taille de maille entourant la face
55 double taille_maille = domaine_vdf().volumes_entrelaces()(face) / domaine_vdf().face_surfaces(face);
56 // Calcul du Reynolds de maille
57 re(face) = std::fabs(vitesse_->valeurs()(face)) * taille_maille / nu_face; // Reynolds_maille = |Uface| * taille_maille / nu_face
58 }
59
60 changer_temps(tps);
62}
classe Champ_Don_base classe de base des Champs donnes (non calcules)
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
class Champ_Face_VDF Cette classe sert a representer un champ vectoriel dont on ne calcule
classe Champ_Fonc_Face_VDF
const Domaine_VDF & domaine_vdf() const override
void mettre_a_jour(double temps) override
Mise a jour en temps du champ.
virtual double changer_temps(const double t)
Fixe le temps auquel se situe le champ.
class Domaine_VDF
Definition Domaine_VDF.h:64
virtual const DoubleVect & face_surfaces() const
Definition Domaine_VF.h:51
int nb_faces() const
renvoie le nombre global de faces.
Definition Domaine_VF.h:471
DoubleVect & volumes_entrelaces()
Definition Domaine_VF.h:99
int face_voisins(int num_face, int i) const
renvoie l'element voisin de numface dans la direction i.
Definition Domaine_VF.h:418
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Nom & le_nom() const override
Renvoie le nom du champ.
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
void mettre_a_jour(double) override
Mise a jour en temps du champ.
void associer_champ(const Champ_Face_VDF &, const Champ_Don_base &)
Classe de base des flux de sortie.
Definition Sortie.h:52