TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Perte_Charge_Anisotrope_VDF_Face.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 <Perte_Charge_Anisotrope_VDF_Face.h>
17#include <Param.h>
18
19Implemente_instanciable(Perte_Charge_Anisotrope_VDF_Face, "Perte_Charge_Anisotrope_VDF_Face", Perte_Charge_VDF_base);
20
21Sortie& Perte_Charge_Anisotrope_VDF_Face::printOn(Sortie& s) const { return s << que_suis_je() << finl; }
22
24{
26 if (v->nb_comp() != dimension)
27 {
28 Cerr << "Il faut definir le champ direction a " << dimension << " composantes" << finl;
30 }
31 return s;
32}
33
35{
37 param.ajouter_non_std("lambda_ortho", (this), Param::REQUIRED);
38 param.ajouter("direction", &v, Param::REQUIRED);
39}
40
42{
43 if (mot == "lambda_ortho")
44 {
45 Nom tmp;
46 is >> tmp;
47 Cerr << "Lecture et interpretation de la fonction " << tmp << " ... ";
48 lambda_ortho.setNbVar(2 + dimension);
49 lambda_ortho.setString(tmp);
50 lambda_ortho.addVar("Re");
51 lambda_ortho.addVar("t");
52 lambda_ortho.addVar("x");
53 if (dimension > 1)
54 lambda_ortho.addVar("y");
55 if (dimension > 2)
56 lambda_ortho.addVar("z");
57 lambda_ortho.parseString();
58 Cerr << " Ok" << finl;
59 return 1;
60 }
61 else
63}
64
65void Perte_Charge_Anisotrope_VDF_Face::coeffs_perte_charge(const DoubleVect& u, const DoubleVect& pos, double t, double norme_u, double dh, double nu, double reynolds, double& coeff_ortho,
66 double& coeff_long, double& u_l, DoubleVect& v_valeur) const
67{
68
69 // Calcul de lambda
70 lambda.setVar(0, reynolds);
71 lambda.setVar(1, t);
72 lambda.setVar(2, pos[0]);
73 if (dimension > 1)
74 lambda.setVar(3, pos[1]);
75 if (dimension > 2)
76 lambda.setVar(4, pos[2]);
77
78 // Calcul de lambda_ortho
79 lambda_ortho.setVar(0, reynolds);
80 lambda_ortho.setVar(1, t);
81 lambda_ortho.setVar(2, pos[0]);
82 if (dimension > 1)
83 lambda_ortho.setVar(3, pos[1]);
84 if (dimension > 2)
85 lambda_ortho.setVar(4, pos[2]);
86 double l_ortho = lambda_ortho.eval(); // Pour ne pas evaluer 2 fois le parser
87
88 // Calcul de v et ||v||^2
89 // DoubleVect v_valeur(dimension);
90 double vcarre = 0;
91 v->valeur_a(pos, v_valeur);
92 for (int dim = 0; dim < dimension; dim++)
93 vcarre += v_valeur[dim] * v_valeur[dim];
94 v_valeur /= sqrt(vcarre);
95 // Calcul de u.v
96 double scal = 0;
97 for (int dim = 0; dim < dimension; dim++)
98 scal += u[dim] * v_valeur[dim];
99
100 // Calcul du resultat
101 /*
102 for (int dim=0;dim<dimension;dim++)
103 p_charge[dim] = -l_ortho*norme_u/2./dh*u[dim]
104 -(lambda.eval()-l_ortho)*scal*v_valeur[dim]*norme_u/2./dh;
105 */
106 coeff_ortho = l_ortho * norme_u / 2. / dh;
107 coeff_long = lambda.eval() * norme_u / 2. / dh;
108 u_l = scal;
109}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
virtual void set_param(Param &) const
Definition Objet_U.h:135
virtual int lire_motcle_non_standard(const Motcle &motlu, Entree &is)
Lecture des parametres de type non simple d'un objet_U a partir d'un flot d'entree.
Definition Objet_U.cpp:115
static int dimension
Definition Objet_U.h:99
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
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
@ REQUIRED
Definition Param.h:115
void ajouter_non_std(const char *keyword, const Objet_U *value, Param::Nature nat=Param::OPTIONAL)
Register a keyword handled by Objet_U::lire_motcle_non_standard.
Definition Param.cpp:489
Perte de charge anisotrope (selon un vecteur unitaire v et dans le plan orthogonal a ce vecteur).
void coeffs_perte_charge(const DoubleVect &u, const DoubleVect &pos, double t, double norme_u, double dh, double nu, double reynolds, double &coeff_ortho, double &coeff_long, double &u_l, DoubleVect &v_valeur) const override
Implemente le calcul effectif de la perte de charge pour un lieu donne.
int lire_motcle_non_standard(const Motcle &, Entree &) override
Lecture des parametres de type non simple d'un objet_U a partir d'un flot d'entree.
Factorise les fonctionnalites de plusieurs pertes de charge en VEF, vitesse aux faces.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52