TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Pb_Hydraulique_Concentration.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 <Pb_Hydraulique_Concentration.h>
17#include <Fluide_Incompressible.h>
18#include <Constituant.h>
19#include <Verif_Cl.h>
20
21Implemente_instanciable(Pb_Hydraulique_Concentration,"Pb_Hydraulique_Concentration",Pb_Fluide_base);
22// XD pb_hydraulique_concentration Pb_base pb_hydraulique_concentration INHERITS_BRACE Resolution of
23// XD_CONT Navier-Stokes/multiple constituent transport equations.
24// XD attr fluide_incompressible fluide_incompressible fluide_incompressible REQ The fluid medium associated with the
25// XD_CONT problem.
26// XD attr constituant constituant constituant OPT Constituents.
27// XD attr navier_stokes_standard navier_stokes_standard navier_stokes_standard OPT Navier-Stokes equations.
28// XD attr convection_diffusion_concentration convection_diffusion_concentration convection_diffusion_concentration OPT
29// XD_CONT Constituent transport vectorial equation (concentration diffusion convection).
30
31/*! @brief Simple call to: Pb_Fluide_base::printOn(Sortie&) Writes the problem to an output stream.
32 *
33 * @param os an output stream
34 * @return the modified output stream
35 */
37{
38 return Pb_Fluide_base::printOn(os);
39}
40
41
42/*! @brief Simple call to: Pb_Fluide_base::readOn(Entree&) Reads the problem from an input stream.
43 *
44 * @param is an input stream
45 * @return the modified input stream
46 */
48{
49 return Pb_Fluide_base::readOn(is);
50}
51
52/*! @brief Returns the number of equations. Returns 2 since a hydraulic problem with transport has 2 equations:
53 *
54 * - the Navier-Stokes equation
55 * - a convection-diffusion equation (possibly vectorial)
56 *
57 * @return the number of equations
58 */
60{
61 return 2;
62}
63
64/*! @brief Returns the hydraulic equation of type Navier_Stokes_std if i=0, returns the convection-diffusion equation of type
65 *
66 * Convection_Diffusion_Concentration if i=1
67 * (the convection-diffusion equation may be vectorial)
68 * (const version)
69 *
70 * @param i the index of the equation to return
71 * @return the equation corresponding to the index
72 */
74{
75 if ( !( i==0 || i==1 ) )
76 {
77 Cerr << "\nError in Pb_Hydraulique_Concentration::equation() : Wrong number of equation !" << finl;
79 }
80 if (i == 0)
81 return eq_hydraulique;
82 else
83 return eq_concentration;
84}
85
86/*! @brief Returns the hydraulic equation of type Navier_Stokes_std if i=0, returns the convection-diffusion equation of type
87 *
88 * Convection_Diffusion_Concentration if i=1
89 * (the convection-diffusion equation may be vectorial)
90 *
91 * @param i the index of the equation to return
92 * @return the equation corresponding to the index
93 */
95{
96 if ( !( i==0 || i==1 ) )
97 {
98 Cerr << "\nError in Pb_Hydraulique_Concentration::equation() : Wrong number of equation !" << finl;
100 }
101 if (i == 0)
102 return eq_hydraulique;
103 else
104 return eq_concentration;
105}
106
107
108/*! @brief Associates a medium to the problem. If the medium is of type:
109 *
110 * - Fluide_Incompressible, it will be associated with the hydraulic equation
111 * - Constituant, it will be associated with the convection-diffusion equation
112 * Any other medium type causes an error.
113 *
114 * @param mil the physical medium to associate with the problem
115 * @throws wrong type of physical medium
116 */
118{
119 if ( sub_type(Fluide_Incompressible,mil) )
120 eq_hydraulique.associer_milieu_base(mil);
121 else if ( sub_type(Constituant,mil) )
122 eq_concentration.associer_milieu_base(mil);
123 else
124 {
125 Cerr << "A medium of type " << mil.que_suis_je() << " cannot be associated with " << finl;
126 Cerr << "a problem of type Pb_Hydraulique_Concentration " << finl;
127 exit();
128 }
129}
130
131
132/*! @brief Tests the compatibility of the convection-diffusion and hydraulic equations.
133 *
134 * The test is performed on the discretized boundary conditions of each equation.
135 * Calls the library function:
136 * tester_compatibilite_hydr_concentration(const Domaine_Cl_dis_base&,const Domaine_Cl_dis_base&)
137 *
138 * @return propagated return code
139 */
141{
142 const Domaine_Cl_dis_base& domaine_Cl_hydr = eq_hydraulique.domaine_Cl_dis();
143 const Domaine_Cl_dis_base& domaine_Cl_co = eq_concentration.domaine_Cl_dis();
144 return tester_compatibilite_hydr_concentration(domaine_Cl_hydr,domaine_Cl_co);
145}
Represents the constituent(s) of a fluid.
Definition Constituant.h:30
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
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....
Represents an incompressible fluid and its properties:
Milieu_base This class is the base of the (physical) medium hierarchy.
Definition Milieu_base.h:50
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
Pb_Fluide_base This class provides a base class for.
Classe Pb_Hydraulique_Concentration This class represents a hydraulic problem with transport.
void associer_milieu_base(const Milieu_base &) override
Associates a medium to the problem. If the medium is of type:
const Equation_base & equation(int) const override
Returns the hydraulic equation of type Navier_Stokes_std if i=0, returns the convection-diffusion equ...
int nombre_d_equations() const override
Returns the number of equations. Returns 2 since a hydraulic problem with transport has 2 equations:
Convection_Diffusion_Concentration eq_concentration
int verifier() override
Tests the compatibility of the convection-diffusion and hydraulic equations.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52