TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Paroi_scal_analytique_VEF.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#include <Paroi_scal_analytique_VEF.h>
16#include <Paroi_std_scal_hyd_VEF.h>
17#include <Paroi_std_hyd_VEF.h>
18#include <Probleme_base.h>
19#include <Champ_Uniforme.h>
20#include <Dirichlet_paroi_fixe.h>
21#include <Dirichlet_paroi_defilante.h>
22#include <Fluide_base.h>
23#include <Modele_turbulence_hyd_base.h>
24#include <Convection_Diffusion_Concentration.h>
25#include <Modele_turbulence_scal_base.h>
26#include <Constituant.h>
27
28Implemente_instanciable(Paroi_scal_analytique_VEF,"loi_analytique_scalaire_VEF",Paroi_scal_hyd_base_VEF);
29
30// printOn()
32{
33 return s << que_suis_je() << " " << le_nom();
34}
35
36// readOn
38{
40}
41
43{
44 const Domaine_VEF& domaine_VEF = ref_cast(Domaine_VEF, le_dom_dis_.valeur());
45
46 const IntTab& face_voisins = domaine_VEF.face_voisins();
47 DoubleTab& alpha_t = diffusivite_turb.valeurs();
48 Equation_base& eqn_hydr = mon_modele_turb_scal->equation().probleme().equation(0);
49 const Fluide_base& le_fluide = ref_cast(Fluide_base,eqn_hydr.milieu());
50 const DoubleVect& volumes_maille = domaine_VEF.volumes();
51 const DoubleVect& surfaces_face = domaine_VEF.face_surfaces();
52
53 int elem;
54 double dist=-1;
55 const RefObjU& modele_turbulence_hydr = eqn_hydr.get_modele(TURBULENCE);
56 const Modele_turbulence_hyd_base& le_modele = ref_cast(Modele_turbulence_hyd_base,modele_turbulence_hydr.valeur());
57 const Turbulence_paroi_base& loi = le_modele.loi_paroi();
58 const DoubleVect& tab_u_star = loi.tab_u_star();
59 const Equation_base& eqn = mon_modele_turb_scal->equation();
60
61 int schmidt = 0;
62 if (sub_type(Convection_Diffusion_Concentration,eqn)) schmidt = 1;
63 const Champ_Don_base& alpha = (schmidt==1?ref_cast(Convection_Diffusion_Concentration,eqn).constituant().diffusivite_constituant():le_fluide.diffusivite());
64 // Boucle sur les bords:
65 for (int n_bord=0; n_bord<domaine_VEF.nb_front_Cl(); n_bord++)
66 {
67 // pour chaque condition limite on regarde son type
68 // On applique les lois de paroi uniquement
69 // aux voisinages des parois
70 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
71 if ( (sub_type(Dirichlet_paroi_fixe,la_cl.valeur()))
72 || (sub_type(Dirichlet_paroi_defilante,la_cl.valeur())) )
73 {
74 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
75 int size=le_bord.nb_faces_tot();
76 for (int ind_face=0; ind_face<size; ind_face++)
77 {
78 int num_face = le_bord.num_face(ind_face);
79 // We search the element touching the wall on the face "num_face".
80 elem = face_voisins(num_face,0);
81 if (elem == -1)
82 elem = face_voisins(num_face,1);
83
84 // Calcul de la distance normale de la premiere maille
85 if (axi)
86 {
87 Cerr<<"Attention: the axisymmetric VEF case is not yet implemented"<<finl;
88 Cerr<<"in the thermal wall-function. trust will now stop."<<finl;
90 }
91 else
92 {
93 // distance to the wall of the center of gravity of the element.
94 dist = volumes_maille(elem)/surfaces_face(num_face);
95 }
96
97 double u_star = tab_u_star(num_face);
98 if (u_star == 0)
99 {
100 equivalent_distance_[n_bord](ind_face) = dist;
101 }
102 else
103 {
104 double d_alpha=0.;
105 if (sub_type(Champ_Uniforme,alpha))
106 d_alpha = alpha.valeurs()(0,0);
107 else
108 {
109 if (alpha.nb_comp()==1)
110 d_alpha = alpha.valeurs()(elem);
111 else
112 d_alpha = alpha.valeurs()(elem,0);
113 }
114
115 //Expression de d_eq formulee pour le cas nu_t imposee analytiquement
116 //Version qui suppose que nu_t et lambda_t on ete modifies pour les mailles pres de la paroi
117
118 double rap = alpha_t(elem)/d_alpha;
119 equivalent_distance_[n_bord](ind_face) = dist*(1.+((1.+rap)*log(1.+rap)-rap)/(rap+1.e-10));
120 /*
121 //Version qui consiste a ne pas modifier nu_t et lambda_t pres de la paroi
122 //rap *= 4./3.
123 //equivalent_distance_[n_bord](ind_face) = dist*(1.+((1.+rap)*log(1.+rap)-rap)/(rap+1.e-10));
124 //equivalent_distance_[n_bord](ind_face) *= (1.+(3./4.)*rap)/(1.+rap);
125 */
126
127 }
128
129 }
130 }
131 }
132 return 1;
133}
134
135
class Champ_Don_base base class of Given Fields (not calculated)
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
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
Convection_Diffusion_Concentration Special case of Convection_Diffusion_std.
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.
class Domaine_VEF
Definition Domaine_VEF.h:53
virtual const DoubleVect & face_surfaces() const
Definition Domaine_VF.h:51
double volumes(int i) const
Definition Domaine_VF.h:113
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 RefObjU & get_modele(Type_modele type) const
Probleme_base & probleme()
Returns the problem associated with the equation.
virtual int nb_comp() const
Definition Field_base.h:56
Base class for an incompressible fluid and its properties:
Definition Fluide_base.h:36
class Front_VF
Definition Front_VF.h:36
int nb_faces_tot() const
Definition Front_VF.h:58
int num_face(const int) const
Definition Front_VF.h:68
virtual const Champ_Don_base & diffusivite() const
Returns the diffusivity of the medium (const version).
Base class for the turbulence model hierarchy for Navier-Stokes equations.
const Turbulence_paroi_base & loi_paroi() const
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
int calculer_scal(Champ_Fonc_base &) override
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
const Objet_U & valeur() const
Definition TRUST_Ref.h:134
Base class for the hierarchy of wall-law models computing turbulent quantities near walls....
const DoubleVect & tab_u_star() const