TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Pb_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 <Milieu_composite_Euler.h>
17#include <Pb_Euler.h>
18
19Implemente_instanciable(Pb_Euler, "Pb_Euler", Pb_Fluide_base);
20// XD Pb_Euler Pb_base Pb_Euler INHERITS_BRACE A problem that allows the resolution of N-phases Euler equations
21// XD attr milieu_composite_Euler bloc_lecture milieu_composite_Euler OPT The composite medium associated with the
22// XD_CONT problem.
23// XD attr momentum_euler momentum_euler qdm_euler REQ Momentum conservation equation for a multi-phase Euler problem
24// XD_CONT where the unknown is the velocity
25// XD attr masse_euler masse_euler density_euler REQ Mass consevation equation for a multi-phase Euler problem where the
26// XD_CONT unknown is the density
27// XD attr energy_euler energy_euler energie_euler REQ Internal energy conservation equation for a multi-phase Euler
28// XD_CONT problem where the unknown is the temperature
29// XD attr fraction_euler fraction_euler fraction_euler REQ Void fraction conservation equation for a multi-phase Euler
30// XD_CONT problem where the unknown is the alpha
31
33
35{
36 if (!discretisation().is_coloc())
37 Process::exit("Error: Pb_Euler is only available for Coloc discretization !!! Update your data file ...\n");
38
39 if (Objet_U::dimension != 2)
40 Process::exit("Error: Pb_Euler is currently only available in 2D ...\n");
41
42 return Pb_Fluide_base::readOn(is);
43}
44
46{
47 le_milieu_.resize(1);
48 is >> le_milieu_[0];
49
50 if (!sub_type(Milieu_composite_Euler, le_milieu_[0].valeur()))
51 {
52 Cerr << "Error: Fluid of type " << le_milieu_[0]->le_type() << " is not compatible with " << que_suis_je() << " problem which accepts only Milieu_composite_Euler medium !!!" << finl;
53 Cerr << "Check your datafile!" << finl;
55 }
56
57 noms_phases_ = ref_cast(Milieu_composite_Euler, le_milieu_[0].valeur()).noms_phases();
60 for (int i = 0; i < nombre_d_equations(); i++)
62
63 equation(0).milieu().discretiser((*this), la_discretisation_.valeur());
64}
65
67{
68 Cerr << "Pb_Euler : Reading of the equations ..." << finl;
69 for (int i = 0; i < nombre_d_equations(); i++)
70 {
71 is >> mot;
72 is >> getset_equation_by_name(mot);
73 }
74
75 is >> mot; // XXX read last word just after equations !
76
77 Cerr << "Pb_Euler : Reading of the equations => OK" << finl;
78
79 //correction of data read from .data
80 Cerr << "Pb_Euler : Initializing mass's equation unknown " << eq_masse_.inconnue().le_nom() << finl;
81 eq_masse_.init_alpha_rho(); // init unknown because the data file initializes rho !!
82
83 Cerr << "Pb_Euler : Initializing momentum's equation unknown " << eq_qdm_.inconnue().le_nom() << finl;
84 eq_qdm_.init_alpha_rho_u(); // init unknown + phase velocity because the data file initializes velocity !!
85
86 Cerr << "Pb_Euler : Initializing energy's equation unknown " << eq_energie_.inconnue().le_nom() << finl;
87 eq_energie_.init_energie_tot(); // init unknown because the data file initializes nothing (we don't know the value) ...
88
89 return is;
90}
91
93{
94 if (i == 0)
95 return eq_qdm_;
96 else if (i == 1)
97 return eq_masse_;
98 else if (i == 2)
99 return eq_energie_;
100 else if (i == 3)
101 return eq_fraction_;
102 else
103 {
104 Cerr << "Pb_Euler::equation() : Wrong equation number" << i << "!" << finl;
106 }
107 return eq_qdm_;
108}
109
111{
112 if (i == 0)
113 return eq_qdm_;
114 else if (i == 1)
115 return eq_masse_;
116 else if (i == 2)
117 return eq_energie_;
118 else if (i == 3)
119 return eq_fraction_;
120 else
121 {
122 Cerr << "Pb_Euler::equation() : Wrong equation number" << i << "!" << finl;
124 }
125 return eq_qdm_; //to return something
126}
127
129{
130 for (int i = 0; i < nombre_d_equations(); i++)
132}
133
139
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Equation_base The role of an equation is the calculation of one or more fields....
virtual void associer_milieu_equation()
virtual void associer_milieu_base(const Milieu_base &)=0
virtual const Milieu_base & milieu() const =0
Milieu_base This class is the base of the (physical) medium hierarchy.
Definition Milieu_base.h:50
virtual void discretiser(const Probleme_base &pb, const Discretisation_base &dis)
A character string (Nom) in uppercase.
Definition Motcle.h:26
static int dimension
Definition Objet_U.h:94
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
void preparer_calcul() override
Prepares the computation: initializes the medium parameters and prepares the computation of each equa...
Definition Pb_Euler.cpp:134
Fraction_Euler eq_fraction_
Definition Pb_Euler.h:63
void mettre_a_jour(double temps) override
Performs a time update of the problem.
Definition Pb_Euler.cpp:140
const Equation_base & equation(int) const override
Definition Pb_Euler.cpp:92
void associer_milieu_base(const Milieu_base &) override
Associates a physical medium with the problem equations.
Definition Pb_Euler.cpp:128
int nombre_d_equations() const override
Definition Pb_Euler.h:56
Momentum_Euler eq_qdm_
Definition Pb_Euler.h:61
Energy_Euler eq_energie_
Definition Pb_Euler.h:62
Density_Euler eq_masse_
Definition Pb_Euler.h:60
Momentum_Euler & equation_qdm()
Definition Pb_Euler.h:42
Entree & lire_equations(Entree &is, Motcle &dernier_mot) override
Reading of the equations of the problem.
Definition Pb_Euler.cpp:66
void typer_lire_milieu(Entree &is) override
Definition Pb_Euler.cpp:45
Pb_Fluide_base This class provides a base class for.
virtual void discretiser_equations()
virtual void preparer_calcul()
Prepares the computation: initializes the medium parameters and prepares the computation of each equa...
const Discretisation_base & discretisation() const
Returns the discretization associated with the problem.
virtual void mettre_a_jour(double temps)
Performs a time update of the problem.
std::vector< OWN_PTR(Milieu_base)> le_milieu_
const Schema_Temps_base & schema_temps() const
Returns the time scheme associated with the problem.
virtual Equation_base & getset_equation_by_name(const Nom &)
(B. Math): Virtual method added for problems having several equations of the same type (Probleme_FT_D...
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52