TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Masse_ajoutee_Coef_Constant.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_Coef_Constant.h>
17#include <Pb_Multiphase.h>
18
19Implemente_instanciable(Masse_ajoutee_Coef_Constant, "Masse_ajoutee_Coef_Constant", 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++) //search for n_l, n_g: continuous {liquid,gas} phase with priority
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_Coef_Constant::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 a_r(k, k ) += std::min(beta * rho[n_l] * alpha[k], limiter_liquid_ * rho[n_l] * alpha[n_l]) ;
53 a_r(k, n_l) -= std::min(beta * rho[n_l] * alpha[k], limiter_liquid_ * rho[n_l] * alpha[n_l]) ;
54 a_r(n_l,n_l)+= std::min(beta * rho[n_l] * alpha[k], limiter_liquid_ * rho[n_l] * alpha[n_l]) ;
55 a_r(n_l, k) -= std::min(beta * rho[n_l] * alpha[k], limiter_liquid_ * rho[n_l] * alpha[n_l]) ;
56 }
57}
58
59void Masse_ajoutee_Coef_Constant::coefficient( const double *alpha, const double *rho, DoubleTab& coeff) const
60{
61 int k, N = coeff.dimension(0);
62 for (k = 0; k < N; k++)
63 if (n_l != k)
64 {
65 coeff(k) = (alpha[k]>1.e-6) ? std::min(beta, limiter_liquid_ * alpha[n_l] / alpha[k]) : beta ;
66 }
67}
68
69
70void Masse_ajoutee_Coef_Constant::ajouter_inj(const double *flux_alpha, const double *alpha, const double *rho, DoubleTab& f_a_r) const
71{
72 int N = f_a_r.dimension(0);
73 for (int k = 0; k < N; k++)
74 if (n_l != k)
75 {
76 double flux_ma = (alpha[k] < 1.e-3) ? beta * rho[n_l] * flux_alpha[k] : std::min(beta * rho[n_l] * flux_alpha[k], limiter_liquid_ * rho[n_l] * alpha[n_l] * flux_alpha[k] / alpha[k]) ;
77 f_a_r(k, k ) += inj_ajoutee_gaz_ * flux_ma ;
78 f_a_r(k, n_l) -= 0.;
79 f_a_r(n_l,n_l)+= 0.;
80 f_a_r(n_l, k) -= inj_ajoutee_liquide_ * flux_ma ; //beta * rho[n_l] * flux_alpha[k];
81 }
82}
83
84void Masse_ajoutee_Coef_Constant::coeff( const DoubleTab& alpha, const DoubleTab& rho, DoubleTab& coeff) const
85{
86 int k, N = coeff.dimension(0);
87 for (k = 0; k < N; k++)
88 if (n_l != k)
89 {
90 coeff(k) = (alpha[k]>1.e-6) ? std::min(beta, limiter_liquid_ * alpha[n_l] / alpha[k]) : beta ;
91 }
92}
93
94
95
96
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Added mass of the form ma(k, l) = +/- beta * alpha_k * alpha_l * rho_m.
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
void coefficient(const double *alpha, const double *rho, DoubleTab &coeff) const override
void ajouter(const double *alpha, const double *rho, DoubleTab &a_r) const override
Added-mass correlation of the form: alpha_k rho_k Dv_k / Dt -> alpha_k rho_k Dv_k / Dt + sum_l ma(k,...
virtual int debute_par(const char *const n) const
Definition Nom.cpp:314
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
const Nom & nom_phase(int i) const
int nb_phases() const
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133