TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Cond_lim_k_complique_transition_flux_nul_demi.cpp
1/****************************************************************************
2* Copyright (c) 2022, 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 <Cond_lim_k_complique_transition_flux_nul_demi.h>
17#include <Energie_cinetique_turbulente.h>
18#include <Op_Dift_Multiphase_VDF_Elem.h>
19#include <Viscosite_turbulente_base.h>
20#include <Transport_turbulent_base.h>
21#include <Op_Diff_PolyMAC_MPFA_base.h>
22#include <Loi_paroi_adaptative.h>
23#include <Convection_diffusion_turbulence_multiphase.h>
24#include <Champ_Face_base.h>
25#include <Probleme_base.h>
26#include <Domaine_VF.h>
27
28Implemente_instanciable(Cond_lim_k_complique_transition_flux_nul_demi,"Cond_lim_k_complique_transition_flux_nul_demi",Echange_global_impose_turbulent);
29// XD Cond_lim_k_complique_transition_flux_nul_demi condlim_base Cond_lim_k_complique_transition_flux_nul_demi NO_BRACE
30// XD_CONT Adaptive wall law boundary condition for turbulent kinetic energy
31
33
35
37{
38 if (!sub_type(Energie_cinetique_turbulente, domaine_Cl_dis().equation()))
39 Process::exit("Cond_lim_k_simple : equation must be k !");
40
41 if (domaine_Cl_dis().equation().inconnue().valeurs().line_size() != 1)
42 Process::exit("Cond_lim_k_simple : Only one phase for turbulent wall law is coded for now");
43}
44
46{
47 Loi_paroi_adaptative& corr_loi_paroi = ref_cast(Loi_paroi_adaptative, correlation_loi_paroi_.valeur());
48 const Domaine_VF& domaine = ref_cast(Domaine_VF, domaine_Cl_dis().equation().domaine_dis());
49 const DoubleTab& yp = corr_loi_paroi.get_tab("y_plus");
50 const DoubleTab& u_tau = corr_loi_paroi.get_tab("u_tau");
51
53
54 const DoubleTab& nu_visc = equa.diffusivite_pour_pas_de_temps().passe();
55 const DoubleTab& mu_visc = equa.diffusivite_pour_transport().passe();
56
57 const int cnu = nu_visc.dimension(0) == 1;
58 const int cmu = mu_visc.dimension(0) == 1;
59
60 // On va chercher le mu turbulent de PolyMAC et celui de vdf et on prend le bon dans la suite
61 const DoubleTab *mu_poly = domaine.que_suis_je().debute_par("Domaine_PolyMAC")
62 ? &ref_cast(Op_Diff_PolyMAC_MPFA_base,
63 domaine_Cl_dis().equation().operateur(0).l_op_base())
64 .nu()
65 : nullptr;
66 const DoubleTab *mu_vdf = domaine.que_suis_je().debute_par("Domaine_VDF")
68 domaine_Cl_dis().equation().operateur(0).l_op_base())
69 .get_diffusivite_turbulente()
70 : nullptr;
71 assert((mu_poly) || (mu_vdf));
72
73 const int nf = la_frontiere_dis->frontiere().nb_faces();
74 const int f1 = la_frontiere_dis->frontiere().num_premiere_face();
75 const IntTab& f_e = domaine.face_voisins();
76
77 int n = 0 ; // Carrying phase is 0 for turbulent flows
78
79 for (int f = 0; f < nf; f++)
80 {
81 const int f_domaine = f + f1; // number of the face in the domaine
82 const int e_domaine = (f_e(f_domaine,0)>=0) ? f_e(f_domaine,0) : f_e(f_domaine,1) ; // Make orientation vdf-proof
83 const double y_loc = f_e(f_domaine,0)>=0 ? domaine.dist_face_elem0(f_domaine,e_domaine) : domaine.dist_face_elem1(f_domaine,e_domaine) ;
84 const double mu_tot_loc = (mu_poly) ? (*mu_poly)(e_domaine,n) : (mu_vdf) ? (*mu_vdf)(e_domaine,n) + mu_visc(!cmu * e_domaine,n) : -1;
85
86 const double tmp = yp(f_domaine, 0)/50.;
87 const double fac = 1.0/y_loc * (1 - std::tanh(tmp*tmp*tmp));
88 h_(f, 0) = 2.*mu_tot_loc * fac;
89 h_grad_(f, 0) = 2.0*fac;
90 T_(f, 0) = calc_k(y_loc/2., u_tau(f_domaine, 0), nu_visc(!cnu * e_domaine, 0));
91 }
92
93 h_.echange_espace_virtuel();
94 h_grad_.echange_espace_virtuel();
95 T_.echange_espace_virtuel();
96}
97
99 const double u_tau,
100 const double visc) const
101{
102 const double y_p = y * u_tau / visc;
103 const double f1 = (y_p - 1)*(y_p - 1)*(y_p - 1)/30;
104 const double tmp = std::abs(4.6 - std::log(y_p));
105 const double f2 = 1.0/std::sqrt(beta_k_) - 0.08*tmp*tmp*tmp;
106 const double b1 = std::tanh(std::pow(y_p/4., 10));
107 const double b2 = std::tanh(std::pow(y_p/2500., 1.4));
108 const double f3 = 1.0/std::sqrt(beta_k_)*0.25;
109
110 return u_tau*u_tau*(std::max((1.0 - b1)*f1 + b1*f2, 0.0)*(1.0 - b2) + b2*f3);
111}
virtual DoubleTab & passe(int i=1)
Definition Champ_Proto.h:50
Domaine_Cl_dis_base & domaine_Cl_dis()
Renvoie le domaine des conditions aux limites discretisee dont l'objet fait partie.
Classe Cond_lim_k_complique_transition_flux_nul_demi:
double calc_k(const double y, const double u_tau, const double visc) const
void completer() override
NE FAIT RIEN A surcharger dans les classes derivees.
virtual const Champ_Don_base & diffusivite_pour_transport() const
virtual const Champ_base & diffusivite_pour_pas_de_temps() const
classe Convection_diffusion_turbulence_multiphase Equation de transport des quantites turbulentes (k,...
class Domaine_VF
Definition Domaine_VF.h:44
Classe Echange_global_impose_turbulent.
classe Energie_cinetique_turbulente Equation de transport d'une energie cinetique turbulente (modeles...
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Loi_paroi_adaptative correlation pour une loi de paroi adaptative qui calcule u_tau et du y_pl...
DoubleTab & get_tab(std::string str)
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
class Op_Diff_PolyMAC_MPFA_base
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
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133