TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Interface_base.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 <Discretisation_base.h>
17#include <Interface_base.h>
18#include <QDM_Multiphase.h>
19#include <Equation_base.h>
20#include <Pb_Multiphase.h>
21#include <Domaine_VF.h>
22#include <TRUSTTrav.h>
23
24Implemente_base(Interface_base, "Interface_base", Objet_U);
25// XD Interface_base objet_u Interface_base INHERITS_BRACE Basic class for a liquid-gas interface (used in
26// XD_CONT pb_multiphase)
27
28Sortie& Interface_base::printOn(Sortie& os) const { return os; }
29
31{
32 param.ajouter("tension_superficielle|surface_tension", &sigma__); // XD_ADD_P floattant
33 // XD_CONT surface tension
34}
35
37{
38 Param param(que_suis_je());
39 set_param(param);
40 param.lire_avec_accolades_depuis(is);
41 return is;
42}
43
44void Interface_base::discretiser_sigma(const Nom& sig_nom, double temps)
45{
46 const Discretisation_base& dis = pb_->discretisation();
47 const Domaine_dis_base& dom_dis = pb_->domaine_dis();
48 dis.discretiser_champ("temperature", dom_dis, sig_nom, "N/m", 1, temps, ch_sigma_);
49}
50
51
53{
54 DoubleTab& sigma_tab = ch_sigma_->valeurs();
55 const Pb_Multiphase& pbm = ref_cast(Pb_Multiphase, pb_.valeur());
56 const DoubleTab& press = ref_cast(QDM_Multiphase, pbm.equation_qdm()).pression().valeurs(),
57 &temp = pbm.equation_energie().inconnue().valeurs();
58
59 // XXX Elie Saikali : Cas sans saturation !
60 // pour le moment on simplifie le calcul et on prend la moyenne de T
61 // FIXME : faut faire un truc pour calculer T a l'interface comme le code dans Source_Flux_interfacial_base::ajouter_blocs
62 // T_interf = ( Tl / hl + Tg / hg ) / (1 / hl + 1 / hg )
63
64 const int N = temp.line_size();
65 DoubleTrav Ti(sigma_tab);
66 Ti = 0.;
67
68 for (int i = 0; i < Ti.dimension_tot(0); i++)
69 {
70 for (int j = 0; j < N; j++) Ti(i, 0) += temp(i, j);
71 Ti(i,0) /= N;
72 }
73
74 // call sigma
75 sigma(Ti.get_span(), press.get_span(), sigma_tab.get_span(), 1, 0);
76 sigma_tab.echange_espace_virtuel();
77}
78
79// lois en T
80void Interface_base::sigma(const SpanD T, const SpanD P, SpanD res, int ncomp, int ind) const
81{
82 if (sigma__ >= 0)
83 for (int i = 0; i < (int) P.size(); i++)
84 res[i * ncomp + ind] = sigma__;
85 else
86 sigma_(T, P, res, ncomp, ind);
87}
88
89double Interface_base::sigma(const double T, const double P) const
90{
91 ArrayD Tt = { T }, Pp = { P }, res_ = { 0. };
92 sigma(SpanD(Tt), SpanD(Pp), SpanD(res_), 1, 0);
93 return res_[0];
94}
95
96// lois en h
97void Interface_base::sigma_h(const SpanD H, const SpanD P, SpanD res, int ncomp, int ind) const
98{
99 if (sigma__ >= 0)
100 for (int i = 0; i < (int) P.size(); i++)
101 res[i * ncomp + ind] = sigma__;
102 else
103 sigma_h_(H, P, res, ncomp, ind);
104}
105
106double Interface_base::sigma_h(const double h, const double P) const
107{
108 ArrayD H = { h }, Pp = { P }, res_ = { 0. };
109 sigma_h(SpanD(H), SpanD(Pp), SpanD(res_), 1, 0);
110 return res_[0];
111}
DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ au temps courant.
classe Discretisation_base Cette classe represente un schema de discretisation en espace,...
void discretiser_champ(const Motcle &directive, const Domaine_dis_base &z, const Nom &nom, const Nom &unite, int nb_comp, int nb_pas_dt, double temps, OWN_PTR(Champ_Inc_base)&champ, const Nom &sous_type=NOM_VIDE) const
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual const Champ_Inc_base & inconnue() const =0
virtual void set_param(Param &param) const override
double sigma_h(const double h, const double P) const
void discretiser_sigma(const Nom &sig_nom, double temps)
virtual void sigma_h_(const SpanD H, const SpanD P, SpanD res, int ncomp=1, int ind=0) const =0
virtual void sigma_(const SpanD T, const SpanD P, SpanD res, int ncomp=1, int ind=0) const =0
double sigma(const double T, const double P) const
virtual void mettre_a_jour(double)
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
classe Objet_U Cette classe est la classe de base des Objets de TRUST
Definition Objet_U.h:73
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
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
classe Pb_Multiphase Cette classe represente un probleme de thermohydraulique multiphase de type "3*N...
virtual Equation_base & equation_qdm()
virtual Equation_base & equation_energie()
classe QDM_Multiphase Cette classe porte les termes de l'equation de la dynamique
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160
int line_size() const
Definition TRUSTVect.tpp:67
Span_ get_span() override
Definition TRUSTVect.h:181
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")