TRUST 1.9.8
HPC thermohydraulic platform
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 Lit le terme de puissance thermique a partir d'un flot d'entree et d une equation pour eventuellement
34 *
35 * acceder a la discretisation afin de typer la_puissance.
36 * Lit uniquement un champ donne representant la_puissance.
37 *
38 * @param (Entree& is) un flot d'entree
39 */
41{
42 Cerr << "Lecture du Champ Puissance" << 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: Il faut faire nommer_completer_champ_physique les 2 champs (plantage sinon pour une puissance de type Champ_fonc_tabule)
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}
classe Champ_Don_base classe de base des Champs donnes (non calcules)
classe Champ_val_tot_sur_vol_base Classe de base derivee de Champ_Uniforme_Morceaux qui represente le...
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
classe Domaine_Cl_dis_base Les objets Domaine_Cl_dis_base representent les conditions aux limites
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
const Discretisation_base & discretisation() const
Renvoie la discretisation associee a l'equation.
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Renvoie le domaine des conditions aux limite discretisee associee a l'equation.
Probleme_base & probleme()
Renvoie le probleme associe a l'equation.
Domaine_dis_base & domaine_dis()
Renvoie le domaine discretise associe a l'equation.
const Nom & le_nom() const override
Renvoie le nom du champ.
void nommer(const Nom &) override
Donne un nom au champ.
virtual int nb_comp() const
Definition Field_base.h:56
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
const Discretisation_base & discretisation() const
Renvoie la discretisation associee au probleme.
void initialiser_champ_puissance(const Equation_base &eqn)
void lire_donnees(Entree &, const Equation_base &eqn)
Lit le terme de puissance thermique a partir d'un flot d'entree et d une equation pour eventuellement...