TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Masse_ajoutee_Wijngaarden.cpp
1/****************************************************************************
2* Copyright (c) 2025, 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 <Masse_ajoutee_Wijngaarden.h>
17#include <Pb_Multiphase.h>
18
19Implemente_instanciable(Masse_ajoutee_Wijngaarden, "Masse_ajoutee_Wijngaarden", Masse_ajoutee_base);
20
22{
23 return os;
24}
25
27{
28 Param param(que_suis_je());
29 param.ajouter("beta", &beta);
30 param.ajouter("inj_ajoutee_liquide", &inj_ajoutee_liquide_);
31 param.ajouter("inj_ajoutee_gaz", &inj_ajoutee_gaz_);
32 param.ajouter("limiter_liquid", &limiter_liquid_);
33 param.lire_avec_accolades_depuis(is);
34
35 const Pb_Multiphase *pbm = sub_type(Pb_Multiphase, pb_.valeur()) ? &ref_cast(Pb_Multiphase, pb_.valeur()) : nullptr;
36
37 if (!pbm || pbm->nb_phases() == 1) Process::exit(que_suis_je() + " : not needed for single-phase flow!");
38 for (int n = 0; n < pbm->nb_phases(); n++) //recherche de n_l, n_g : phase {liquide,gaz}_continu en priorite
39 if (pbm->nom_phase(n).debute_par("liquide") && (n_l < 0 || pbm->nom_phase(n).finit_par("continu"))) n_l = n;
40
41 if (n_l < 0) Process::exit(que_suis_je() + " : liquid phase not found!");
42
43 return is;
44}
45
46void Masse_ajoutee_Wijngaarden::ajouter(const double *alpha, const double *rho, DoubleTab& a_r) const
47{
48 int k, N = a_r.dimension(0);
49 for (k = 0; k < N; k++)
50 if (n_l != k)
51 {
52 double coeff_loc = beta * ( 1 + 2.78*alpha[k]) ;
53 a_r(k, k ) += std::min(coeff_loc * rho[n_l] * alpha[k], limiter_liquid_ * rho[n_l] * alpha[n_l]) ;
54 a_r(k, n_l) -= std::min(coeff_loc * rho[n_l] * alpha[k], limiter_liquid_ * rho[n_l] * alpha[n_l]) ;
55 a_r(n_l,n_l)+= std::min(coeff_loc * rho[n_l] * alpha[k], limiter_liquid_ * rho[n_l] * alpha[n_l]) ;
56 a_r(n_l, k) -= std::min(coeff_loc * rho[n_l] * alpha[k], limiter_liquid_ * rho[n_l] * alpha[n_l]) ;
57 }
58}
59
60void Masse_ajoutee_Wijngaarden::ajouter_inj(const double *flux_alpha, const double *alpha, const double *rho, DoubleTab& f_a_r) const
61{
62 int N = f_a_r.dimension(0);
63 for (int k = 0; k < N; k++)
64 if (n_l != k)
65 {
66 double coeff_loc = beta * ( 1 + 2.78*alpha[k]) ;
67 double flux_ma = (alpha[k] < 1.e-4) ? coeff_loc * rho[n_l] * flux_alpha[k] : std::min(coeff_loc * rho[n_l] * flux_alpha[k], limiter_liquid_ * rho[n_l] * alpha[n_l] * flux_alpha[k] / alpha[k]) ;
68 f_a_r(k, k ) += inj_ajoutee_gaz_ * flux_ma ;
69 f_a_r(k, n_l) -= 0. ;
70 f_a_r(n_l,n_l)+= 0. ;
71 f_a_r(n_l, k) -= inj_ajoutee_liquide_ * flux_ma ;
72 }
73}
74
75
76void Masse_ajoutee_Wijngaarden::coeff(const DoubleTab& alpha, const DoubleTab& rho, DoubleTab& coeff) const
77{
78 int k, N = coeff.dimension(0);
79 for (k = 0; k < N; k++)
80 if (n_l != k)
81 {
82 double coeff_loc = beta * ( 1 + 2.78*alpha[k]) ;
83 coeff(k) = (alpha[k]>1.e-6) ? std::min(coeff_loc, limiter_liquid_ * alpha[n_l] / alpha[k]) : coeff_loc ;
84 }
85}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Masse ajoutee de la forme ma(k, l) = +/- beta * alpha_k * alpha_l * rho_m.
void ajouter(const double *alpha, const double *rho, DoubleTab &a_r) const override
void coeff(const DoubleTab &alpha, const DoubleTab &rho, DoubleTab &coeff) const override
void ajouter_inj(const double *flux_alpha, const double *alpha, const double *rho, DoubleTab &f_a_r) const override
classe Masse_ajoutee_base masse ajoutee de la forme
virtual int debute_par(const char *const n) const
Definition Nom.cpp:319
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
const Nom & nom_phase(int i) const
int nb_phases() const
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
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133