TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Sortie_libre_Gradient_Pression_impose_VEFPreP1B.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 <Sortie_libre_Gradient_Pression_impose_VEFPreP1B.h>
17#include <Domaine_Cl_dis_base.h>
18#include <Champ_P1_isoP1Bulle.h>
19#include <Navier_Stokes_std.h>
20#include <distances_VEF.h>
21#include <Milieu_base.h>
22#include <Scatter.h>
23#include <Debog.h>
24
25Implemente_instanciable(Sortie_libre_Gradient_Pression_impose_VEFPreP1B, "Frontiere_ouverte_Gradient_Pression_impose_VEFPreP1B", Sortie_libre_Gradient_Pression_impose_VEF);
26// XD frontiere_ouverte_gradient_pression_impose_vefprep1b frontiere_ouverte_gradient_pression_impose frontiere_ouverte_gradient_pression_impose_vefprep1b INHERITS_BRACE Keyword for an outlet boundary condition in VEF P1B/P1NC on the gradient of the pressure.
27
28
30
32{
33 if (supp_discs.size() == 0) supp_discs = { Nom("VEFPreP1B") };
35}
36
38{
40 const Domaine_Cl_dis_base& le_dom_Cl = domaine_Cl_dis();
41 const Equation_base& eqn = le_dom_Cl.equation();
42 const Navier_Stokes_std& eqn_hydr = ref_cast(Navier_Stokes_std, eqn);
43 const Champ_P1_isoP1Bulle& pression = ref_cast(Champ_P1_isoP1Bulle, eqn_hydr.pression());
44 const Domaine_VEF& mon_dom_VEF = ref_cast(Domaine_VEF, eqn.domaine_dis());
45 const IntTab& face_voisins = mon_dom_VEF.face_voisins();
46 const Front_VF& le_bord = ref_cast(Front_VF, frontiere_dis());
47 pression_interne = pression;
48 int nb_faces_loc = le_bord.nb_faces_tot();
49 trace_pression_int.resize(nb_faces_loc);
50 coeff.resize(nb_faces_loc);
51 for (int ind_face = 0; ind_face < nb_faces_loc; ind_face++)
52 {
53 int face = le_bord.num_face(ind_face);
54 int elem = face_voisins(face, 0);
55 if (dimension == 2)
56 coeff[ind_face] = distance_2D(face, elem, mon_dom_VEF) * 3.;
57 else
58 coeff[ind_face] = distance_3D(face, elem, mon_dom_VEF) * 4.;
59 }
60 // We do not call mettre_a_jour because the update of champ_front could depend on external factors!
62}
63
65{
68 {
69 Cerr << "Error in Sortie_libre_Gradient_Pression_impose_VEFPreP1B::mettre_a_jour" << finl;
70 exit();
71 }
72}
73
74// Returns 1 if OK, 0 otherwise.
76{
77 if (!pression_interne)
78 {
79 Cerr << "Sortie_libre_Gradient_Pression_impose_VEFPreP1B::calculer_trace_pression() : pressure is not defined!" << finl;
80 return 0;
81 }
82 Debog::verifier("pression_interne:", pression_interne);
83 const Front_VF& le_bord = ref_cast(Front_VF, frontiere_dis());
84 int nb_faces_loc = le_bord.nb_faces_tot();
85 for (int ind_face = 0; ind_face < nb_faces_loc; ind_face++)
86 {
87 int face = le_bord.num_face(ind_face);
88 trace_pression_int[ind_face] = pression_interne->valeur_au_bord(face);
89 }
90 return 1;
91}
std::vector< Nom > supp_discs
virtual void mettre_a_jour(double temps)
Performs a time update of the boundary condition.
Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the domain of discretized boundary conditions to which the object belongs.
virtual int initialiser(double temps)
Initialization at the beginning of the calculation.
virtual Frontiere_dis_base & frontiere_dis()
Returns the discretized boundary to which the boundary conditions apply.
static void verifier(const char *const msg, double)
Definition Debog.cpp:21
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class Domaine_VEF
Definition Domaine_VEF.h:53
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
Definition Domaine_VF.h:418
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....
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
class Front_VF
Definition Front_VF.h:36
int nb_faces_tot() const
Definition Front_VF.h:58
int num_face(const int) const
Definition Front_VF.h:68
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
Navier_Stokes_std This class carries the terms of the momentum equation.
Champ_Inc_base & pression()
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
int initialiser(double temps) override
Initialization at the beginning of the calculation.
void mettre_a_jour(double) override
Performs a time update of the boundary condition.
Base class for output streams.
Definition Sortie.h:52