TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Convection_Diffusion_std.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 <Convection_Diffusion_std.h>
17#include <Probleme_base.h>
18#include <Milieu_base.h>
19#include <Param.h>
20
21Implemente_base(Convection_Diffusion_std,"Convection_Diffusion_standard",Equation_base);
22
23/*! @brief Simple appel a Equation_base::printOn(Sortie&)
24 *
25 * @param (Sortie& is) un flot de sortie
26 * @return (Sortie&) le flot de sortie modifie
27 */
29{
30 return Equation_base::printOn(is);
31}
32
33
34/*! @brief cf Equation_base::readOn(Entree&)
35 *
36 * @param (Entree& is) un flot d'entree
37 * @return (Entree&) le flot d'entree modifie
38 * @throws terme diffusif non specifie
39 * @throws terme convectif non specifie
40 */
42{
45 terme_convectif->set_transporting_velocity_phase_index(idx_phase_transportante_);
46 return is;
47}
48
50{
52 param.ajouter_non_std("diffusion",(this));
53 param.ajouter_non_std("convection",(this));
54 param.ajouter("phase_transportante", &idx_phase_transportante_);
55}
56
57
59{
60 if (mot=="diffusion")
61 {
62 Cerr << "Reading and typing of the diffusion operator : " << finl;
63 terme_diffusif.associer_diffusivite(diffusivite_pour_transport());
64 is >> terme_diffusif;
65 terme_diffusif.associer_diffusivite_pour_pas_de_temps(diffusivite_pour_pas_de_temps());
66 return 1;
67 }
68 else if (mot=="convection")
69 {
70 Cerr << "Reading and typing of the convection operator : " << finl;
71 const Champ_base& ch_vitesse_transportante = vitesse_pour_transport();
72 associer_vitesse(ch_vitesse_transportante);
73 terme_convectif.associer_vitesse(ch_vitesse_transportante);
74 is >> terme_convectif;
75 return 1;
76 }
77 else
79}
80/*! @brief Renvoie le nombre d'operateurs de l'equation: 2 pour une equation de diffusion.
81 *
82 * @return (int) le nombre d'operateurs de l'equation
83 */
85{
86 return 2;
87}
88
89/*! @brief Renvoie l'operateur specifie par son index: renvoie terme_diffusif si i = 0
90 *
91 * renvoie terme_convectif si i = 1
92 * exit si i>1
93 * (version const)
94 *
95 * @param (int i) l'index de l'operateur a renvoyer
96 * @return (Operateur&) l'operateur specifie
97 * @throws l'equation n'a pas plus de 2 operateurs
98 */
100{
101 switch(i)
102 {
103 case 0:
104 return terme_diffusif;
105 case 1:
106 return terme_convectif;
107 default :
108 Cerr << "Error for Convection_Diffusion_std::operateur(int i)" << finl;
109 Cerr << "Convection_Diffusion_std has " << nombre_d_operateurs() <<" operators "<<finl;
110 Cerr << "and you are trying to access the " << i <<" th one."<< finl;
111 exit();
112 }
113 // Pour les compilos!!
114 return terme_diffusif;
115}
116
117/*! @brief Renvoie l'operateur specifie par son index: renvoie terme_diffusif si i = 0
118 *
119 * renvoie terme_convectif si i = 1
120 * exit si i>1
121 *
122 * @param (int i) l'index de l'operateur a renvoyer
123 * @return (Operateur&) l'operateur specifie
124 * @throws l'equation n'a pas plus de 2 operateurs
125 */
127{
128 switch(i)
129 {
130 case 0:
131 return terme_diffusif;
132 case 1:
133 return terme_convectif;
134 default :
135 Cerr << "Error for Convection_Diffusion_std::operateur(int i)" << finl;
136 Cerr << "Convection_Diffusion_std has " << nombre_d_operateurs() <<" operators "<<finl;
137 Cerr << "and you are trying to access the " << i <<" th one."<< finl;
138 exit();
139 }
140 // Pour les compilos!!
141 return terme_diffusif;
142}
143
148
153
155{
156 return probleme().get_champ("vitesse");
157}
158
159// E. Saikali : Methodes utiles pour un heritage V
168
173
classe Champ_Don_base classe de base des Champs donnes (non calcules)
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
classe Convection_Diffusion_std Cette classe est la base des equations modelisant le transport
std::vector< YAML_data > data_a_sauvegarder_base() const
void associer_vitesse(const Champ_base &)
Associe la vitesse transportante a l'equation.
virtual const Champ_Don_base & diffusivite_pour_transport() const
virtual const Champ_base & diffusivite_pour_pas_de_temps() const
const Operateur & operateur(int) const override
Renvoie l'operateur specifie par son index: renvoie terme_diffusif si i = 0.
void set_param(Param &titi) const override
int nombre_d_operateurs() const override
Renvoie le nombre d'operateurs de l'equation: 2 pour une equation de diffusion.
virtual const Champ_base & vitesse_pour_transport() const
int lire_motcle_non_standard(const Motcle &, Entree &) override
Lecture des parametres de type non simple d'un objet_U a partir d'un flot d'entree.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
virtual void set_param(Param &titi) const override
int reprendre(Entree &) override
On reprend l'inconnue a partir d'un flot d'entree.
virtual const Milieu_base & milieu() const =0
virtual std::vector< YAML_data > data_a_sauvegarder() const
for PDI IO: retrieve name, type and dimensions of the data to save/restore. This has to be overrode f...
int sauvegarder(Sortie &) const override
On sauvegarde l'inconnue, puis les sources sur un flot de sortie.
Probleme_base & probleme()
Renvoie le probleme associe a l'equation.
int lire_motcle_non_standard(const Motcle &, Entree &) override
Lecture des parametres de type non simple d'un objet_U a partir d'un flot d'entree.
virtual const Champ_Don_base & diffusivite() const
Renvoie la diffusivite du milieu.
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
friend class Entree
Definition Objet_U.h:76
friend class Sortie
Definition Objet_U.h:75
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(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
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 Champ_base & get_champ(const Motcle &nom) const override
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