TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Sortie_libre_pression_imposee_QC.cpp
1/****************************************************************************
2* Copyright (c) 2024, 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 <Sortie_libre_pression_imposee_QC.h>
17#include <Champ_Uniforme.h>
18#include <Equation_base.h>
19#include <Milieu_base.h>
20#include <Motcle.h>
21
22Implemente_instanciable_sans_constructeur(Sortie_libre_pression_imposee_QC, "Frontiere_ouverte_pression_totale_imposee", Neumann_sortie_libre);
23
25
26Sortie& Sortie_libre_pression_imposee_QC::printOn(Sortie& s) const { return s << que_suis_je() << finl; }
27
29{
30 if (app_domains.size() == 0) app_domains = { Motcle("Hydraulique"), Motcle("indetermine") };
31
32 s >> le_champ_front;
33 le_champ_ext.typer("Champ_front_uniforme");
34 le_champ_ext->valeurs().resize(1, dimension);
35 return s;
36}
37
38/*! @brief Complete les conditions aux limites.
39 *
40 * Impose la masse volumique constante du milieu
41 * physique de l'equation a d_rho.
42 *
43 */
45{
46 const Milieu_base& mil = mon_dom_cl_dis->equation().milieu();
47 if (sub_type(Champ_Uniforme, mil.masse_volumique()))
48 {
49 const Champ_Uniforme& rho = ref_cast(Champ_Uniforme, mil.masse_volumique());
50 d_rho = rho.valeurs()(0, 0);
51 }
52 else
53 d_rho = -1;
54}
55
56/*! @brief Renvoie la valeur du flux impose sur la i-eme composante du champ representant le flux a la frontiere.
57 *
58 * Le champ a la frontiere est considere constant sur tous
59 * les elements de la frontiere.
60 * La valeur du flux impose a la frontiere est egale
61 * a la valeur du champ (considere constant) a la frontiere divise par d_rho.
62 *
63 * @param (int i) indice suivant la premiere dimension du champ
64 * @return (double) la valeur imposee sur la composante du champ specifiee
65 * @throws deuxieme dimension du champ de frontiere superieur a 1
66 */
68{
69 const Milieu_base& mil = mon_dom_cl_dis->equation().milieu();
70 const Champ_base& rho = mil.masse_volumique();
71 double rho_;
72 if (d_rho == -1)
73 rho_ = rho.valeurs()(i);
74 else
75 rho_ = d_rho;
76
77 if (le_champ_front->valeurs().size() == 1)
78 return (le_champ_front->valeurs()(0, 0) - Pthn) / rho_;
79 else if (le_champ_front->valeurs().dimension(1) == 1)
80 return (le_champ_front->valeurs()(i, 0) - Pthn) / rho_;
81 else
82 Cerr << "Neumann::flux_impose erreur" << finl;
83
85 return 0.;
86}
87
88/*! @brief Renvoie la valeur du flux impose sur la (i,j)-eme composante du champ representant le flux a la frontiere.
89 *
90 * Le champ a la frontiere n'est PAS constant sur tous les elements
91 * la frontiere.
92 *
93 * @param (int i) indice suivant la premiere dimension du champ
94 * @param (int j) indice suivant la deuxieme dimension du champ
95 * @return (double) la valeur imposee sur la composante du champ specifiee
96 */
98{
99 const Milieu_base& mil = mon_dom_cl_dis->equation().milieu();
100 const Champ_base& rho = mil.masse_volumique();
101 double rho_;
102
103 if (d_rho == -1)
104 rho_ = rho.valeurs()(i);
105 else
106 rho_ = d_rho;
107
108 if (le_champ_front->valeurs().dimension(0) == 1)
109 return (le_champ_front->valeurs()(0, j) - Pthn) / rho_;
110 else
111 return (le_champ_front->valeurs()(i, j) - Pthn) / rho_;
112}
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
virtual DoubleTab & valeurs()=0
classe Champ_Uniforme Represente un champ constant dans l'espace et dans le temps.
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
std::vector< Motcle > app_domains
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual const Milieu_base & milieu() const =0
classe Milieu_base Cette classe est la base de la hierarchie des milieux (physiques)
Definition Milieu_base.h:50
virtual const Equation_base & equation(const std::string &nom_inc) const
virtual const Champ_base & masse_volumique() const
Renvoie la masse volumique du milieu.
classe Neumann_sortie_libre Cette classe represente une frontiere ouverte sans vitesse imposee
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
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
classe Sortie_libre_pression_imposee Cette classe derive de Neumann_sortie_libre
double flux_impose(int i) const override
Renvoie la valeur du flux impose sur la i-eme composante du champ representant le flux a la frontiere...
void completer() override
Complete les conditions aux limites.
Classe de base des flux de sortie.
Definition Sortie.h:52