TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Perte_Charge_Directionnelle_VEF_P1NC.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_Directionnelle_VEF_P1NC.h>
17#include <Motcle.h>
18#include <Equation_base.h>
19#include <Param.h>
20
21Implemente_instanciable(Perte_Charge_Directionnelle_VEF_P1NC,"Perte_Charge_Directionnelle_VEF_P1NC",Perte_Charge_VEF);
22// XD perte_charge_directionnelle source_base perte_charge_directionnelle BRACE Directional pressure loss (available in
23// XD_CONT VEF and PolyMAC_CDO).
24// XD attr lambda chaine lambda_u REQ Function for loss coefficient which may be Reynolds dependant (Ex: 64/Re).
25// XD attr diam_hydr champ_don_base diam_hydr REQ Hydraulic diameter value.
26// XD attr direction champ_don_base direction REQ Field which indicates the direction of the pressure loss.
27// XD attr sous_zone chaine sous_zone OPT Optional sub-area where pressure loss applies.
28
30{
31 return s << que_suis_je() << finl;
32}
33
35{
37 if (v->nb_comp()!=dimension)
38 {
39 Cerr << "Il faut definir le champ direction a " << dimension << " composantes" << finl;
40 exit();
41 }
42 return s;
43}
44
50
51////////////////////////////////////////////////////////////////
52// //
53// Fonction principale : perte_charge //
54// //
55////////////////////////////////////////////////////////////////
56
57void Perte_Charge_Directionnelle_VEF_P1NC::coeffs_perte_charge(const DoubleVect& u, const DoubleVect& pos,
58 double t, double norme_u, double dh, double nu, double reynolds,double& coeff_ortho, double& coeff_long,double& u_l, DoubleVect& v_valeur) const
59{
60
61 // Calcul de lambda
62 lambda.setVar(0,reynolds);
63 lambda.setVar(1,t);
64 lambda.setVar(2,pos[0]);
65 if (dimension>1)
66 lambda.setVar(3,pos[1]);
67 if (dimension>2)
68 lambda.setVar(4,pos[2]);
69
70 // Calcul de v et ||v||^2
71 // DoubleVect v_valeur(dimension);
72 double vcarre=0;
73 v->valeur_a(pos,v_valeur);
74 for (int dim=0; dim<dimension; dim++)
75 vcarre+=v_valeur[dim]*v_valeur[dim];
76 v_valeur/=sqrt(vcarre);
77 // Calcul de u.v
78 double scal=0;
79 for (int dim=0; dim<dimension; dim++)
80 scal+=u[dim]*v_valeur[dim];
81 /*
82 // Calcul du resultat
83 for (int dim=0;dim<dimension;dim++)
84 p_charge[dim] = -lambda.eval()*scal*v_valeur[dim]*norme_u/2./dh;
85 */
86 u_l=scal;
87 coeff_long=lambda.eval()*norme_u/2./dh;
88 coeff_ortho=0;
89}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
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
Perte de charge directionnelle (selon un vecteur unitaire v).
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.
Factorise les fonctionnalites de plusieurs pertes de charge en VEF, vitesse aux faces.
virtual void set_param(Param &param) const override
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