TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Echange_impose_base.h
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#ifndef Echange_impose_base_included
17#define Echange_impose_base_included
18
19#include <Cond_lim_base.h>
20#include <TRUSTTab.h>
21
22/*! @brief Echange_impose_base: This boundary condition is used only for the energy equation.
23 *
24 * It corresponds to imposing a heat exchange with the exterior
25 * of the domain by imposing an external temperature T_ext and an
26 * exchange coefficient h_imp.
27 * The flux term computed from the pair (h_imp, T_ext) is written:
28 * h_t(T_ext - T_interior)*Surf
29 * where h_t : global exchange coefficient.
30 * It appears on the right-hand side of the energy equation.
31 * Either the user provides an exchange coefficient corresponding
32 * only to the wall, in which case the program will compute the diffusion
33 * over the half-cell near the wall, or the user provides a global exchange
34 * coefficient that directly accounts for both the above.
35 * The two derived classes Echange_externe_impose and Echange_global_impose
36 * represent these two possibilities.
37 *
38 * @sa Cond_lim_base Echange_externe_impose Echange_global_impose
39 */
41{
42 Declare_base_sans_constructeur(Echange_impose_base);
43public:
44
45 inline bool has_emissivite() const { return bool(emissivite_); }
46 inline bool has_h_imp() const { return bool(h_imp_); }
47
48 const DoubleTab& tab_T_ext(double temps=DMAXFLOAT) const;
49 const DoubleTab& tab_h_imp(double temps=DMAXFLOAT) const;
50 const DoubleTab& tab_emissivite(double temps=DMAXFLOAT) const;
51 virtual double T_ext(int num) const;
52 virtual double T_ext(int num,int k) const;
53 virtual double h_imp(int num) const;
54 virtual double h_imp(int num,int k) const;
55 double emissivite(int num) const;
56 double emissivite(int num,int k) const;
57
58 /*! @brief Returns the T_ext field of temperature imposed at the boundary.
59 *
60 * @return (Champ_front_base&) the T_ext field of temperature imposed at the boundary
61 */
62 inline virtual Champ_front_base& T_ext() { return le_champ_front.valeur(); }
63 inline virtual const Champ_front_base& T_ext() const { return le_champ_front.valeur(); }
64
65 inline virtual Champ_front_base& h_imp() { assert (has_h_imp()); return h_imp_.valeur(); }
66 inline virtual const Champ_front_base& h_imp() const { assert (has_h_imp()); return h_imp_.valeur(); }
67
68 inline Champ_front_base& emissivite() { assert (has_emissivite()); return emissivite_.valeur(); }
69 inline const Champ_front_base& emissivite() const { assert (has_emissivite()); return emissivite_.valeur(); }
70
71 // Used in the CAL of flux computation for wall laws
72 virtual void liste_faces_loi_paroi(IntTab&) { }
73
74 void mettre_a_jour(double ) override;
75 int initialiser(double temps) override;
76 int a_mettre_a_jour_ss_pas_dt() override { return 1; }
77
78 // added method to avoid operating directly on champ_front
79 void set_temps_defaut(double temps) override;
80 void fixer_nb_valeurs_temporelles(int nb_cases) override;
81 //
82 void changer_temps_futur(double temps,int i) override;
83 int avancer(double temps) override;
84 int reculer(double temps) override;
85 void associer_fr_dis_base(const Frontiere_dis_base& ) override ;
86
87 virtual bool has_h_imp_grad() const { return false; }
88 virtual double h_imp_grad(int num) const { Process::exit(que_suis_je()+ " : h_imp_grad must be overloaded !" ) ; return -1.e10 ;};
89 virtual double h_imp_grad(int num,int k) const { Process::exit(que_suis_je()+ " : h_imp_grad must be overloaded !") ; return -1.e10 ;};
90
91protected :
92 OWN_PTR(Champ_front_base) h_imp_, emissivite_ /* si Echange_externe_radiatif */;
93private:
94 // Stores all values on the faces (useful for GPU):
95 mutable DoubleTab text_;
96 mutable DoubleTab himp_;
97 mutable DoubleTab eps_;
98};
99
100#endif /* Echange_impose_base_included */
class Champ_front_base Base class for the hierarchy of boundary fields.
class Cond_lim_base Base class for the hierarchy of classes that represent the different boundary con...
Echange_impose_base: This boundary condition is used only for the energy equation.
int avancer(double temps) override
Rotates the wheel of the BC.
int initialiser(double temps) override
Initialization at the beginning of the calculation.
void fixer_nb_valeurs_temporelles(int nb_cases) override
Called by Conds_lim::completer. Calls cha_front_base::fixer_nb_valeurs_temporelles.
void set_temps_defaut(double temps) override
Changes the i-th future time of the BC.
void associer_fr_dis_base(const Frontiere_dis_base &) override
Associates the boundary with the object.
virtual const Champ_front_base & h_imp() const
int a_mettre_a_jour_ss_pas_dt() override
Indicates whether this boundary condition must be updated during sub-time steps of a time scheme such...
virtual const Champ_front_base & T_ext() const
virtual double h_imp_grad(int num, int k) const
virtual Champ_front_base & h_imp()
virtual Champ_front_base & T_ext()
Returns the T_ext field of temperature imposed at the boundary.
const DoubleTab & tab_h_imp(double temps=DMAXFLOAT) const
OWN_PTR(Champ_front_base) h_imp_
int reculer(double temps) override
Rotates the wheel of the BC.
virtual bool has_h_imp_grad() const
Champ_front_base & emissivite()
const DoubleTab & tab_T_ext(double temps=DMAXFLOAT) const
const Champ_front_base & emissivite() const
void mettre_a_jour(double) override
Performs a time update of the boundary conditions.
const DoubleTab & tab_emissivite(double temps=DMAXFLOAT) const
virtual double h_imp_grad(int num) const
void changer_temps_futur(double temps, int i) override
Changes the i-th future time of the BC.
virtual void liste_faces_loi_paroi(IntTab &)
class Frontiere_dis_base Class representing a discretized boundary.
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466