TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Terme_Puissance_Thermique.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 <Terme_Puissance_Thermique.h>
17#include <Probleme_base.h>
18#include <Milieu_base.h>
19
20#include <Equation_base.h>
21#include <Champ_Uniforme.h>
22#include <Champ_Fonc_Tabule.h>
23#include <Discretisation_base.h>
24#include <Champ_val_tot_sur_vol_base.h>
25
26// XD puissance_thermique source_base puissance_thermique NO_BRACE Class to define a source term corresponding to a
27// XD_CONT volume power release in the energy equation.
28// XD attr ch field_base ch REQ Thermal power field type. To impose a volume power on a domain sub-area, the
29// XD_CONT Champ_Uniforme_Morceaux (partly_uniform_field) type must be used. NL2 Warning : The volume thermal power is
30// XD_CONT expressed in W.m-3 in 3D (in W.m-2 in 2D). It is a power per volume unit (in a porous media, it is a power
31// XD_CONT per fluid volume unit).
32
33/*! @brief Reads the thermal power term from an input stream and an equation, possibly using the discretisation to type la_puissance.
34 *
35 * Reads only the prescribed field representing la_puissance.
36 *
37 * @param is An input stream.
38 * @param eqn The equation owning this source term.
39 */
41{
42 Cerr << "Reading Power Field" << finl;
43
44 Motcle type;
45 is >> type;
46 if (type=="Valeur_totale_sur_volume")
47 {
48 if (eqn.discretisation().is_vdf())
49 type += "_VDF";
50 else if (eqn.discretisation().is_vef())
51 type += "_VEF";
52 }
53 la_puissance_lu.typer(type);
54 Champ_Don_base& ch_puissance_lu = ref_cast(Champ_Don_base,la_puissance_lu.valeur());
55 is >> ch_puissance_lu;
56 const int nb_comp = ch_puissance_lu.nb_comp();
57
58 eqn.probleme().discretisation().discretiser_champ((eqn.discretisation().is_poly_family() || eqn.discretisation().is_dg()) ? "temperature" : "champ_elem", eqn.domaine_dis(), "pp", "1",nb_comp,0., la_puissance);
59 la_puissance_lu->fixer_nb_comp(nb_comp);
60 if (ch_puissance_lu.le_nom()=="anonyme") ch_puissance_lu.nommer("Puissance_volumique");
61
62 for (int n = 0; n < nb_comp; n++) la_puissance_lu->fixer_nom_compo(n, ch_puissance_lu.le_nom() + (nb_comp > 1 ? Nom(n) :""));
63 for (int n = 0; n < nb_comp; n++) la_puissance->fixer_nom_compo(n, ch_puissance_lu.le_nom() + (nb_comp > 1 ? Nom(n) :""));
64 // PL: nommer_completer_champ_physique must be called on both fields (otherwise crashes with Champ_fonc_tabule power)
65 eqn.discretisation().nommer_completer_champ_physique(eqn.domaine_dis(),ch_puissance_lu.le_nom(),"W/m3",la_puissance_lu,eqn.probleme());
67 la_puissance->valeurs() = 0;
68 la_puissance->affecter(ch_puissance_lu);
69}
70
72{
73 if (sub_type(Champ_val_tot_sur_vol_base,la_puissance_lu.valeur()))
74 {
75 const Domaine_dis_base& zdis = eqn.domaine_dis();
76 const Domaine_Cl_dis_base& zcldis = eqn.domaine_Cl_dis();
77 Champ_val_tot_sur_vol_base& champ_puis = ref_cast(Champ_val_tot_sur_vol_base,la_puissance_lu.valeur());
78 champ_puis.evaluer(zdis,zcldis);
79 }
80}
81
83{
84 la_puissance_lu->mettre_a_jour(temps);
85 la_puissance->affecter(la_puissance_lu.valeur());
86}
87
89{
90 mettre_a_jour(temps);
91}
92
94{
95 if (la_puissance->le_nom()!="Puissance_volumique")
96 {
97 fichier+="_";
98 fichier+=la_puissance->le_nom();
99 }
100}
class Champ_Don_base base class of Given Fields (not calculated)
Champ_val_tot_sur_vol_base Base class derived from Champ_Uniforme_Morceaux representing fields.
void evaluer(const Domaine_dis_base &zdis, const Domaine_Cl_dis_base &zcldis)
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
virtual bool is_poly_family() const
virtual bool is_dg() const
virtual bool is_vdf() const
virtual bool is_vef() const
void discretiser_champ(const Motcle &directive, const Domaine_dis_base &z, const Nom &nom, const Nom &unite, int nb_comp, int nb_pas_dt, double temps, OWN_PTR(Champ_Inc_base)&champ, const Nom &sous_type=NOM_VIDE) const
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
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....
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.
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.
void nommer(const Nom &) override
Gives a name to the field.
virtual int nb_comp() const
Definition Field_base.h:56
A character string (Nom) in uppercase.
Definition Motcle.h:26
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
const Discretisation_base & discretisation() const
Returns the discretization associated with the problem.
void initialiser_champ_puissance(const Equation_base &eqn)
void lire_donnees(Entree &, const Equation_base &eqn)
Reads the thermal power term from an input stream and an equation, possibly using the discretisation ...