TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Production_echelle_temp_taux_diss_turb_PolyMAC_MPFA.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 <Production_echelle_temp_taux_diss_turb_PolyMAC_MPFA.h>
17
18#include <Dissipation_type_helpers.h>
19#include <grad_Champ_Face_PolyMAC_MPFA.h>
20#include <Champ_Elem_PolyMAC_MPFA.h>
21#include <Navier_Stokes_std.h>
22#include <Pb_Multiphase.h>
23#include <Domaine_VF.h>
24
25Implemente_instanciable(Production_echelle_temp_taux_diss_turb_PolyMAC_MPFA,"Production_echelle_temp_taux_diss_turb_Elem_PolyMAC_MPFA", Source_Production_echelle_temp_taux_diss_turb);
26
29
30void Production_echelle_temp_taux_diss_turb_PolyMAC_MPFA::ajouter_blocs(matrices_t matrices, DoubleTab& secmem, const tabs_t& semi_impl) const
31{
32 const Domaine_VF& domaine = ref_cast(Domaine_PolyMAC_MPFA, equation().domaine_dis());
33 const DoubleTab& tab_diss = ref_cast(Champ_Elem_PolyMAC_MPFA, equation().inconnue()).valeurs(); // tau ou omega selon l'equation
34 const DoubleTab& tab_pdiss = ref_cast(Champ_Elem_PolyMAC_MPFA, equation().inconnue()).passe(); // tau ou omega selon l'equation
35 const DoubleTab& tab_grad = equation().probleme().get_champ("gradient_vitesse").passe();
36 const DoubleTab* alp = sub_type(Pb_Multiphase,equation().probleme()) ? &equation().probleme().get_champ("alpha").valeurs() : nullptr;
37 const DoubleVect& pe = equation().milieu().porosite_elem();
38 const DoubleVect& ve = domaine.volumes();
39
40 const int nf_tot = domaine.nb_faces_tot();
41 const int ne = domaine.nb_elem();
42 const int D = dimension ;
43 const int N = equation().inconnue().valeurs().line_size();
44 const int Na = sub_type(Pb_Multiphase,equation().probleme()) ? equation().probleme().get_champ("alpha").valeurs().line_size() : 1;
45
46 const std::string Type_diss = get_dissipation_type(equation());
47
48 // Second membre
49 for (int e = 0 ; e < ne ; e++)
50 for (int n = 0; n < N ; n++)
51 {
52 double grad_grad {0.0};
53 for (int d_U = 0; d_U < D; d_U++)
54 for (int d_X = 0; d_X < D; d_X++)
55 grad_grad += ( tab_grad(nf_tot + d_U + e * D , D * n + d_X) + tab_grad(nf_tot + d_X + e * D , D * n + d_U) ) * tab_grad(nf_tot + d_X + e * D , D * n + d_U) ;
56
57 const double fac = std::max(grad_grad, 0.) * pe(e) * ve(e) * alpha_omega_ ;
58
59 if (Type_diss == "tau")
60 {
61 secmem(e, n) -= fac * (2*tab_diss(e, n) - tab_pdiss(e, n)) * tab_pdiss(e, n) * (alp ? (*alp)(e,n) : 1.0); // tau has negative production
62
63 for (auto &&i_m : matrices)
64 {
65 if (i_m.first == "tau")
66 (*i_m.second)(N*e+n, N*e+n) += fac * 2 * tab_pdiss(e, n) * (alp ? (*alp)(e,n) : 1.0) ;
67 if (i_m.first == "alpha")
68 (*i_m.second)(N*e+n, Na*e+n) += fac * (2*tab_diss(e, n) - tab_pdiss(e, n)) * tab_pdiss(e, n);
69 }
70 }
71 else if (Type_diss == "omega")
72 {
73 secmem(e, n) += fac * (alp ? (*alp)(e,n) : 1.0);
74 for (auto &&i_m : matrices)
75 if (i_m.first == "alpha")
76 (*i_m.second)(N*e+n, Na*e+n) += fac;
77 }
78 }
79}
: class Champ_Elem_PolyMAC_MPFA
DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ au temps courant.
virtual DoubleTab & valeurs()=0
virtual DoubleTab & passe(int i=1)
Definition Champ_Proto.h:50
class Domaine_VF
Definition Domaine_VF.h:44
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
virtual const Champ_Inc_base & inconnue() const =0
Probleme_base & probleme()
Renvoie le probleme associe a l'equation.
DoubleVect & porosite_elem()
Definition Milieu_base.h:58
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
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
classe Pb_Multiphase Cette classe represente un probleme de thermohydraulique multiphase de type "3*N...
const Champ_base & get_champ(const Motcle &nom) const override
Classe Production_echelle_temp_taux_diss_turb_PolyMAC_MPFA Cette classe implemente dans PolyMAC_MPFA ...
void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={}) const override
Classe de base des flux de sortie.
Definition Sortie.h:52
Classe Source_Production_echelle_temp_taux_diss_turb Classe de base pour un operateur de production d...
int line_size() const
Definition TRUSTVect.tpp:67