TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
TRUSTProblem_List_Concentration_Gen.tpp
1/****************************************************************************
2* Copyright (c) 2024, 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#ifndef Pb_List_Concentration_Gen_TPP_included
17#define Pb_List_Concentration_Gen_TPP_included
18
19#include <Operateur_Diff.h>
20#include <Verif_Cl.h>
21
22template <typename _DERIVED_TYPE_, typename _EQUATION_TYPE_, typename _MEDIUM_TYPE_>
24{
25 this->lire_resize_medium(is);
28
29 auto& list_eqs = this->list_eq_concentration_.get_stl_list();
30
31 int ind_list = 0;
32 for (auto &&itr : list_eqs)
33 {
34 itr.associer_milieu_base(this->mil_constituants_[ind_list]);
35 ind_list++;
36 }
37
38 // Milieux lus ... Lets go ! On discretise les equations
39 const int nb_eq_mere = _DERIVED_TYPE_::nombre_d_equations();
40 Cerr << "Discretization of the equations of problem " << _DERIVED_TYPE_::que_suis_je() << " ..." << finl;
41 for (int i = 0; i < this->nombre_d_equations(); i++)
42 {
43 this->equation(i).associer_domaine_dis(_DERIVED_TYPE_::domaine_dis());
44 this->equation(i).discretiser();
46 if (i >= nb_eq_mere && this->nb_consts_ > 1)
47 this->rename_equation_unknown(i - nb_eq_mere, this->list_eq_concentration_[i - nb_eq_mere]); // Et oui ;)
48 }
49
50 // remontee de l'inconnue vers le milieu
51 for (int i = 0; i < this->nombre_d_equations(); i++)
52 this->equation(i).associer_milieu_equation();
53
54 // On discretise les milieux !
55 this->equation(0).milieu().discretiser((*this), _DERIVED_TYPE_::discretisation()); // NS
56
57 ind_list = 0;
58 for (auto &itr : list_eqs)
59 {
60 Nom nom_const = "coefficient_diffusion";
61 if(this->nb_consts_ > 1) nom_const += Nom(ind_list);
62 ref_cast(_MEDIUM_TYPE_, itr.milieu()).discretiser_multi_concentration(nom_const, (*this), _DERIVED_TYPE_::discretisation()); // Conc
63 ind_list++;
64 }
65}
66
67template <typename _DERIVED_TYPE_, typename _EQUATION_TYPE_, typename _MEDIUM_TYPE_>
69{
70 for (int i = 0; i < this->nb_consts_; i++)
71 {
72 this->list_eq_concentration_.add(_EQUATION_TYPE_());
73 _EQUATION_TYPE_ &eqn = this->list_eq_concentration_.dernier();
74 Cerr << "Adding equation " << eqn.que_suis_je() << " to the list ... " << finl;
75 eqn.associer_pb_base(*this);
76 eqn.associer_sch_tps_base(_DERIVED_TYPE_::schema_temps());
77 }
78}
79
80inline void error_read_equation(const Motcle& read, const Motcle& expected)
81{
82 Cerr << "What() ?? Error in TRUSTProblem_List_Concentration_Gen<_DERIVED_TYPE_, _EQUATION_TYPE_, _MEDIUM_TYPE_>::lire_equations !!!" << finl;
83 Cerr << "We expected to read " << expected << " and not " << read << " !!!" << finl;
84 Cerr << "Correct your data file or call the 911 !!!" << finl;
86}
87
88template <typename _DERIVED_TYPE_, typename _EQUATION_TYPE_, typename _MEDIUM_TYPE_>
90{
91 Motcle un_nom;
92 const int nb_eq_mere = _DERIVED_TYPE_::nombre_d_equations(), nb_eq = this->nombre_d_equations();
93 Cerr << "Reading of the equations ..." << finl;
94
95 for (int i = 0; i < nb_eq_mere; i++)
96 {
97 is >> un_nom;
98 if (!un_nom.debute_par("NAVIER_STOKES") && !un_nom.debute_par("CONVECTION_DIFFUSION_TEMPERATURE"))
99 error_read_equation(un_nom, Motcle(this->equation(i).que_suis_je()));
100
101 is >> _DERIVED_TYPE_::getset_equation_by_name(un_nom);
102 }
103
104 // lecture de la liste
105 is >> un_nom;
106 if (un_nom != "LIST_EQUATIONS" && un_nom != "LISTE_EQUATIONS")
107 error_read_equation(un_nom, Motcle("LIST_EQUATIONS"));
108
109 is >> un_nom;
110 if (un_nom != "{" )
111 error_read_equation(un_nom, Motcle("{"));
112
113 for (int i = nb_eq_mere; i < nb_eq; i++)
114 {
115 is >> un_nom; /* poubelle */
116 Motcle eq_nom = this->list_eq_concentration_.front().que_suis_je();
117 if (un_nom != eq_nom)
118 {
119 Cerr << "You defined " << this->nb_consts_ << " diffusion coefficients so we are supposed to read " << this->nb_consts_ << " equations ..." << finl;
120 error_read_equation(un_nom, eq_nom);
121 }
122
123 is >> this->list_eq_concentration_[i - nb_eq_mere];
124 }
125
126 is >> un_nom;
127 if (un_nom != "}" )
128 error_read_equation(un_nom, Motcle("}"));
129
130 is >> dernier_mot;
131 return is;
132}
133
134template <typename _DERIVED_TYPE_, typename _EQUATION_TYPE_, typename _MEDIUM_TYPE_>
136{
137 if (sub_type(_MEDIUM_TYPE_, mil)) { /* Do nothing */ }
138 else _DERIVED_TYPE_::associer_milieu_base(mil);
139}
140
141template <typename _DERIVED_TYPE_, typename _EQUATION_TYPE_, typename _MEDIUM_TYPE_>
143{
144 _DERIVED_TYPE_::verifier();
145 const Domaine_Cl_dis_base& domaine_Cl_hydr = this->equation(0).domaine_Cl_dis();
146
147 auto& list_eqs = this->list_eq_concentration_.get_stl_list();
148 for (auto &itr : list_eqs)
149 {
150 const Domaine_Cl_dis_base& domaine_Cl_co = itr.domaine_Cl_dis();
151 tester_compatibilite_hydr_concentration(domaine_Cl_hydr, domaine_Cl_co);
152 }
153
154 return 1;
155}
156
157#endif /* Pb_List_Concentration_Gen_TPP_included */
classe Domaine_Cl_dis_base Les objets Domaine_Cl_dis_base representent les conditions aux limites
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Milieu_base Cette classe est la base de la hierarchie des milieux (physiques)
Definition Milieu_base.h:50
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
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Entree & lire_equations(Entree &is, Motcle &dernier_mot) override