TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
PlaqThVDF.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.h>
17#include <Modele_turbulence_scal_base.h>
18#include <Domaine_Cl_dis_base.h>
19#include <Champ_front_calc.h>
20#include <Probleme_base.h>
21#include <Milieu_base.h>
22#include <Domaine_VDF.h>
23#include <PlaqThVDF.h>
24
25Implemente_instanciable(PlaqThVDF,"Plaque_Thermique_VDF",Echange_global_impose);
26
28{
29 return s << que_suis_je() << finl;
30}
31
33{
34 if (app_domains.size() == 0) app_domains = { Motcle("Thermique"), Motcle("Neutronique"), Motcle("fraction_massique"), Motcle("indetermine") };
35
36 s >> h;
37 le_champ_front.typer("Champ_front_calc");
38 return s;
39}
40
41void PlaqThVDF::mettre_a_jour(double )
42{
43 const Equation_base& eqn = mon_dom_cl_dis->equation();
44 const Domaine_VDF& le_dom_VDF=ref_cast(Domaine_VDF, eqn.domaine_dis());
45 const Front_VF& front= ref_cast(Front_VF,frontiere_dis());
46
47 const Milieu_base& le_milieu=eqn.probleme().milieu();
48 h/=(le_milieu.masse_volumique().valeurs()(0,0)*le_milieu.capacite_calorifique().valeurs()(0,0));
49
50 // Compute himp:
51 const RefObjU& modele_turbulence = eqn.get_modele(TURBULENCE);
52 if (modele_turbulence && sub_type(Modele_turbulence_scal_base,modele_turbulence.valeur()))
53 {
54 const Modele_turbulence_scal_base& modele = ref_cast(Modele_turbulence_scal_base,modele_turbulence.valeur());
55 const Turbulence_paroi_scal_base& loipar = modele.loi_paroi();
56 Champ_front_calc& ch=ref_cast(Champ_front_calc, T_ext());
57 ch.creer(eqn.probleme().le_nom(),frontiere_dis().le_nom(),eqn.inconnue().le_nom());
58 //const Milieu_base& le_milieu=eqn.probleme().milieu();
59 h_imp_.typer("Champ_front_uniforme");
60 DoubleTab& tab = h_imp_->valeurs();
61 h_imp_->fixer_nb_comp(1);
62 int nbfs2 = front.nb_faces()/2;
63 tab.resize(front.nb_faces(),1);
64 int boundary_index=-1;
65 int nb_boundaries=le_dom_VDF.domaine().nb_front_Cl();
66 for (int n_bord=0; n_bord<nb_boundaries; n_bord++)
67 {
68 if (le_dom_VDF.front_VF(n_bord).le_nom() == front.le_nom())
69 boundary_index=n_bord;
70 }
71 for(int face=0; face < nbfs2; face++)
72 {
73 // double e1 = loipar.d_equiv(face);
74 // double e2 = loipar.d_equiv(nbfs2+face);
75 int local_face=le_dom_VDF.front_VF(boundary_index).num_local_face(face);
76 int local_face2=le_dom_VDF.front_VF(boundary_index).num_local_face(nbfs2+face);
77 double e1 = loipar.equivalent_distance(boundary_index,local_face);
78 double e2 = loipar.equivalent_distance(boundary_index,local_face2);
79 tab(face,0) = tab(nbfs2+face,0) =
80 2./(1./h+e1/le_milieu.diffusivite().valeurs()(0,0)
81 +e2/le_milieu.diffusivite().valeurs()(0,0));
82 }
83 }
84 else if (sub_type(Convection_Diffusion_Temperature,eqn))
85 {
86 Champ_front_calc& ch = ref_cast(Champ_front_calc,T_ext());
88 eqn.inconnue().le_nom());
89 //const Milieu_base& le_milieu=eqn.probleme().milieu();
90 h_imp_.typer("Champ_front_uniforme");
91 DoubleTab& tab= h_imp_->valeurs();
92 tab.resize(1,1);
93 h_imp_->fixer_nb_comp(1);
94 double e1 = le_dom_VDF.dist_norm_bord(front.num_premiere_face());
95 double e2 = le_dom_VDF.dist_norm_bord(front.nb_faces()/2);
96 tab(0,0) = 2./(1./h+e1/le_milieu.diffusivite().valeurs()(0,0)
97 +e2/le_milieu.diffusivite().valeurs()(0,0));
98 }
99
100 //Compute T_ext:
101 const DoubleTab& Temp= eqn.inconnue().valeurs();
102 DoubleTab& tab= T_ext().valeurs();
103 tab.resize(front.nb_faces(),1);
104 int face, el1, el2;
105 int premiere = front.num_premiere_face();
106 int nbfs2=front.nb_faces()/2;
107 int derniere = premiere + nbfs2;
108 for(face=premiere; face < derniere; face++)
109 {
110 int num=face-premiere;
111 el1=le_dom_VDF.face_voisins(face,0);
112 el2=le_dom_VDF.face_voisins(face+nbfs2,1);
113 tab(num+nbfs2,0)=tab(num,0)=(Temp(el1)+Temp(el2))*0.5;
114 };
115}
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
DoubleTab & valeurs() override
Returns the array of field values at the current time.
virtual DoubleTab & valeurs() override
Returns the array of field values.
void creer(const Nom &, const Nom &, const Motcle &)
Create the Champ_front_calc object representing the trace of an unknown field on a boundary from name...
std::vector< Motcle > app_domains
virtual Frontiere_dis_base & frontiere_dis()
Returns the discretized boundary to which the boundary conditions apply.
int nb_front_Cl() const
Definition Domaine.h:236
double dist_norm_bord(int num_face) const override
Returns the normal distance for a boundary face (Cartesian coordinates).
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
Definition Domaine_VF.h:418
const Front_VF & front_VF(int i) const
Definition Domaine_VF.h:112
const Domaine & domaine() const
Classe Echange_global_impose This class represents the special case of the class.
virtual Champ_front_base & T_ext()
Returns the T_ext field of temperature imposed at the boundary.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual const RefObjU & get_modele(Type_modele type) const
virtual const Champ_Inc_base & inconnue() const =0
Probleme_base & probleme()
Returns the problem associated with the equation.
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
const Nom & le_nom() const override
Returns the name of the field.
int num_local_face(const int) const
Definition Front_VF.h:87
int nb_faces() const
Definition Front_VF.h:53
int num_premiere_face() const
Definition Front_VF.h:63
const Nom & le_nom() const override
Returns the name of the geometric boundary.
virtual const Champ_Don_base & capacite_calorifique() const
Returns the heat capacity of the medium (const version).
virtual const Champ_Don_base & diffusivite() const
Returns the diffusivity of the medium (const version).
virtual const Champ_base & masse_volumique() const
Returns the mass density of the medium (const version).
const Turbulence_paroi_scal_base & loi_paroi() const
Returns the scalar wall-law turbulence model (const version).
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 const Nom & le_nom() const
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Objet_U.cpp:317
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
class PlaqThVDF
Definition PlaqThVDF.h:33
double h
Definition PlaqThVDF.h:39
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
virtual const Milieu_base & milieu() const
Returns the physical medium associated with the problem (const version).
Base class for output streams.
Definition Sortie.h:52
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469
const Objet_U & valeur() const
Definition TRUST_Ref.h:134
const DoubleVects & equivalent_distance() const