TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Source_Meca_Grad_Pression_Thermique_EF.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 <Source_Meca_Grad_Pression_Thermique_EF.h>
17#include <Milieu_Elasticite.h>
18#include <Domaine_EF.h>
19#include <Equation_base.h>
20#include <Champ_Uniforme.h>
21#include <Param.h>
22
23Implemente_instanciable(Source_Meca_Grad_Pression_Thermique_EF, "Source_Meca_Grad_Pression_Thermique_EF", Source_base);
24// XD source_meca_grad_pression_thermique source_base source_meca_grad_pression_thermique BRACE Source term that applies
25// XD_CONT the gradient of thermal pressure as an equivalent body force in the linear elasticity momentum equation.
26
28
30{
31 Param param(que_suis_je());
32 param.ajouter("reference_temperature_field", &T_ref_, Param::REQUIRED); // XD_ADD_P field_base
33 // XD_CONT Reference temperature field used to compute the thermal pressure gradient.
34 param.ajouter("temperature_field", &T_, Param::REQUIRED); // XD_ADD_P field_base
35 // XD_CONT Temperature field used to compute the thermal pressure gradient.
36 param.lire_avec_accolades_depuis(is);
37 return is;
38}
39
41{
42 T_ref_->initialiser(temps);
43 equation().discretisation().nommer_completer_champ_physique(equation().domaine_dis(), "temperature_field", "", T_.valeur(), equation().probleme());
44 T_->initialiser(temps);
45 return Source_base::initialiser(temps);
46}
47
49{
50 T_ref_->mettre_a_jour(temps);
51 T_->mettre_a_jour(temps);
52}
53
54DoubleTab& Source_Meca_Grad_Pression_Thermique_EF::ajouter(DoubleTab& resu) const
55{
56 const Domaine_EF& domaine_ef = ref_cast(Domaine_EF, equation().domaine_dis());
57 const IntTab& elems = domaine_ef.domaine().les_elems();
58 const DoubleTab& Bij_thilde = domaine_ef.Bij_thilde();
59 const DoubleTab& IPhi_thilde = domaine_ef.IPhi_thilde();
60
61 const int nb_elem_tot = domaine_ef.nb_elem_tot();
62 const int nb_som_elem = domaine_ef.domaine().nb_som_elem();
63 const int D = dimension;
64
65 const DoubleTab& val_alpha = ref_cast(Milieu_Elasticite, equation().milieu()).thermal_expansion().valeurs();
66 const DoubleTab& val_K = ref_cast(Milieu_Elasticite, equation().milieu()).bulk_modulus().valeurs();
67
68 const DoubleTab& val_T = T_->valeurs();
69 const DoubleTab& val_Tref = T_ref_->valeurs();
70
71 const int cT = sub_type(Champ_Uniforme, T_.valeur()) ? 1 : 0;
72 const int cTref = sub_type(Champ_Uniforme, T_ref_.valeur()) ? 1 : 0;
73
74 // Assemble: for each element e, scalar s_e = 3 K α (T - Tref),
75 // add to each node i and component d: resu(node,d) += s_e * ∫_Ω ∂N_i/∂x_d dV = s_e * Bij_thilde(e,i,d)
76 for (int e = 0; e < nb_elem_tot; e++)
77 {
78 const double alpha_e = val_alpha(0);
79 const double K_e = val_K(0);
80 const double dT_e = val_T(e * !cT) - val_Tref(e * !cTref);
81 const double s_e = 3.0 * K_e * alpha_e * dT_e; // [Pa]
82
83 if (s_e == 0.) continue;
84
85 for (int i = 0; i < nb_som_elem; i++)
86 {
87 const int s = elems(e, i);
88 // Base strong-form (all components): + s_e * ∫ ∂N_i/∂x_d dV
89 for (int d = 0; d < D; d++)
90 resu(s, d) += s_e * Bij_thilde(e, i, d);
91
92 // Axisymmetric fix: add + s_e * ∫ (N_i / r) dV on the radial component
93 if (bidim_axi)
94 resu(s, 0) += s_e * IPhi_thilde(e, i) / domaine_ef.xp(e, 0);
95 }
96 }
97 return resu;
98}
classe Champ_Uniforme Represente un champ constant dans l'espace et dans le temps.
void nommer_completer_champ_physique(const Domaine_dis_base &domaine_vdf, const Nom &nom_champ, const Nom &unite, Champ_base &champ, const Probleme_base &pbi) const
int nb_som_elem() const
Renvoie le nombre de sommets des elements geometriques constituants le domaine.
Definition Domaine.h:474
IntTab_t & les_elems()
Definition Domaine.h:129
class Domaine_EF
Definition Domaine_EF.h:59
const DoubleTab & IPhi_thilde() const
Definition Domaine_EF.h:95
const DoubleTab & Bij_thilde() const
Definition Domaine_EF.h:93
double xp(int num_elem, int k) const
Definition Domaine_VF.h:77
int nb_elem_tot() const
const Domaine & domaine() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Discretisation_base & discretisation() const
Renvoie la discretisation associee a l'equation.
Isotropic small-strain linear elastic medium.
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
static int dimension
Definition Objet_U.h:99
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
static int bidim_axi
Definition Objet_U.h:102
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
@ REQUIRED
Definition Param.h:115
Classe de base des flux de sortie.
Definition Sortie.h:52
Source couplant gradient de pression et dilatation thermique pour la formulation thermomécanique.
int initialiser(double temps) override
Contrairement aux methodes mettre_a_jour, les methodes initialiser des sources ne peuvent pas dependr...
void mettre_a_jour(double temps) override
DOES NOTHING - to override in derived classes.
classe Source_base Un objet Source_base est un terme apparaissant au second membre d'une
Definition Source_base.h:42
virtual int initialiser(double temps)
Contrairement aux methodes mettre_a_jour, les methodes initialiser des sources ne peuvent pas dependr...