TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Boundary_field_keps_from_ud.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
17#include <Boundary_field_keps_from_ud.h>
18#include <Boundary_field_uniform_keps_from_ud.h>
19#include <Param.h>
20#include <Front_VF.h>
21#include <Champ_front_uniforme.h>
22#include <Champ_Inc_base.h>
23#include <Equation_base.h>
24#include <Schema_Temps_base.h>
25#include <Champ_front_calc.h>
26
27Implemente_instanciable(Boundary_field_keps_from_ud,"Boundary_field_keps_from_ud",Ch_front_var_instationnaire_dep);
28
30{
31 return (os);
32}
33
34// XD Boundary_field_keps_from_ud front_field_base Boundary_field_keps_from_ud BRACE To specify a K-Eps inlet field with
35// XD_CONT hydraulic diameter, speed, and turbulence intensity (VDF only)
37{
38 Param param(que_suis_je());
39 param.ajouter("U", &vitesse_, Param::REQUIRED); // XD_ADD_P front_field_base
40 // XD_CONT U 0 Initial velocity magnitude
41 param.ajouter("D", &d, Param::REQUIRED); // XD_ADD_P double
42 // XD_CONT Hydraulic diameter
43 param.ajouter("I", &I, Param::REQUIRED); // XD_ADD_P double
44 // XD_CONT Turbulence intensity [%]
45 param.lire_avec_accolades(is);
46 if (I<=0 || I>=1)
47 {
48 Cerr << "Turbulence intensity is a number between 0 and 1. For instance, 0.05 means 5%." << finl;
50 }
52 return (is);
53}
54
56{
57 const Front_VF& le_bord = ref_cast(Front_VF,frontiere_dis());
58 int nb_faces = le_bord.nb_faces();
59 DoubleTab& tab=les_valeurs->valeurs();
60 tab.resize(nb_faces, 2);
61
62 if (!Ch_front_var_instationnaire_dep::initialiser(tps,inco)) return 0;
63
64 //sch = inco.equation().schema_temps();
65 int nb_cases=inco.equation().schema_temps().nb_valeurs_temporelles();
66 // Define the boundary field for the velocity:
67 Champ_front_base& vitesse_frontiere = vitesse_.valeur();
68 vitesse_frontiere.associer_fr_dis_base(frontiere_dis());
69 vitesse_frontiere.completer();
70 vitesse_frontiere.fixer_nb_valeurs_temporelles(nb_cases);
71 vitesse_frontiere.initialiser(tps, inco);
72
73 // pour utiliser la trace ...
74 if (sub_type(Champ_front_calc,vitesse_frontiere))
75 ref_cast(Champ_front_calc,vitesse_frontiere).set_distant(0);
76
77 vitesse_frontiere.mettre_a_jour(tps);
78
79 mettre_a_jour(tps);
80 return 1;
81}
82
84{
85 // Update speed:
86 Champ_front_base& vitesse_frontiere = vitesse_.valeur();
87 vitesse_frontiere.changer_temps_futur(tps, 1);
88 vitesse_frontiere.mettre_a_jour(tps); // OK
89
90 // Compute KEps:
91 //const DoubleTab& vit = vitesse_frontiere.valeurs(); // Se base sur temps_defaut qui reste a 0 !!
92 const DoubleTab& vit = vitesse_frontiere.valeurs_au_temps(tps);
93 DoubleTab& keps = les_valeurs->valeurs();
94 int nb_faces = ref_cast(Front_VF,frontiere_dis()).nb_faces();
95 for (int face=0; face<nb_faces; face++)
96 {
97 int i = (vit.dimension(0)==1 ? 0 : face); // Uniform field
98 double u = (vit.line_size() == 1) ? std::fabs(vit(i, 0)) : sqrt(vit(i, 0)*vit(i, 0)+vit(i, 1)*vit(i, 1));
99
100 pair val = k_eps_from_udi(u, d, I, dimension);
101 keps(face, 0) = val.k;
102 keps(face, 1) = val.eps;
103 if (face==0)
104 {
105 Cerr << "Provisoire t=" << tps << " " << " U(t)=" << 2+tps << " u(t)=" << u << " k=" << val.k << " eps=" << val.eps << finl;
106 }
107 }
108}
109
110
void mettre_a_jour(double temps) override
NE FAIT RIEN, a surcharger.
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialisation en debut de calcul.
classe Ch_front_var_instationnaire_dep Cette classe abstraite represente un champ sur une frontiere,
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialisation en debut de calcul.
Classe Champ_Inc_base.
classe Champ_front_base Classe de base pour la hierarchie des champs aux frontieres.
virtual int initialiser(double temps, const Champ_Inc_base &inco)
Initialisation en debut de calcul.
virtual void associer_fr_dis_base(const Frontiere_dis_base &)
Associe une frontiere discretisee au champ.
virtual void changer_temps_futur(double temps, int i)
Change la valeur du temps pour la ieme valeur temporelle apres le present.
virtual const Frontiere_dis_base & frontiere_dis() const
Renvoie la frontiere discretisee associee au champ.
virtual DoubleTab & valeurs_au_temps(double temps)=0
virtual void fixer_nb_valeurs_temporelles(int nb_cases)
Appele par Conds_lim::completer Par defaut ne fait rien.
virtual void mettre_a_jour(double temps)
NE FAIT RIEN, a surcharger.
virtual void completer()
classe Champ_front_calc Classe derivee de Champ_front_var qui represente les
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Schema_Temps_base & schema_temps()
Renvoie le schema en temps associe a l'equation.
virtual void fixer_nb_comp(int i)
Fixe le nombre de composantes du champ.
class Front_VF
Definition Front_VF.h:36
int nb_faces() const
Definition Front_VF.h:53
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
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
@ REQUIRED
Definition Param.h:115
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
virtual int nb_valeurs_temporelles() const =0
Classe de base des flux de sortie.
Definition Sortie.h:52
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
int line_size() const
Definition TRUSTVect.tpp:67