TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Convection_Diffusion_Temperature_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 <Convection_Diffusion_Temperature_base.h>
17#include <Probleme_base.h>
18#include <Discret_Thyd.h>
19
20Implemente_base(Convection_Diffusion_Temperature_base, "Convection_Diffusion_Temperature_base", Convection_Diffusion_std);
21
23
25
27{
28 if(!le_fluide)
29 {
30 Cerr << "You forgot to associate the fluid to the problem named " << probleme().le_nom() << finl;
32 }
33 return le_fluide.valeur();
34}
35
36
37/*! @brief Returns the fluid associated with the equation.
38 *
39 * @return the fluid associated with the equation
40 * @throws no fluid associated with the equation
41 */
43{
44 if(!le_fluide)
45 {
46 Cerr << "You forgot to associate the fluid to the problem named " << probleme().le_nom() << finl;
48 }
49 return le_fluide.valeur();
50}
51
52/*! @brief Associates a physical medium to the equation; the medium is cast to Fluide_base.
53 *
54 * @param un_milieu the physical medium to associate
55 * @throws the medium is not of type Fluide_base
56 */
58{
59 if (sub_type(Fluide_base,un_milieu)) associer_fluide(ref_cast(Fluide_base, un_milieu));
60 else Process::exit(que_suis_je() + " : the fluid " + un_milieu.que_suis_je() + " is not of type Fluide_base!");
61}
62
64{
66
67 if (motlu == "temperature_paroi" || motlu == "wall_temperature")
68 {
69 if (!temperature_paroi_)
70 {
71 const Discret_Thermique& dis = ref_cast(Discret_Thermique, discretisation());
72 dis.t_paroi(domaine_dis(), domaine_Cl_dis(), inconnue(), temperature_paroi_);
73 champs_compris_.ajoute_champ(temperature_paroi_);
74 }
75 }
76}
77
78bool Convection_Diffusion_Temperature_base::has_champ(const Motcle& nom, OBS_PTR(Champ_base)& ref_champ) const
79{
80 if (nom == "temperature_paroi" || nom == "wall_temperature")
81 {
83 return true;
84 }
85
87 return Convection_Diffusion_std::has_champ(nom, ref_champ);
88
89 return false; /* nothing found */
90}
91
93{
94 if (nom == "temperature_paroi" || nom == "wall_temperature")
95 return true;
96
98 return true;
99
100 return false; /* nothing found */
101}
102
104{
105 if (nom == "temperature_paroi" || nom == "wall_temperature")
106 {
107 double temps_init = schema_temps().temps_init();
108 Champ_Fonc_base& ch_tp = ref_cast_non_const(Champ_Fonc_base, temperature_paroi_.valeur());
109 if (((ch_tp.temps() != inconnue().temps()) || (ch_tp.temps() == temps_init)) && ((inconnue().mon_equation_non_nul())))
110 ch_tp.mettre_a_jour(inconnue().temps());
111 return champs_compris_.get_champ(nom);
112 }
113
114 OBS_PTR(Champ_base) ref_champ;
115
116 if (Convection_Diffusion_std::has_champ(nom, ref_champ))
117 return ref_champ;
118
119 throw std::runtime_error(std::string("Field ") + nom.getString() + std::string(" not found !"));
120}
121
123{
125
126 Noms noms_compris = champs_compris_.liste_noms_compris();
127 noms_compris.add("TEMPERATURE_PAROI");
128 noms_compris.add("WALL_TEMPERATURE");
129
130 if (opt == DESCRIPTION)
131 Cerr << que_suis_je() << " : " << noms_compris << finl;
132 else
133 nom.add(noms_compris);
134}
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
void mettre_a_jour(double temps) override
Time update of the field.
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
double temps() const
Returns the time of the field.
virtual void creer_champ(const Motcle &motlu)=0
virtual void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const =0
virtual bool has_champ(const Motcle &nom, OBS_PTR(Champ_base)&ref_champ) const =0
void associer_milieu_base(const Milieu_base &) override
Associates a physical medium to the equation; the medium is cast to Fluide_base.
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
const Champ_base & get_champ(const Motcle &nom) const override
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
Convection_Diffusion_std This class is the base for equations modelling the transport.
const Champ_Inc_base & inconnue() const override=0
Class Discret_Thermique: base class representing a spatial discretisation applied to thermal problems...
virtual void t_paroi(const Domaine_dis_base &z, const Domaine_Cl_dis_base &zcl, const Champ_Inc_base &, OWN_PTR(Champ_Fonc_base)&ch) const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Discretisation_base & discretisation() const
Returns the discretization associated with the equation.
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the discretized boundary condition domain associated with the equation.
Probleme_base & probleme()
Returns the problem associated with the equation.
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
Champs_compris champs_compris_
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
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
const std::string & getString() const
Definition Nom.h:92
An array of character strings (VECT(Nom)).
Definition Noms.h:26
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
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Probleme_U.h:109
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
double temps_init() const
Returns the initial time.
Base class for output streams.
Definition Sortie.h:52