TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Source_Robin_Scalaire.cpp
1/****************************************************************************
2* Copyright (c) 2017, 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_Robin_Scalaire.h>
17
18
19#include <Domaine_VEF.h>
20#include <Domaine_Cl_VEF.h>
21#include <Equation_base.h>
22#include <Fluide_base.h>
23#include <distances_VEF.h>
24#include <Navier_Stokes_Turbulent.h>
25#include <Source_Robin.h>
26#include <Probleme_base.h>
27#include <Champ_Uniforme.h>
28#include <Convection_Diffusion_Temperature.h>
29#include <Modele_turbulence_scal_base.h>
30#include <Paroi_decalee_Robin.h>
31#include <Paroi_std_scal_hyd_VEF.h>
32
33Implemente_instanciable(Source_Robin_Scalaire,"Source_Robin_Scalaire_VEF_P1NC",Source_base);
34// XD source_robin_scalaire source_base source_robin_scalaire NO_BRACE This source term should be used when a
35// XD_CONT Paroi_decalee_Robin boundary condition is set in a an energy equation. The source term will be applied on the
36// XD_CONT N specified boundaries. The values temp_wall_valueI are the temperature specified on the Ith boundary. The
37// XD_CONT last value dt_impr is a printing period which is mandatory to specify in the data file but has no effect yet.
38// XD attr bords listdeuxmots_sacc bords REQ not_set
39// XD listdeuxmots_sacc listobj nul NO_BRACE deuxmots 0 List of groups of two words (without curly brackets).
40
41// printOn
43{
44 return s << que_suis_je();
45}
46
47
48// readOn
50{
51 int nb;
52 s >> nb;
53 noms_parois.dimensionner(nb);
54 T_parois.resize(nb);
55 for (int i=0; i<nb; i++) s>> noms_parois[i] >> T_parois(i);
56// s >> dt_post;
57 return s;
58}
59
60
61// associer_pb
65
66
67// completer
69{
71 const Equation_base& eqn_NS = equation().probleme().equation(0);
72 const Sources& srcs = eqn_NS.sources();
73 for (const auto& itr : srcs)
74 {
75 if (sub_type(Source_Robin,itr.valeur()))
76 {
77 const Source_Robin& ts_Robin = ref_cast(Source_Robin,itr.valeur());
78 tab_u_star = ts_Robin.tab_u_star();
79 tab_d_plus = ts_Robin.tab_d_plus();
80 }
81 }
82}
83
84
85// ajouter
86DoubleTab& Source_Robin_Scalaire::ajouter(DoubleTab& resu) const
87{
88 const Domaine_VEF& domaine_VEF = le_dom_VEF.valeur();
89 const Domaine_Cl_VEF& domaine_Cl_VEF = le_dom_Cl_VEF.valeur();
90 const DoubleTab& temperature = equation().inconnue().valeurs();
91 const Fluide_base& fluide = ref_cast(Fluide_base,equation().milieu());
92 const Champ_Don_base& lambda = fluide.conductivite();
93 int lambda_uniforme = (sub_type(Champ_Uniforme,lambda) ? 1 : 0);
95 const Modele_turbulence_scal_base& le_modele_scalaire = ref_cast(Modele_turbulence_scal_base,eq_th.get_modele(TURBULENCE).valeur());
96 const DoubleTab& lambda_t = le_modele_scalaire.conductivite_turbulente().valeurs();
97 const Paroi_scal_hyd_base_VEF& loi_de_paroi = ref_cast(Paroi_scal_hyd_base_VEF,le_modele_scalaire.loi_paroi());
98 const DoubleVect& surfaces_face = ref_cast_non_const(Domaine_VEF,domaine_VEF).face_surfaces();
99
100 for (int n_bord=0; n_bord<domaine_VEF.nb_front_Cl(); n_bord++)
101 {
102 int face;
103 const Cond_lim& la_cl = domaine_Cl_VEF.les_conditions_limites(n_bord);
104 int pos_Paroi = noms_parois.search(la_cl->frontiere_dis().le_nom());
105 const DoubleVect& dist_equiv = loi_de_paroi.equivalent_distance(n_bord);
106
107 if (sub_type(Paroi_decalee_Robin,la_cl.valeur()))
108 {
109 // double acc_loc_tot = 0;
110 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
111 int ndeb = le_bord.num_premiere_face();
112 int nfin = ndeb + le_bord.nb_faces();
113 double Tw = T_parois(pos_Paroi);
114
115 for (face=ndeb; face<nfin; face++)
116 {
117 int elem = domaine_VEF.face_voisins(face,0);
118 if (elem==-1) elem = domaine_VEF.face_voisins(face,1);
119 double d_lambda = (lambda_uniforme ? lambda.valeurs()(0,0) : lambda.valeurs()(elem,0));
120 double acc_loc = - (d_lambda + lambda_t(elem)) * (temperature(face) - Tw) / dist_equiv[face-ndeb] * surfaces_face(face);
121 // acc_loc_tot += acc_loc;
122 resu(face) += acc_loc;
123 }
124 }
125 }
126 return resu;
127}
128
129
130// calculer
131DoubleTab& Source_Robin_Scalaire::calculer(DoubleTab& resu) const
132{
133 resu = 0;
134 ajouter(resu);
135 return resu;
136}
137
138
139// associer_domaines
141{
142 le_dom_VEF = ref_cast(Domaine_VEF,z);
143 le_dom_Cl_VEF = ref_cast(Domaine_Cl_VEF,zcl);
144}
class Champ_Don_base base class of Given Fields (not calculated)
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.
Champ_Uniforme Represents a field that is constant in space and time.
class Cond_lim Generic class used to represent any class
Definition Cond_lim.h:31
Convection_Diffusion_Temperature Special case of Convection_Diffusion_std.
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
class Domaine_VEF
Definition Domaine_VEF.h:53
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
Definition Domaine_VF.h:418
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
int nb_front_Cl() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Equation_base The role of an equation is the calculation of one or more fields....
virtual const RefObjU & get_modele(Type_modele type) const
Sources & sources()
Returns the source terms associated with the equation.
virtual const Champ_Inc_base & inconnue() const =0
Probleme_base & probleme()
Returns the problem associated with the equation.
Base class for an incompressible fluid and its properties:
Definition Fluide_base.h:36
class Front_VF
Definition Front_VF.h:36
int nb_faces() const
Definition Front_VF.h:53
int num_premiere_face() const
Definition Front_VF.h:63
virtual const Champ_Don_base & conductivite() const
Returns the conductivity of the medium (const version).
Base class for scalar turbulence models coupled to a Navier-Stokes convection-diffusion equation.
const Champ_Fonc_base & conductivite_turbulente() const
const Turbulence_paroi_scal_base & loi_paroi() const
Returns the scalar wall-law turbulence model (const version).
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
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
class Probleme_base It is a Probleme_U that is not a coupling.
virtual const Equation_base & equation(int) const =0
Base class for output streams.
Definition Sortie.h:52
void associer_domaines(const Domaine_dis_base &, const Domaine_Cl_dis_base &) override
DoubleTab & ajouter(DoubleTab &) const override
void completer() override
Updates internal references of the Source_base object.
DoubleTab & calculer(DoubleTab &) const override
void associer_pb(const Probleme_base &) override
const DoubleVect & tab_u_star() const
const DoubleVect & tab_d_plus() const
Source_base A Source_base object is a term appearing on the right-hand side of an.
Definition Source_base.h:42
virtual void completer()
Updates internal references of the Source_base object.
class Sources Sources represents a list of Source objects.
Definition Sources.h:31
const Objet_U & valeur() const
Definition TRUST_Ref.h:134
const DoubleVects & equivalent_distance() const