TrioCFD 1.9.9_beta
TrioCFD documentation
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 Completes the boundary conditions.
39 *
40 * Sets d_rho to the constant density of the physical medium of the equation.
41 *
42 */
44{
45 const Milieu_base& mil = mon_dom_cl_dis->equation().milieu();
46 if (sub_type(Champ_Uniforme, mil.masse_volumique()))
47 {
48 const Champ_Uniforme& rho = ref_cast(Champ_Uniforme, mil.masse_volumique());
49 d_rho = rho.valeurs()(0, 0);
50 }
51 else
52 d_rho = -1;
53}
54
55/*! @brief Returns the imposed flux value for the i-th component of the field representing the flux at the boundary.
56 *
57 * The boundary field is considered constant over all elements of the boundary.
58 * The imposed flux value equals the (constant) boundary field value divided by d_rho.
59 *
60 * @param i Index along the first dimension of the field.
61 * @return Imposed value for the specified field component.
62 * @throws Second dimension of the boundary field greater than 1.
63 */
65{
66 const Milieu_base& mil = mon_dom_cl_dis->equation().milieu();
67 const Champ_base& rho = mil.masse_volumique();
68 double rho_;
69 if (d_rho == -1)
70 rho_ = rho.valeurs()(i);
71 else
72 rho_ = d_rho;
73
74 if (le_champ_front->valeurs().size() == 1)
75 return (le_champ_front->valeurs()(0, 0) - Pthn) / rho_;
76 else if (le_champ_front->valeurs().dimension(1) == 1)
77 return (le_champ_front->valeurs()(i, 0) - Pthn) / rho_;
78 else
79 Cerr << "Neumann::flux_impose error" << finl;
80
82 return 0.;
83}
84
85/*! @brief Returns the imposed flux value for the (i,j)-th component of the field representing the flux at the boundary.
86 *
87 * The boundary field is NOT constant over all elements of the boundary.
88 *
89 * @param i Index along the first dimension of the field.
90 * @param j Index along the second dimension of the field.
91 * @return Imposed value for the specified field component.
92 */
94{
95 const Milieu_base& mil = mon_dom_cl_dis->equation().milieu();
96 const Champ_base& rho = mil.masse_volumique();
97 double rho_;
98
99 if (d_rho == -1)
100 rho_ = rho.valeurs()(i);
101 else
102 rho_ = d_rho;
103
104 if (le_champ_front->valeurs().dimension(0) == 1)
105 return (le_champ_front->valeurs()(0, j) - Pthn) / rho_;
106 else
107 return (le_champ_front->valeurs()(i, j) - Pthn) / rho_;
108}
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
virtual DoubleTab & valeurs()=0
Champ_Uniforme Represents a field that is constant in space and time.
class Champ_base This class is the base of the fields hierarchy.
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
Milieu_base This class is the base of the (physical) medium hierarchy.
Definition Milieu_base.h:50
virtual const Equation_base & equation(const std::string &nom_inc) const
virtual const Champ_base & masse_volumique() const
Returns the mass density of the medium (const version).
Neumann_sortie_libre This class represents an open boundary without imposed velocity.
static int dimension
Definition Objet_U.h:94
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
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Open boundary with imposed pressure condition, derived from Neumann_sortie_libre.
double flux_impose(int i) const override
Returns the imposed flux value for the i-th component of the field representing the flux at the bound...
void completer() override
Completes the boundary conditions.
Base class for output streams.
Definition Sortie.h:52