TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Source_Dissipation_echelle_temp_taux_diss_turb.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 <Source_Dissipation_echelle_temp_taux_diss_turb.h>
17
18#include <Dissipation_type_helpers.h>
19#include <Milieu_composite.h>
20#include <Equation_base.h>
21#include <Pb_Multiphase.h>
22#include <Matrix_tools.h>
23#include <Array_tools.h>
24#include <Domaine_VF.h>
25
26Implemente_base(Source_Dissipation_echelle_temp_taux_diss_turb, "Source_Dissipation_echelle_temp_taux_diss_turb", Sources_Multiphase_base);
27// XD Source_Dissipation_echelle_temp_taux_diss_turb source_base Source_Dissipation_echelle_temp_taux_diss_turb NO_BRACE
28// XD_CONT Source term which corresponds to the dissipation source term that appears in the transport equation for tau
29// XD_CONT (in the k-tau turbulence model)
30
32{
33 return os;
34}
35
37{
38 Param param(que_suis_je());
39 param.ajouter("beta_omega", &beta_omega_);
40 param.lire_avec_accolades_depuis(is);
41 return is;
42}
43
44void Source_Dissipation_echelle_temp_taux_diss_turb::ajouter_blocs(matrices_t matrices, DoubleTab& secmem, const tabs_t& semi_impl) const
45{
46 const Domaine_VF& domaine = ref_cast(Domaine_VF, equation().domaine_dis());
47 const DoubleTab& diss = equation().inconnue().valeurs();
48 const DoubleTab& pdiss = equation().inconnue().passe();
49 const DoubleVect& pe = equation().milieu().porosite_elem(), &ve = domaine.volumes();
50
51 const int nb_elem = domaine.nb_elem();
52 const int N = diss.line_size();
53
54 const std::string Type_diss = get_dissipation_type(equation());
55 Matrice_Morse *Mdiss = matrices.count(Type_diss) ? matrices.at(Type_diss) : nullptr;
56
57 assert(N == 1);
58
59 for (int e = 0; e < nb_elem; e++)
60 for (int n = 0; n < N; n++)
61 {
62 const double peve = pe(e) * ve(e);
63
64 if (Type_diss == "tau")
65 {
66 // Source: beta_omega (constant source)
67 secmem(e, n) += peve * beta_omega_;
68 }
69 else if (Type_diss == "omega")
70 {
71 // Source: -beta_omega * omega^2 (linearized)
72 secmem(e, n) -=
73 peve * beta_omega_ * pdiss(e, n) * (pdiss(e, n) + 2 * (diss(e, n) - pdiss(e, n)));
74
75 // Jacobian w.r.t. omega: d/domega(-beta_omega * omega^2) = -2 * beta_omega * omega
76 if (Mdiss)
77 (*Mdiss)(N *e + n, N * e + n) += peve * beta_omega_ * 2 * pdiss(e, n);
78 }
79 }
80}
DoubleTab & passe(int i=1) override
Renvoie les valeurs du champs a l'instant t-i.
DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ au temps courant.
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
Classe Matrice_Morse Represente une matrice M (creuse), non necessairement carree.
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
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
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 de base des flux de sortie.
Definition Sortie.h:52
void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={}) const override
int line_size() const
Definition TRUSTVect.tpp:67