TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Force_Tchen_PolyMAC_MPFA.cpp
1/****************************************************************************
2* Copyright (c) 2026, 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 <Force_Tchen_PolyMAC_MPFA.h>
17#include <Champ_Face_base.h>
18#include <Pb_Multiphase.h>
19
20Implemente_instanciable(Force_Tchen_PolyMAC_MPFA, "Force_Tchen_Face_PolyMAC_MPFA|Tchen_force_Face_PolyMAC_MPFA", Source_Force_Tchen_base);
21
22Sortie& Force_Tchen_PolyMAC_MPFA::printOn(Sortie& os) const { return os; }
24
26{
27 const Domaine_VF& domaine = ref_cast(Domaine_VF, equation().domaine_dis());
28 const DoubleTab& inco = ref_cast(Champ_Face_base, equation().inconnue()).valeurs();
29 int N = inco.line_size(), D = dimension, nf_tot = domaine.nb_faces_tot();
30
31 /* elements */
32 for (int e = 0; e < domaine.nb_elem_tot(); e++)
33 for (int d = 0 ; d <D ; d++)
34 for (int k = 0 ; k<N ; k++)
35 if (k != n_l) //phase gazeuse
36 stencil.append_line( N *(nf_tot + D * e + d) + k , N *(nf_tot + D * e + d) + n_l) ;
37}
38
39void Force_Tchen_PolyMAC_MPFA::ajouter_blocs_aux(matrices_t matrices, DoubleTab& secmem) const
40{
41 const Champ_Face_base& ch = ref_cast(Champ_Face_base, equation().inconnue());
42 Matrice_Morse *mat = matrices.count(ch.le_nom().getString()) ? matrices.at(ch.le_nom().getString()) : nullptr;
43 const Domaine_VF& domaine = ref_cast(Domaine_VF, equation().domaine_dis());
44 const DoubleTab& inco = ch.valeurs(), &pvit = ch.passe(), &alpha = ref_cast(Pb_Multiphase, equation().probleme()).equation_masse().inconnue().passe(),
45 &rho = equation().milieu().masse_volumique().passe();
46
47 double pas_tps = equation().probleme().schema_temps().pas_de_temps();
48 int N = inco.line_size(), D = dimension, nf_tot = domaine.nb_faces_tot();
49 const DoubleVect& pe = equation().milieu().porosite_elem(), &ve = domaine.volumes();
50
51 /* elements */
52 for (int e = 0; e < domaine.nb_elem_tot(); e++)
53 for (int d = 0 ; d <D ; d++)
54 for (int k = 0 ; k<N ; k++)
55 if (k != n_l) //phase gazeuse
56 {
57 double fac = pe(e) * ve(e) * alpha(e, k) * rho(e, n_l) ;
58
59 secmem(nf_tot + D * e + d, k ) += fac * (inco(nf_tot + D * e + d, n_l)-pvit(nf_tot + D * e + d, n_l))/pas_tps;
60 secmem(nf_tot + D * e + d,n_l) -= fac * (inco(nf_tot + D * e + d, n_l)-pvit(nf_tot + D * e + d, n_l))/pas_tps;
61 if (mat)
62 {
63 (*mat)( N *(nf_tot + D * e + d) + k , N *(nf_tot + D * e + d) + n_l) -= fac/pas_tps ;
64 (*mat)( N *(nf_tot + D * e + d) + n_l, N *(nf_tot + D * e + d) + n_l) += fac/pas_tps ;
65 }
66 }
67}
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.
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
Probleme_base & probleme()
Renvoie le probleme associe a l'equation.
const Nom & le_nom() const override
Renvoie le nom du champ.
void dimensionner_blocs_aux(Stencil &) const override
void ajouter_blocs_aux(matrices_t, DoubleTab &) const override
Classe Matrice_Morse Represente une matrice M (creuse), non necessairement carree.
DoubleVect & porosite_elem()
Definition Milieu_base.h:58
virtual const Champ_base & masse_volumique() const
Renvoie la masse volumique du milieu.
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
const std::string & getString() const
Definition Nom.h:92
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 Schema_Temps_base & schema_temps() const
Renvoie le schema en temps associe au probleme.
double pas_de_temps() const
Renvoie le pas de temps (delta_t) courant.
Classe de base des flux de sortie.
Definition Sortie.h:52
classe Force_Tchen Force de Tchen dans un ecoulement multiphase
void append_line(_TYPE_)
Definition TRUSTTab.tpp:213
int line_size() const
Definition TRUSTVect.tpp:67