TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Paroi_UTAU_IMP_Impl.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 <Paroi_UTAU_IMP_Impl.h>
17#include <Champ_Don_base.h>
18#include <Motcle.h>
19
21{
22 // Definition des mots-cles
23 Motcles les_mots(3);
24 les_mots[0] = "u_tau";
25 les_mots[1] = "lambda_c";
26 les_mots[2] = "diam_hydr";
27
28 u_star_ok = 0;
29 lambda_c_ok = 0;
30 int diam_ok = 0;
31
32 // Lecture et interpretation
33 Motcle motlu, accolade_fermee="}", accolade_ouverte="{";
34 s >> motlu;
35 if(motlu == accolade_ouverte)
36 {
37 // on passe l'accolade ouvrante
38 s >> motlu;
39 }
40 while (motlu != accolade_fermee)
41 {
42 int rang=les_mots.search(motlu);
43 switch(rang)
44 {
45 case 0 : // u_star expression
46 {
47 u_star_ok = 1;
48 s >> u_star;
49 break;
50 }
51 case 1 : // lambda_c expression
52 {
54 Nom tmp;
55 s >> tmp;
56 Cerr << "Lecture et interpretation de la fonction " << tmp << " ... ";
57 lambda_c.setNbVar(2+Objet_U::dimension);
58 lambda_c.setString(tmp);
59 lambda_c.addVar("x");
61 lambda_c.addVar("y");
63 lambda_c.addVar("z");
64 lambda_c.addVar("Re");
65 lambda_c.addVar("Dh");
66 lambda_c.parseString();
67 break;
68 }
69 case 2: // diam_hydr
70 diam_ok = 1;
71 s >> diam_hydr;
72 break;
73 default : // non compris
74 Cerr << "Mot cle \"" << motlu << "\" non compris lors de la lecture d'un Paroi_UTAU_Impose" << finl;
76 }
77 s >> motlu;
78 }
79
80 if ((u_star_ok == 0) && (lambda_c_ok == 0))
81 {
82 Cerr << "Il faut definir le champ u_star a une composante ou lambda_c=f(Re,Dh,x,y,z)" << finl;
84 }
85
86 if (u_star_ok == 1)
87 if (u_star->nb_comp()!=1)
88 {
89 Cerr << "Il faut definir le champ u_star a une composante" << finl;
91 }
92
93 if ((lambda_c_ok == 1) && (diam_ok == 0))
94 {
95 Cerr << "Il faut definir le diametre hydraulique si vous definissez lambda_c" << finl;
97
98 }
99 return s;
100}
101
102double Paroi_UTAU_IMP_Impl::calculer_utau(const DoubleVect& pos, double norm_v, double d_visco)
103{
104 if (u_star_ok == 1)
105 {
106 return u_star->valeur_a_compo(pos,0);
107 }
108 else
109 {
110 double dh = diam_hydr->valeur_a_compo(pos,0);
111 double reynolds=norm_v*dh/d_visco;
112
113 for (int i=0; i<Objet_U::dimension; i++)
114 {
115 lambda_c.setVar(i,pos[i]);
116 }
117 lambda_c.setVar("Re",reynolds);
118 lambda_c.setVar("Dh",dh);
119 double lambda = lambda_c.eval();
120 return norm_v*sqrt(lambda/8.);
121 }
122}
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
Un tableau d'objets de la classe Motcle.
Definition Motcle.h:63
int search(const Motcle &t) const
Definition Motcle.cpp:321
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
static int dimension
Definition Objet_U.h:99
Entree & lire_donnees(Entree &s)
double calculer_utau(const DoubleVect &pos, double norm_v, double d_visco)
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455