TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Op_NConserv_HLL_Coloc_Elem.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 <Op_NConserv_HLL_Coloc_Elem.h>
17#include <Interface_Baer_Nunziato.h>
18#include <Conservation_Euler_base.h>
19#include <Milieu_composite_Euler.h>
20#include <Neumann_paroi_flux_nul.h>
21#include <Coloc_Operator_tools.h>
22#include <Entree_supersonique.h>
23#include <Sortie_supersonique.h>
24#include <Champ_Inc_P0_base.h>
25#include <Fluide_reel_base.h>
26#include <Domaine_Cl_Coloc.h>
27#include <Momentum_Euler.h>
28#include <Domaine_Coloc.h>
29#include <Pb_Euler.h>
30
31Implemente_instanciable(Op_NConserv_HLL_Coloc_Elem, "Op_NConserv_HLL_Coloc_Elem", Op_NConserv_Coloc_base);
32
35
36void Op_NConserv_HLL_Coloc_Elem::ajouter_blocs(matrices_t matrices, DoubleTab& secmem, const tabs_t& semi_impl) const
37{
38 const Domaine_Coloc& domaine = ref_cast(Domaine_Coloc, le_dom_coloc_.valeur());
39 const DoubleVect& fs = domaine.face_surfaces();
40 const IntTab& f_e = domaine.face_voisins();
41 assert(secmem.line_size() == 2);
42 const int nb_faces = domaine.nb_faces();
43 DoubleTrav num_flux_left(nb_faces), num_flux_right(nb_faces);
44
45 Abgral_scheme(num_flux_left, num_flux_right);
46
47 for (int f = 0; f < nb_faces; f++)
48 for (int i = 0; i < 2; i++)
49 {
50 int e = f_e(f, i);
51 if (e >= 0 && e < domaine.nb_elem())
52 {
53 secmem(e, 0) -= (i ? num_flux_right(f) : num_flux_left(f)) * fs(f);
54 secmem(e, 1) += (i ? num_flux_right(f) : num_flux_left(f)) * fs(f);
55 }
56 }
57}
58
59void Op_NConserv_HLL_Coloc_Elem::Abgral_scheme(DoubleTab& num_flux_left, DoubleTab& num_flux_right) const
60{
61 const Domaine_Coloc& domaine = ref_cast(Domaine_Coloc, le_dom_coloc_.valeur());
62 const IntTab& f_e = domaine.face_voisins();
63 const IntTab& fcl = ref_cast(Champ_Inc_P0_base, equation().inconnue()).fcl();
64
65 const Pb_Euler& pb = ref_cast(Pb_Euler, equation().probleme());
67
68 const Interface_Baer_Nunziato& interface = ref_cast(Interface_Baer_Nunziato, ref_cast(Milieu_composite_Euler,pb.milieu()).interface_phase());
69 const int n = interface.id_phase_vitesse_inter();
70 const int m = interface.id_phase_pression_inter();
71 const int nb_phases = pb.nb_phases();
72
73 const DoubleTab& alpha = pb.equation_fraction().inconnue().valeurs();
74 const DoubleTab& vit_n = pb.equation_qdm().vitesse_normale();
75 const DoubleTab& p = pb.equation_qdm().pression().valeurs();
76 const DoubleTab& c = pb.equation_qdm().vitesse_son();
77
80
81 // faces internes
82 if (sub_type(Fraction_Euler, equation()))
83 {
84 for (int f = 0; f < domaine.nb_faces(); f++)
85 if (fcl(f, 0) == 0)
86 {
87 const int el = f_e(f, 0), er = f_e(f, 1);
88 double Sm = 0., Sp = 0., un_l = 0.;
89 compute_non_conservative_hll_left_bounds(vit_n, c, f, el, er, m, n, nb_phases, Sm, Sp, un_l);
90
91 num_flux_left(f) = (Sp * alpha(el, 0) - Sm * alpha(er, 0)) * un_l + Sp * Sm * (alpha(er, 0) - alpha(el, 0));
92 num_flux_left(f) /= (Sp - Sm);
93
94 compute_non_conservative_hll_right_bounds(vit_n, c, f, el, er, m, n, nb_phases, Sm, Sp, un_l);
95
96 num_flux_right(f) = (Sp * alpha(er, 0) - Sm * alpha(el, 0)) * un_l + Sp * Sm * (alpha(el, 0) - alpha(er, 0));
97 num_flux_right(f) /= (Sp - Sm);
98 }
99 }
100 else if (sub_type(Energy_Euler, equation()))
101 {
102 for (int f = 0; f < domaine.nb_faces(); f++)
103 if (fcl(f, 0) == 0)
104 {
105 const int el = f_e(f, 0), er = f_e(f, 1);
106 double Sm = 0., Sp = 0., un_l = 0.;
107 compute_non_conservative_hll_left_bounds(vit_n, c, f, el, er, m, n, nb_phases, Sm, Sp, un_l);
108
109 num_flux_left(f) = (Sp * alpha(el, 0) - Sm * alpha(er, 0)) * un_l * p(el, m);
110 num_flux_left(f) /= -(Sp - Sm);
111
112 compute_non_conservative_hll_right_bounds(vit_n, c, f, el, er, m, n, nb_phases, Sm, Sp, un_l);
113
114 num_flux_right(f) = (Sp * alpha(er, 0) - Sm * alpha(el, 0)) * un_l * p(er, m);
115 num_flux_right(f) /= -(Sp - Sm);
116 }
117 }
118 else
119 {
120 Cerr << "Op_NConserv_HLL_Coloc_Elem should not be used for equation " << equation().que_suis_je() << finl;
122 }
123
124 // faces bords
125 flux_bords_.resize(domaine.nb_faces_bord(), 1);
126 flux_bords_ = 0.;
127
128 for (int f = 0; f < domaine.nb_faces(); f++)
129 if (fcl(f, 0) != 0)
130 {
131 assert(f_e(f, 1) < 0 && f_e(f, 0) >= 0 && vit_n(f, 0) != -123.123); // domaine_poly_base ...
132 const int e = f_e(f, 0);
133
134 if (sub_type(Sortie_supersonique, cls[fcl(f, 1)].valeur()))
135 {
136 num_flux_left(f) = eq.termes_NonConservatif(alpha(e, 0), vit_n(f, n), p(e, m));
137 flux_bords_(f, 0) = num_flux_left(f) * domaine.face_surfaces(f);
138 }
139 else if (sub_type(Entree_supersonique, cls[fcl(f, 1)].valeur())) // Dirichlet : 6
140 {
141 const double alpha_bord = ref_cast(Dirichlet, cls_alpha[fcl(f, 1)].valeur()).val_imp(fcl(f, 2), 0);
142 num_flux_left(f) = eq.termes_NonConservatif(alpha_bord, vit_n(f, n), p(e, m));
143 flux_bords_(f, 0) = num_flux_left(f) * domaine.face_surfaces(f);
144 }
145 else if (sub_type(Neumann_paroi_flux_nul, cls[fcl(f, 1)].valeur())) //Neumann_homogene : 5
146 {
147 num_flux_left(f) = eq.termes_NonConservatif(alpha(e, 0), vit_n(f, n), p(e, m));
148 flux_bords_(f, 0) = num_flux_left(f) * domaine.face_surfaces(f);
149 }
150 else
151 {
152 Cerr << "The BC of type " << fcl(f, 0) << " for the equation " << eq.que_suis_je() << " is not available \n";
154 }
155 }
156}
: class Champ_Inc_P0_base
classe Conds_lim Cette classe represente un vecteur de conditions aux limites.
Definition Conds_lim.h:32
virtual double termes_NonConservatif(const double alpha_bord, const double vitesse_n_inter, const double p_bord) const
classe Dirichlet Cette classe est la classe de base de la hierarchie des conditions aux limites de ty...
Definition Dirichlet.h:31
const Cond_lim & les_conditions_limites(int) const
Renvoie la i-ieme condition aux limites.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Renvoie le domaine des conditions aux limite discretisee associee a l'equation.
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
Classe Neumann_paroi_flux_nul Cette condition limite flux nul a la frontiere.
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
void Abgral_scheme(DoubleTab &, DoubleTab &) const override
void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={}) const override
DoubleTab flux_bords_
int nb_phases() const
Definition Pb_Euler.h:51
Fraction_Euler & equation_fraction()
Definition Pb_Euler.h:48
Momentum_Euler & equation_qdm()
Definition Pb_Euler.h:42
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52
int line_size() const
Definition TRUSTVect.tpp:67