TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Conservation_Euler_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 <Conservation_Euler_base.h>
17#include <Pb_Euler.h>
18#include <EChaine.h>
19
20Implemente_base(Conservation_Euler_base, "Conservation_Euler_base", Convection_Diffusion_std);
21// XD cons_euler eqn_base cons_euler INHERITS_BRACE Base class equation for a multi-phase Euler conservation equations
22// XD attr termes_non_conservatifs bloc_op_non_conservativtifs non_conservative_terms OPT Keyword to alter the
23// XD_CONT non-conservative scheme.
24
25// XD bloc_op_non_conservativtifs objet_lecture nul NO_BRACE not_set
26// XD attr aco chaine(into=["{"]) aco REQ Opening curly bracket.
27// XD attr operateur op_non_conservativtifs_deriv operateur REQ not_set
28// XD attr acof chaine(into=["}"]) acof REQ Closing curly bracket.
29
31
33{
34 assert(l_inco_ch_ && le_fluide_);
36
37 if (!sub_type(Pb_Euler, probleme()))
38 {
39 Cerr << "Equation " << que_suis_je() << " can only used with a pb of type Pb_Euler not " << probleme().que_suis_je() << " !!" << finl;
41 }
42 return is;
43}
44
46{
47 if (mot == "convection")
48 {
49 Cerr << "Reading and typing of the convection operator : " << finl;
50 const Champ_base& ch_vitesse_transportante = vitesse_pour_transport();
51 associer_vitesse(ch_vitesse_transportante);
52 terme_convectif.associer_vitesse(ch_vitesse_transportante);
53 is >> terme_convectif;
54 terme_convectif.associer_eqn(*this);
55 return 1;
56 }
57 else if (mot == "termes_non_conservatifs|non_conservative_terms")
58 {
59 Cerr << "Reading and typing of the non_conservative_terms operator : " << finl;
60 is >> terme_nconserv_;
61 terme_nconserv_.associer_eqn(*this);
62 return 1;
63 }
64 else
66}
67
69{
70 assert(sub_type(Pb_Euler, probleme()));
71 // if single-phase and termes_non_conservatifs not read ... type without error!
72 const bool is_single_phase = (ref_cast(Pb_Euler, probleme()).nb_phases() == 1);
73 if (is_single_phase && !terme_nconserv_)
74 {
75 EChaine str(" { negligeable } ");
76 str >> terme_nconserv_;
77 terme_nconserv_.associer_eqn(*this);
78 }
79 else if (!is_single_phase && !terme_nconserv_)
80 {
81 Cerr << "Error while reading " << que_suis_je() << " !!! non_conservative_terms operator is not read although it is required !!! Fix your data file ..." << finl;
83 }
84}
85
87{
88 associer_fluide(ref_cast(Fluide_base, un_milieu));
89}
90
92{
93 assert(sub_type(Fluide_base,un_fluide));
94 le_fluide_ = ref_cast(Fluide_base, un_fluide);
95}
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
void associer_milieu_base(const Milieu_base &) override
void associer_fluide(const Fluide_base &)
Convection_Diffusion_std This class is the base for equations modelling the transport.
void associer_vitesse(const Champ_base &)
Associates the transporting velocity with the equation.
virtual const Champ_base & vitesse_pour_transport() const
An input stream whose source is a character string.
Definition EChaine.h:31
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Probleme_base & probleme()
Returns the problem associated with the equation.
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
Base class for an incompressible fluid and its properties:
Definition Fluide_base.h:36
Milieu_base This class is the base of the (physical) medium hierarchy.
Definition Milieu_base.h:50
A character string (Nom) in uppercase.
Definition Motcle.h:26
friend class Entree
Definition Objet_U.h:71
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
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