TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Masse_PolyMAC_HFV_Face.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 <Linear_algebra_tools_impl.h>
17#include <Op_Grad_PolyMAC_HFV_Face.h>
18#include <Masse_ajoutee_base.h>
19#include <Masse_PolyMAC_HFV_Face.h>
20#include <Dirichlet_homogene.h>
21#include <Champ_Face_PolyMAC_HFV.h>
22#include <Schema_Temps_base.h>
23#include <Domaine_Cl_PolyMAC_family.h>
24#include <Champ_Uniforme.h>
25#include <Equation_base.h>
26#include <Pb_Multiphase.h>
27#include <Domaine_PolyMAC_HFV.h>
28#include <Matrix_tools.h>
29#include <Array_tools.h>
30#include <Matrice33.h>
31#include <Dirichlet.h>
32#include <Symetrie.h>
33#include <Vecteur3.h>
34#include <Debog.h>
35#include <Piso.h>
36
37Implemente_instanciable(Masse_PolyMAC_HFV_Face, "Masse_PolyMAC_HFV_Face", Masse_PolyMAC_HFV_base);
38
39Sortie& Masse_PolyMAC_HFV_Face::printOn(Sortie& s) const { return s << que_suis_je() << " " << le_nom(); }
40
42
44{
45 Solveur_Masse_Face_proto::associer_masse_proto(*this,le_dom_PolyMAC_CDO.valeur());
46}
47
48// XXX : a voir si on peut utiliser Solveur_Masse_Face_proto::appliquer_impl_proto ...
49DoubleTab& Masse_PolyMAC_HFV_Face::appliquer_impl(DoubleTab& sm) const
50{
51 const Domaine_PolyMAC_CDO& domaine = le_dom_PolyMAC_CDO.valeur();
52 const IntTab& f_e = domaine.face_voisins();
53 const DoubleVect& pf = equation().milieu().porosite_face();
54 int i, e, f, n, N = equation().inconnue().valeurs().line_size();
55 const DoubleTab *a_r = sub_type(QDM_Multiphase, equation()) ? &ref_cast(Pb_Multiphase, equation().probleme()).equation_masse().champ_conserve().passe() : nullptr,
56 &vfd = domaine.volumes_entrelaces_dir();
57 double fac;
58
59 //vitesses aux faces
60 for (f = 0; f < domaine.nb_faces(); f++)
61 for (n = 0; n < N; n++)
62 {
63 for (fac = 0, i = 0; i < 2 && (e = f_e(f, i)) >= 0; i++) fac += vfd(f, i) * (a_r ? (*a_r)(e, n) : 1);
64 sm(f, n) /= pf(f) * fac; //vitesse calculee
65 }
66
68 return sm;
69}
70
71void Masse_PolyMAC_HFV_Face::dimensionner_blocs(matrices_t matrices, const tabs_t& semi_impl) const
72{
73 Stencil sten(0, 2);
74
75 Solveur_Masse_Face_proto::dimensionner_blocs_proto(matrices, semi_impl, true /* allocate too */, sten);
76}
77
78void Masse_PolyMAC_HFV_Face::ajouter_blocs(matrices_t matrices, DoubleTab& secmem, double dt, const tabs_t& semi_impl, int resoudre_en_increments) const
79{
80 Solveur_Masse_Face_proto::ajouter_blocs_proto( matrices, secmem, dt,semi_impl, resoudre_en_increments);
81}
82
83//sert a imposer les CLs de Dirichlet en multiphase (ou la variation de P_bord ne permet de corriger que v_melange)
84DoubleTab& Masse_PolyMAC_HFV_Face::corriger_solution(DoubleTab& x, const DoubleTab& y, int incr) const
85{
86 const Domaine_PolyMAC_CDO& domaine = le_dom_PolyMAC_CDO.valeur();
87 const Conds_lim& cls = le_dom_Cl_PolyMAC_CDO->les_conditions_limites();
88 const IntTab& fcl = ref_cast(Champ_Face_PolyMAC_HFV, equation().inconnue()).fcl();
89 const DoubleTab& nf = domaine.face_normales(), &vit = equation().inconnue().valeurs();
90 const DoubleVect& fs = domaine.face_surfaces();
91 int f, n, N = x.line_size(), d, D = dimension;
92
93 for (f = 0; f < domaine.nb_faces_tot(); f++)
94 if (fcl(f, 0) == 2 || fcl(f, 0) == 4)
95 for (n = 0; n < N; n++) x(f, n) = incr ? -vit(f, n) : 0; //Dirichlet homogene / Symetrie: on revient a 0
96 else if (fcl(f, 0) == 3)
97 for (n = 0; n < N; n++)
98 for (x(f, n) = incr ? -vit(f, n) : 0, d = 0; d < D; d++) //Dirichlet : valeur de la CL
99 x(f, n) += nf(f, d) / fs(f) * ref_cast(Dirichlet, cls[fcl(f, 1)].valeur()).val_imp(fcl(f, 2), N * d + n);
100
101 return x;
102}
: class Champ_Face_PolyMAC_HFV
DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ au temps courant.
classe Conds_lim Cette classe represente un vecteur de conditions aux limites.
Definition Conds_lim.h:32
classe Dirichlet Cette classe est la classe de base de la hierarchie des conditions aux limites de ty...
Definition Dirichlet.h:31
int face_voisins(int num_face, int i) const
renvoie l'element voisin de numface dans la direction i.
Definition Domaine_VF.h:418
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
void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, double dt, const tabs_t &semi_impl, int resoudre_en_increments) const override
DoubleTab & appliquer_impl(DoubleTab &) const override
void dimensionner_blocs(matrices_t matrices, const tabs_t &semi_impl) const override
virtual DoubleTab & corriger_solution(DoubleTab &x, const DoubleTab &y, int incr=0) const override
DoubleVect & porosite_face()
Definition Milieu_base.h:62
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
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 const Nom & le_nom() const
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
Definition Objet_U.cpp:319
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...
classe QDM_Multiphase Cette classe porte les termes de l'equation de la dynamique
void associer_masse_proto(const Solveur_Masse_base &, const Domaine_VF &)
void ajouter_blocs_proto(matrices_t matrices, DoubleTab &secmem, double dt, const tabs_t &semi_impl, int resoudre_en_increments) const
void dimensionner_blocs_proto(matrices_t matrices, const tabs_t &semi_impl, const bool allocate, Stencil &) const
Classe de base des flux de sortie.
Definition Sortie.h:52
int line_size() const
Definition TRUSTVect.tpp:67
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")