TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Diffusion_supplementaire_echelle_temp_turb_VDF.cpp
1/****************************************************************************
2* Copyright (c) 2021, 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 <Diffusion_supplementaire_echelle_temp_turb_VDF.h>
17
18#include <Echelle_temporelle_turbulente.h>
19#include <face_to_elem_VDF.h>
20#include <Op_Dift_Multiphase_VDF_Elem.h>
21#include <Convection_Diffusion_std.h>
22#include <Champ_Inc_P0_base.h>
23#include <Domaine_Cl_VDF.h>
24#include <Pb_Multiphase.h>
25#include <Domaine_VDF.h>
26#include <Dirichlet.h>
27
28#include <cmath>
29#include <vector>
30
31Implemente_instanciable(Diffusion_supplementaire_echelle_temp_turb_VDF,"Diffusion_supplementaire_lin_echelle_temp_turb_VDF_P0_VDF|Diffusion_supplementaire_echelle_temp_turb_VDF_P0_VDF", Source_Diffusion_supplementaire_echelle_temp_turb);
32
34
36
37void Diffusion_supplementaire_echelle_temp_turb_VDF::ajouter_blocs(matrices_t matrices, DoubleTab& secmem, const tabs_t& semi_impl) const
38{
39 const Domaine_VDF& domaine = ref_cast(Domaine_VDF, equation().domaine_dis());
40 const Domaine_Cl_VDF& zcl = ref_cast(Domaine_Cl_VDF, equation().domaine_Cl_dis());
41 const Champ_Inc_P0_base& tau = ref_cast(Champ_Inc_P0_base, equation().inconnue());
42 const DoubleTab& tab_tau = semi_impl.count("tau") ? semi_impl.at("tau") : tau.passe();
43 const DoubleTab& nu_turb = ref_cast(Op_Dift_Multiphase_VDF_Elem, equation().operateur(0).l_op_base()).get_diffusivite_turbulente();
44 const DoubleTab& nu_visc = ref_cast(Convection_Diffusion_std, equation()).diffusivite_pour_transport().passe();
45
46 const DoubleTab& xp = domaine.xp();
47 const DoubleTab& xv = domaine.xv();
48
49 const DoubleVect& pe = equation().milieu().porosite_elem();
50 const DoubleVect& ve = domaine.volumes();
51
52 const int N = tab_tau.dimension(1);
53 const int ne = domaine.nb_elem();
54 const int ne_tot = domaine.nb_elem_tot();
55 const int nf_tot = domaine.nb_faces_tot();
56 const int D = dimension;
57
58 /* Calcul de grad de racine de tau aux faces */
59 DoubleTrav grad_f_sqrt_tau(nf_tot, N);
60 DoubleTrav sqrt_tau(ne_tot, N);
61 for (int e = 0; e < ne_tot ; e++)
62 for (int n = 0; n < N; n++)
63 sqrt_tau(e,n) = std::sqrt(std::max(0., tab_tau(e,n)));
64
65 assert (tab_tau.dimension_tot(0) == ne_tot);
67 const Operateur_Grad& Op_Grad_tau = eq_tau.operateur_gradient_inconnue();
68 // compute grad(sqrt(tau)) at faces ; Les CL sont des Dirichlet nulles, des symetries ou des Dirichlet non nulles => on devra corriger les dirichlet non nulles
69 Op_Grad_tau.calculer(sqrt_tau,grad_f_sqrt_tau);
70
71 // Boucle sur les bords pour corriger la contribution des cl de dirichlet non nulles au gradient
72 for (int n_bord = 0; n_bord < domaine.nb_front_Cl(); n_bord++)
73 for (int k = 0; k < N; k++)
74 {
75 const Cond_lim& la_cl = zcl.les_conditions_limites(n_bord);
76 const Front_VF& le_bord = ref_cast(Front_VF, la_cl->frontiere_dis());
77 const int ndeb = le_bord.num_premiere_face();
78 const int nfin = ndeb + le_bord.nb_faces();
79
80 if (sub_type(Dirichlet, la_cl.valeur())) // Cas CL Dirichlet
81 for (int num_face = ndeb, num_face_cl = 0; num_face < nfin; num_face++, num_face_cl++)
82 {
83 int n0 = domaine.face_voisins(num_face, 0);
84 if (n0 < 0)
85 n0 = domaine.face_voisins(num_face, 1);
86 const int ori = domaine.orientation(num_face);
87 const double val = ref_cast(Dirichlet, la_cl.valeur()).val_imp(num_face_cl, k);
88 grad_f_sqrt_tau(num_face, k) += - val/(xp(n0, ori) - xv(num_face, ori));
89 grad_f_sqrt_tau(num_face, k) -= - std::sqrt(val)/(xp(n0, ori) - xv(num_face, ori));
90 }
91 }
92
93 /* On interpole les champs aux elements */
94 DoubleTab grad_e_sqrt_tau(ne_tot, N, D);
95 face_to_elem_VDF(domaine, grad_f_sqrt_tau, grad_e_sqrt_tau);
96
97 // On remplit le second membre
98 for(int e = 0; e < ne; e++)
99 for (int n = 0; n < N; n++)
100 {
101 // Second membre
102 const double fac = pe(e)*ve(e);
103 double secmem_en = 0;
104
105 for (int d = 0; d < D; d++)
106 secmem_en += grad_e_sqrt_tau(e, n, d) * grad_e_sqrt_tau(e, n, d);
107
108 secmem(e, n) += fac * -8 * (nu_visc(e, n) + nu_turb(e, n)) * secmem_en;
109 }
110}
: class Champ_Inc_P0_base
DoubleTab & passe(int i=1) override
Returns field values at instant t-i.
class Cond_lim Generic class used to represent any class
Definition Cond_lim.h:31
Convection_Diffusion_std This class is the base for equations modelling the transport.
classe Convection_diffusion_turbulence_multiphase Equation de transport des quantites turbulentes (k,...
Classe Diffusion_supplementaire_echelle_temp_turb_VDF.
void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={}) const override
Dirichlet This class is the base class of the hierarchy of Dirichlet-type boundary conditions.
Definition Dirichlet.h:31
class Domaine_Cl_VDF
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
class Domaine_VDF
Definition Domaine_VDF.h:61
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual const Milieu_base & milieu() const =0
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
DoubleVect & porosite_elem()
Definition Milieu_base.h:58
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
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
Classe Operateur_Grad Generic class of the hierarchy of operators computing the gradient.
DoubleTab & calculer(const DoubleTab &, DoubleTab &) const override
Initializes the array passed as parameter with the contribution of the operator.
Base class for output streams.
Definition Sortie.h:52
Classe Source_Diffusion_supplementaire_echelle_temp_turb Cette classe implemente la diffusion supplem...
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133