TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Fraction_Euler.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 <Fraction_Euler.h>
17#include <Discret_Thyd.h>
18#include <Domaine_VF.h>
19#include <Pb_Euler.h>
20#include <Domaine.h>
21#include <Param.h>
22
23Implemente_instanciable(Fraction_Euler, "Fraction_Euler", Conservation_Euler_base);
24// XD fraction_euler cons_euler fraction_euler INHERITS_BRACE Void fraction conservation equation for a multi-phase
25// XD_CONT Euler problem where the unknown is the temperature
26
28
30{
33 verifier_somme_alpha();
34
35 terme_nconserv_.set_fichier("Non_conservative_fraction");
36 terme_nconserv_.set_description("Conribution of non_conservative operator in fraction equation");
37
38 return is;
39}
40
42{
44 param.ajouter_non_std("termes_non_conservatifs|non_conservative_terms", (this));
45}
46
48{
49 Cerr << "Fraction_Euler discretization" << finl;
50 const Discret_Thyd& dis = ref_cast(Discret_Thyd, discretisation());
51 const Pb_Euler& pb = ref_cast(Pb_Euler, probleme());
52
53 const double temps = schema_temps().temps_courant();
54 const int nb_valeurs_temp = schema_temps().nb_valeurs_temporelles();
55 const int N = pb.nb_phases();
56
57 dis.discretiser_champ("temperature", domaine_dis(), "alpha", "sans_dimension", N, nb_valeurs_temp, temps, l_inco_ch_);
58 l_inco_ch_->fixer_nature_du_champ(N == 1 ? scalaire : multi_scalaire);
59
60 for (int i = 0; i < N; i++)
61 l_inco_ch_->fixer_nom_compo(i, Nom("alpha_") + pb.nom_phase(i));
62
63 champs_compris_.ajoute_champ(l_inco_ch_);
64
66 Cerr << "Fraction_Euler discretization ==> ok" << finl;
67}
68
70{
71 if (i)
72 {
73 Cerr << que_suis_je() << " : wrong operator number " << i << finl;
75 }
76 return terme_nconserv_;
77}
78
80{
81 if (i)
82 {
83 Cerr << que_suis_je() << " : wrong operator number " << i << finl;
85 }
86 return terme_nconserv_;
87}
88
90{
92#ifndef NDEBUG
93 verifier_somme_alpha();
94#endif
95}
96
97void Fraction_Euler::verifier_somme_alpha()
98{
99 Cerr << "Fraction_Euler::verifier_somme_alpha() ..." ;
100 const DoubleTab& vals = l_inco_ch_->valeurs();
101 const int ne = vals.dimension(0), nl = vals.line_size();
102 DoubleVect vals_somme(ne);
103 vals_somme = 0.;
104
105 for (int i = 0; i < ne; i++)
106 for (int j = 0; j < nl; j++)
107 vals_somme(i) += vals(i, j);
108
109 const double min_a = mp_min_vect(vals_somme), max_a = mp_max_vect(vals_somme);
110
111 if (min_a < 1. - 1.e-12 || max_a > 1. + 1.e-12)
112 {
113 Cerr << " KO !!! " << finl;
114 Cerr << "WHAT ?? The sum of the void fraction (per cell) is not 1 !!!! You should do something !" << finl;
116 }
117 else
118 Cerr << " OK ! " << finl;
119}
classe Discret_Thyd Cette classe est la classe de base representant une discretisation
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 defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual void set_param(Param &titi) const override
const Discretisation_base & discretisation() const
Renvoie la discretisation associee a l'equation.
virtual void mettre_a_jour(double temps)
La valeur de l'inconnue sur le pas de temps a ete calculee.
Probleme_base & probleme()
Renvoie le probleme associe a l'equation.
Schema_Temps_base & schema_temps()
Renvoie le schema en temps associe a l'equation.
virtual void discretiser()
Discretise l'equation.
Champs_compris champs_compris_
Domaine_dis_base & domaine_dis()
Renvoie le domaine discretise associe a l'equation.
void discretiser() override
Discretise l'equation.
void mettre_a_jour(double temps) override
La valeur de l'inconnue sur le pas de temps a ete calculee.
const Operateur & operateur(int) const override
void set_param(Param &param) const override
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
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
classe Operateur Classe generique de la hierarchie des operateurs.
Definition Operateur.h:39
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter_non_std(const char *keyword, const Objet_U *value, Param::Nature nat=Param::OPTIONAL)
Register a keyword handled by Objet_U::lire_motcle_non_standard.
Definition Param.cpp:489
const Nom & nom_phase(int i) const
Definition Pb_Euler.h:52
int nb_phases() const
Definition Pb_Euler.h:51
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
double temps_courant() const
Renvoie le temps courant.
virtual int nb_valeurs_temporelles() const =0
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
int line_size() const
Definition TRUSTVect.tpp:67