TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
TRUSTProblem_Cloned_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_Cloned_Concentration_Gen_TPP_included
17#define Pb_Cloned_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 /* Step 1 : Add first equation to list ! */
26 this->list_eq_concentration_.add(_EQUATION_TYPE_());
27 _EQUATION_TYPE_& eqn = this->list_eq_concentration_.dernier();
28 Cerr << "Adding the first " << eqn.que_suis_je() << " to the list ... " << finl;
29 eqn.associer_pb_base(*this);
30 eqn.associer_sch_tps_base(_DERIVED_TYPE_::schema_temps());
31 eqn.associer_domaine_dis(_DERIVED_TYPE_::domaine_dis());
32
33 /* Step 2 : Go to Probleme_base::readOn !! */
34 return _DERIVED_TYPE_::readOn(is);
35}
36
37template <typename _DERIVED_TYPE_, typename _EQUATION_TYPE_, typename _MEDIUM_TYPE_>
39{
43 associer_milieu_base(this->mil_constituants_[0]); // 1er eq concentration pour le moment
44
45 // Milieux lus ... Lets go ! On discretise les equations
46 _DERIVED_TYPE_::discretiser_equations();
48 // remontee de l'inconnue vers le milieu
49 for (int i = 0; i < this->nombre_d_equations(); i++)
50 this->equation(i).associer_milieu_equation();
51
52 // On discretise les milieux !
53 this->equation(0).milieu().discretiser((*this), _DERIVED_TYPE_::discretisation()); // NS
54
55 const Nom nom_const = this->nb_consts_ > 1 ? "coefficient_diffusion0" : "coefficient_diffusion";
56 ref_cast(_MEDIUM_TYPE_, this->list_eq_concentration_.dernier().milieu()).discretiser_multi_concentration(nom_const, (*this), _DERIVED_TYPE_::discretisation()); // Conc
57}
58
59template <typename _DERIVED_TYPE_, typename _EQUATION_TYPE_, typename _MEDIUM_TYPE_>
61{
62 this->rename_equation_unknown(0, this->list_eq_concentration_.dernier());
63 _DERIVED_TYPE_::lire_equations(is, dernier_mot);
65 return is;
66}
67
68template <typename _DERIVED_TYPE_, typename _EQUATION_TYPE_, typename _MEDIUM_TYPE_>
70{
71 if (this->nb_consts_ > 1)
72 {
73 Cerr << "Cloning " << this->nb_consts_ << " concentration equations in progress ..." << finl;
74 for (int i = 1; i < this->nb_consts_; i++)
75 {
76 this->list_eq_concentration_.add(this->list_eq_concentration_.front());
77 _EQUATION_TYPE_& eqn = this->list_eq_concentration_.dernier();
78 Cerr << "Adding another "<< eqn.que_suis_je() << " to the list ... " << finl;
79 eqn.associer_pb_base(*this);
80 eqn.associer_sch_tps_base(_DERIVED_TYPE_::schema_temps());
81 eqn.associer_domaine_dis(_DERIVED_TYPE_::domaine_dis());
82
83 associer_milieu_base(this->mil_constituants_[i]); // 1er eq concentration pour le moment
84 eqn.associer_milieu_equation();
85 const Nom nom_const = Nom("coefficient_diffusion") + Nom(i);
86 ref_cast(_MEDIUM_TYPE_, eqn.milieu()).discretiser_multi_concentration(nom_const, (*this), _DERIVED_TYPE_::discretisation()); // Conc
87
88 this->rename_equation_unknown(i, eqn); // XXX
89
90 // XXX : Elie Saikali : that is REQUIRED !!!! Otherwise we use the operators of the original equation !!!
91 for (int op = 0; op < eqn.nombre_d_operateurs(); op++)
92 {
93 eqn.operateur(op).associer_eqn(eqn);
94 eqn.operateur(op).l_op_base().associer_eqn(eqn);
95 }
96
97 Operateur_Diff& op_diff = dynamic_cast<Operateur_Diff&>(eqn.operateur(0));
98 op_diff.associer_diffusivite(eqn.diffusivite_pour_transport());
99 op_diff->associer_diffusivite(eqn.diffusivite_pour_transport());
100 op_diff.associer_diffusivite_pour_pas_de_temps(eqn.diffusivite_pour_pas_de_temps());
101 op_diff->associer_diffusivite_pour_pas_de_temps(eqn.diffusivite_pour_pas_de_temps());
102
103 Nom nom_fich = "Diffusion_";
104 nom_fich += eqn.inconnue().le_nom();
105 op_diff.set_fichier(nom_fich);
106 op_diff.set_description((Nom) "Diffusion mass transfer rate=Integral(alpha*grad(C)*ndS) [m" + (Nom) (Objet_U::dimension + Objet_U::bidim_axi) + ".Mol.s-1]");
107
108 Operateur_Conv& op_conv = dynamic_cast<Operateur_Conv&>(eqn.operateur(1));
109 const Champ_base& ch_vitesse_transportante = eqn.vitesse_pour_transport();
110 eqn.associer_vitesse(ch_vitesse_transportante);
111 op_conv->associer_vitesse(ch_vitesse_transportante);
112
113 // Pareil ici !!!
114 eqn.solv_masse().associer_eqn(eqn);
115 }
116 }
117}
118
119template <typename _DERIVED_TYPE_, typename _EQUATION_TYPE_, typename _MEDIUM_TYPE_>
121{
122 if (sub_type(_MEDIUM_TYPE_, mil))
123 this->list_eq_concentration_.dernier().associer_milieu_base(mil);
124 else
125 _DERIVED_TYPE_::associer_milieu_base(mil);
126}
127
128template <typename _DERIVED_TYPE_, typename _EQUATION_TYPE_, typename _MEDIUM_TYPE_>
130{
131 _DERIVED_TYPE_::verifier();
132 const Domaine_Cl_dis_base& domaine_Cl_hydr = this->equation(0).domaine_Cl_dis();
133 const Domaine_Cl_dis_base& domaine_Cl_co = this->list_eq_concentration_.front().domaine_Cl_dis();
134 return tester_compatibilite_hydr_concentration(domaine_Cl_hydr, domaine_Cl_co);
135}
136
137#endif /* Pb_Cloned_Concentration_Gen_TPP_included */
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
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 & le_nom() const override
Renvoie *this;.
Definition Nom.cpp:563
static int dimension
Definition Objet_U.h:99
static int bidim_axi
Definition Objet_U.h:102
classe Operateur_Conv Classe generique de la hierarchie des operateurs representant un terme
void associer_vitesse(const Champ_base &)
Associe la vitesse (en tant que vitesse transportante) a l'operateur de convection.
classe Operateur_Diff Classe generique de la hierarchie des operateurs representant un terme
void associer_diffusivite_pour_pas_de_temps(const Champ_base &)
void associer_diffusivite(const Champ_base &)
Associe la diffusivite a l'operateur.
void set_description(const Nom &nom)
void set_fichier(const Nom &nom)