TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Paroi_std_hyd_VDF_diphasique.cpp
1/****************************************************************************
2* Copyright (c) 2019, 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_std_hyd_VDF_diphasique.h>
17#include <Domaine_Cl_VDF.h>
18#include <Dirichlet_paroi_fixe.h>
19#include <Dirichlet_paroi_defilante.h>
20#include <Fluide_Quasi_Compressible.h>
21#include <Equation_base.h>
22#include <Fluide_Diphasique.h>
23#include <Transport_Interfaces_FT_Disc.h>
24#include <Probleme_base.h>
25#include <Champ_Uniforme.h>
26
27Implemente_instanciable( Paroi_std_hyd_VDF_diphasique, "loi_standard_hydr_diphasique_VDF", Paroi_std_hyd_VDF ) ;
28
30{
31 return os << que_suis_je() << " " << le_nom();
32}
33
35{
37 return is;
38}
39
40// tab1 = tab_nu_t and tab2 = tab_k
41int Paroi_std_hyd_VDF_diphasique::calculer_hyd(DoubleTab& tab1, DoubleTab& tab2)
42{
43 const Domaine_VDF& domaine_VDF = ref_cast(Domaine_VDF, le_dom_dis_.valeur());
44 const IntVect& orientation = domaine_VDF.orientation();
45 const IntTab& face_voisins = domaine_VDF.face_voisins();
46 const Equation_base& eqn_hydr = mon_modele_turb_hyd->equation();
47 const DoubleVect& vit = eqn_hydr.inconnue().valeurs();
48
49 // Physical properties of both phases
50 const Fluide_Diphasique& le_fluide = ref_cast(Fluide_Diphasique, eqn_hydr.milieu());
51 const Fluide_Incompressible& phase_1 = le_fluide.fluide_phase(1);
52 const Fluide_Incompressible& phase_0 = le_fluide.fluide_phase(0);
53 const Champ_Don_base& ch_visco_cin_ph1 = phase_1.viscosite_cinematique();
54 const Champ_Don_base& ch_visco_cin_ph0 = phase_0.viscosite_cinematique();
55 const DoubleTab& tab_visco_ph1 = phase_1.viscosite_cinematique().valeurs();
56 const DoubleTab& tab_visco_ph0 = phase_0.viscosite_cinematique().valeurs();
57 const double delta_nu = tab_visco_ph1(0,0) - tab_visco_ph0(0,0);
58
59 // One way to get the Transport equation to pass the indicator DoubleTab
60 const Domaine_Cl_dis_base& domaine_Cl_dis_base = eqn_hydr.domaine_Cl_dis();
61 const Equation_base& eqn_trans = domaine_Cl_dis_base.equation().probleme().equation("Transport_Interfaces_FT_Disc");
62 const Transport_Interfaces_FT_Disc& eqn_interf = ref_cast(Transport_Interfaces_FT_Disc, eqn_trans);
63 const DoubleTab& indic = eqn_interf.inconnue().valeurs();
64
65 double visco_ph0=-1;
66 int l_unif;
67
68 if (sub_type(Champ_Uniforme,ch_visco_cin_ph1) && sub_type(Champ_Uniforme,ch_visco_cin_ph0))
69 {
70 visco_ph0 = std::max(tab_visco_ph0(0,0),DMINFLOAT);
71 l_unif = 1;
72 }
73 else
74 l_unif = 0;
75 if ((!l_unif) && ((tab_visco_ph1.local_min_vect()<DMINFLOAT) || (tab_visco_ph0.local_min_vect()<DMINFLOAT) ))
76 {
77 Cerr << "Negative viscosity !!!" << finl;
79 }
80
81 int ndeb,nfin;
82 int elem,ori;
83 double norm_v;
84 double dist;
85 double u_plus_d_plus,d_visco;
86 //double val,val1,val2;
87
88 //****************************************************************
89 // Modifs du 19/10 pour etre coherent avec la diffusion turbulente
90 double signe;
91 //****************************************************************
92
93 // Boucle sur les bords
94
95 for (int n_bord=0; n_bord<domaine_VDF.nb_front_Cl(); n_bord++)
96 {
97
98 // pour chaque condition limite on regarde son type
99 // On applique les lois de paroi uniquement
100 // aux voisinages des parois
101
102 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
103 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
104 ndeb = le_bord.num_premiere_face();
105 nfin = ndeb + le_bord.nb_faces();
106
107 if (sub_type(Dirichlet_paroi_fixe,la_cl.valeur()) || sub_type(Dirichlet_paroi_defilante,la_cl.valeur() ))
108 {
109 int isdiri=0;
110 DoubleTab vitesse_imposee_face_bord(le_bord.nb_faces(),dimension);
111 if (sub_type(Dirichlet_paroi_defilante,la_cl.valeur()) )
112 {
113 isdiri=1;
114 const Dirichlet_paroi_defilante& cl_diri = ref_cast(Dirichlet_paroi_defilante,la_cl.valeur());
115 for (int face=ndeb; face<nfin; face++)
116 for (int k=0; k<dimension; k++)
117 vitesse_imposee_face_bord(face-ndeb,k) = cl_diri.val_imp(face-ndeb,k);
118 }
119 ArrOfDouble vit_paroi(dimension);
120 ArrOfDouble val(dimension-1);
121
122
123 for (int num_face=ndeb; num_face<nfin; num_face++)
124 {
125 if (isdiri)
126 {
127 int rang = num_face-ndeb;
128 for (int k=0; k<dimension; k++)
129 vit_paroi[k]=vitesse_imposee_face_bord(rang,k);
130 }
131 ori = orientation(num_face);
132 if ( (elem =face_voisins(num_face,0)) != -1)
133 {
134 //norm_v=norm_2D_vit(vit,elem,ori,domaine_VDF,val);
135 norm_v=norm_vit(vit,elem,ori,domaine_VDF,vit_paroi,val);
136 signe = -1.;
137 }
138 else
139 {
140 elem = face_voisins(num_face,1);
141 //norm_v=norm_2D_vit(vit,elem,ori,domaine_VDF,val);
142 norm_v=norm_vit(vit,elem,ori,domaine_VDF,vit_paroi,val);
143 signe = 1.;
144 }
145 if (axi)
146 dist=domaine_VDF.dist_norm_bord_axi(num_face);
147 else
148 dist=domaine_VDF.dist_norm_bord(num_face);
149 if (l_unif)
150 d_visco = visco_ph0 + indic(elem) * delta_nu;
151 else
152 d_visco = (tab_visco_ph0.nb_dim()==1 ? (tab_visco_ph0(elem) + indic(elem) * delta_nu) :
153 (tab_visco_ph0(elem,0) + indic(elem) * delta_nu));
154
155 u_plus_d_plus = norm_v*dist/d_visco;
156
157 // Calcul de u* et des grandeurs turbulentes:
158
159
160 // tab1=tab_nu_t
161 // tab2=tab_k
162 //calculer_local(u_plus_d_plus,d_visco,tab_nu_t,tab_k,norm_v,dist,elem,num_face);
163 calculer_local(u_plus_d_plus,d_visco,tab1,tab2,norm_v,dist,elem,num_face);
164
165 // Calcul de la contrainte tangentielle
166
167 double vit_frot = tab_u_star(num_face)*tab_u_star(num_face);
168
169 if (ori == 0)
170 {
171 Cisaillement_paroi_(num_face,1) = vit_frot*val[0]*signe;
172 if (dimension==3)
173 Cisaillement_paroi_(num_face,2) = vit_frot*val[1]*signe;
174 Cisaillement_paroi_(num_face,0) = 0.;
175 }
176 else if (ori == 1)
177 {
178 Cisaillement_paroi_(num_face,0) = vit_frot*val[0]*signe;
179 if (dimension==3)
180 Cisaillement_paroi_(num_face,2) = vit_frot*val[1]*signe;
181 Cisaillement_paroi_(num_face,1) = 0.;
182 }
183 else
184 {
185 Cisaillement_paroi_(num_face,0) = vit_frot*val[0]*signe;
186 Cisaillement_paroi_(num_face,1) = vit_frot*val[1]*signe;
187 Cisaillement_paroi_(num_face,2) = 0.;
188 }
189
190 // Calcul de u+ d+
191 calculer_uplus_dplus(uplus_, tab_d_plus_, tab_u_star_, num_face, dist, d_visco, norm_v) ;
192 }
193
194
195 }
196 }
197 Cisaillement_paroi_.echange_espace_virtuel();
200
201 return 1;
202
203}
204
206{
207 Cerr << " Paroi_std_hyd_VDF_diphasique::calculer_hyd(DoubleTab& tab_k_eps) " << finl;
208 Cerr << "on ne doit pas entrer dans cette methode" << finl;
209 Cerr << " car elle est definie uniquement pour la LES " << finl ;
211 return 1 ;
212} // fin de calcul_hyd (K-eps)
class Champ_Don_base base class of Given Fields (not calculated)
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
DoubleTab & valeurs() override
Returns the array of field values at the current time.
Champ_Uniforme Represents a field that is constant in space and time.
class Cond_lim Generic class used to represent any class
Definition Cond_lim.h:31
Dirichlet_paroi_defilante Imposes the wall velocity in an equation of type Navier_Stokes.
Dirichlet_paroi_fixe Represents a fixed wall in a Navier-Stokes type equation.
virtual double val_imp(int i) const
Returns the imposed value on the i-th component of the field at the boundary at the default time of c...
Definition Dirichlet.cpp:35
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class Domaine_VDF
Definition Domaine_VDF.h:61
double dist_norm_bord_axi(int num_face) const
Returns the normal distance for a boundary face (cylindrical coordinates).
int orientation(int) const override
inline DoubleVect& Domaine_VDF::porosite_face() {
double dist_norm_bord(int num_face) const override
Returns the normal distance for a boundary face (Cartesian coordinates).
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
Definition Domaine_VF.h:418
int nb_front_Cl() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Equation_base The role of an equation is the calculation of one or more fields....
virtual const Milieu_base & milieu() const =0
virtual const Champ_Inc_base & inconnue() const =0
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the discretized boundary condition domain associated with the equation.
Probleme_base & probleme()
Returns the problem associated with the equation.
const Fluide_Incompressible & fluide_phase(int la_phase) const
Represents an incompressible fluid and its properties:
const Champ_Don_base & viscosite_cinematique() const
Definition Fluide_base.h:56
class Front_VF
Definition Front_VF.h:36
int nb_faces() const
Definition Front_VF.h:53
int num_premiere_face() const
Definition Front_VF.h:63
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
static int dimension
Definition Objet_U.h:94
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual const Nom & le_nom() const
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Objet_U.cpp:317
static int axi
Definition Objet_U.h:96
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
: class Paroi_std_hyd_VDF_diphasique
CLASS: Paroi_std_hyd_VDF.
int calculer_local(double, double, DoubleTab &, double, double, int, int)
void calculer_uplus_dplus(DoubleVect &, DoubleVect &, DoubleVect &, int, double, double, double)
virtual const Equation_base & equation(int) const =0
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52
int nb_dim() const
Definition TRUSTTab.h:199
_TYPE_ local_min_vect(Mp_vect_options opt=VECT_REAL_ITEMS) const
Definition TRUSTVect.h:155
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")
const Champ_Inc_base & inconnue() const override
const DoubleVect & tab_u_star() const