TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Energy_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 <Momentum_Euler.h>
17#include <Energy_Euler.h>
18#include <Discret_Thyd.h>
19#include <Domaine_VF.h>
20#include <Pb_Euler.h>
21#include <Domaine.h>
22#include <Param.h>
23
24Implemente_instanciable(Energy_Euler, "Energy_Euler|Energie_Euler", Conservation_Euler_base);
25// XD energy_euler cons_euler energie_euler INHERITS_BRACE Internal energy conservation equation for a multi-phase Euler
26// XD_CONT problem where the unknown is the temperature
27
29
31{
34
35 terme_convectif.set_fichier("Convection_energie");
36 terme_convectif.set_description("Convective heat transfer rate=Integral(-h*u*ndS) [W] if SI units used");
37
38 terme_nconserv_.set_fichier("Non_conservative_energie");
39 terme_nconserv_.set_description("Conribution of non_conservative operator in energy equation");
40
41 return is;
42}
43
45{
47 param.ajouter_non_std("termes_non_conservatifs|non_conservative_terms", (this));
48 param.ajouter_non_std("convection", (this), Param::REQUIRED);
49}
50
52{
53 Cerr << "Energy_Euler discretization" << finl;
54 const Discret_Thyd& dis = ref_cast(Discret_Thyd, discretisation());
55 const Pb_Euler& pb = ref_cast(Pb_Euler, probleme());
56
57 const double temps = schema_temps().temps_courant();
58 const int nb_valeurs_temp = schema_temps().nb_valeurs_temporelles();
59 const int N = pb.nb_phases();
60
61 dis.discretiser_champ("temperature", domaine_dis(), "alpha_energie_tot", "J/m3", N, nb_valeurs_temp, temps, l_inco_ch_);
62 l_inco_ch_->fixer_nature_du_champ(N == 1 ? scalaire : multi_scalaire);
63
64 for (int i = 0; i < N; i++)
65 l_inco_ch_->fixer_nom_compo(i, Nom("alpha_energie_tot_") + pb.nom_phase(i));
66
67 champs_compris_.ajoute_champ(l_inco_ch_);
68
70
71 Cerr << "Energy_Euler discretization ==> ok" << finl;
72}
73
74// on surcharge pour pas effecter energie_tot et pour lire mais rien faire !!
76{
77 Cerr << "Reading of initial conditions\n";
78 Nom nom;
79 Motcle motlu;
80 is >> nom;
81 motlu = nom;
82 if (motlu != Motcle("{"))
83 {
84 Cerr << "We expected a { while reading " << que_suis_je() << finl;
85 Cerr << "and not : " << nom << finl;
86 exit();
87 }
88 is >> nom;
89 motlu = nom;
90 if (motlu != Motcle(inconnue().le_nom()) && motlu != "Energie_tot")
91 {
92 Cerr << nom << " is not the name of the unknown " << inconnue().le_nom() << finl;
93 exit();
94 }
95 OWN_PTR(Champ_Don_base) ch_init;
96 is >> ch_init;
97
98 const int nb_comp = ch_init->nb_comp();
100
101 is >> nom;
102 motlu = nom;
103 if (motlu != Motcle("}"))
104 {
105 Cerr << "We expected a } while reading " << que_suis_je() << finl;
106 Cerr << "and not : " << nom << finl;
107 exit();
108 }
109 return is;
110}
111
113{
114 switch(i)
115 {
116 case 0:
117 return terme_convectif;
118 case 1:
119 return terme_nconserv_;
120 default:
121 Cerr << que_suis_je() << " : wrong operator number " << i << finl;
123 }
124 // Pour les compilos!!
125 return terme_convectif;
126}
127
129{
130 switch(i)
131 {
132 case 0:
133 return terme_convectif;
134 case 1:
135 return terme_nconserv_;
136 default:
137 Cerr << que_suis_je() << " : wrong operator number " << i << finl;
139 }
140 // Pour les compilos!!
141 return terme_convectif;
142}
classe Champ_Don_base classe de base des Champs donnes (non calcules)
const Champ_Inc_base & inconnue() const override
OWN_PTR(Champ_Inc_base) l_inco_ch_
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
void set_param(Param &param) const override
const Operateur & operateur(int) const override
Entree & lire_cond_init(Entree &is) override
Lecture des conditions initiales dans un flot d'entree.
void discretiser() override
Discretise l'equation.
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 Nom & le_nom() const override
Renvoie le nom de l'equation.
const Discretisation_base & discretisation() const
Renvoie la discretisation associee a l'equation.
Probleme_base & probleme()
Renvoie le probleme associe a l'equation.
virtual void verifie_ch_init_nb_comp(const Champ_Inc_base &ch_ref, const int nb_comp) const
Verification du nombre de composantes lues pour la specification d un champ.
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.
const Nom & le_nom() const override
Renvoie le nom du champ.
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
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
@ REQUIRED
Definition Param.h:115
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