TrioCFD 1.9.9_beta
TrioCFD documentation
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 // for now we simplify the computation and take the average of T
61 // FIXME: need to compute T at the interface as done in 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// laws in 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// laws in 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
Returns the array of field values at the current time.
class Discretisation_base This class represents a spatial discretization scheme, which
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
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
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: a character string for naming TRUST objects.
Definition Nom.h:31
Base class for TRUST objects (Objet_U).
Definition Objet_U.h:68
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
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
Multiphase thermohydraulics problem of type "3*N equations":
virtual Equation_base & equation_qdm()
virtual Equation_base & equation_energie()
Carries the terms of the momentum equation for multiphase flow without turbulence modelling.
Base class for output streams.
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")