TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Neumann.cpp
1/****************************************************************************
2* Copyright (c) 2025, 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 <Frontiere_dis_base.h>
17#include <Front_VF.h>
18#include <Neumann.h>
19
20Implemente_base(Neumann, "Neumann", Cond_lim_base);
21// XD neumann condlim_base neumann INHERITS_BRACE Neumann condition at the boundary called bord (edge) : 1). For
22// XD_CONT Navier-Stokes equations, constraint imposed at the boundary; 2). For scalar transport equation, flux imposed
23// XD_CONT at the boundary.
24
25Sortie& Neumann::printOn(Sortie& s) const { return s << que_suis_je() << finl; }
26
28
29/*! @brief Renvoie la valeur du flux impose sur la i-eme composante du champ representant le flux a la frontiere.
30 *
31 * @param (int i) indice suivant la premiere dimension du champ
32 * @return (double) la valeur imposee sur la composante du champ specifiee
33 * @throws deuxieme dimension du champ de frontiere superieur a 1
34 */
35double Neumann::flux_impose(int i) const
36{
37 if (le_champ_front->valeurs().size() == 1)
38 return le_champ_front->valeurs()(0, 0);
39 else if (le_champ_front->valeurs().dimension(1) == 1)
40 return le_champ_front->valeurs()(i, 0);
41 else
42 Cerr << "Neumann::flux_impose error" << finl;
44 return 0.;
45}
46
47/*! @brief Renvoie la valeur du flux impose sur la (i,j)-eme composante du champ representant le flux a la frontiere.
48 *
49 * @param (int i) indice suivant la premiere dimension du champ
50 * @param (int j) indice suivant la deuxieme dimension du champ
51 * @return (double) la valeur imposee sur la composante du champ specifiee
52 */
53double Neumann::flux_impose(int i, int j) const
54{
55 if (le_champ_front->valeurs().dimension(0) == 1)
56 return le_champ_front->valeurs()(0, j);
57 else
58 return le_champ_front->valeurs()(i, j);
59}
60
61/*! @brief Updates and returns the imposed flux array.
62 *
63 * This function checks the total number of faces in the boundary and resizes the
64 * `flux_impose_` array if necessary. It updates the values based on the imposed
65 * flux from the front field if the field is unsteady or if the dimensions have changed.
66 *
67 * @return const DoubleTab& Reference to the updated imposed flux array.
68 */
69const DoubleTab& Neumann::flux_impose(bool with_virtual_faces) const
70{
71 const Front_VF& le_bord = ref_cast(Front_VF, frontiere_dis());
72 // ToDo factorize in Champ_front_base::valeurs_face()
73 int size;
74 if (with_virtual_faces)
75 size = le_champ_front->valeurs().dimension(0) == 1 ? le_bord.nb_faces_tot() : le_champ_front->valeurs().dimension_tot(0);
76 else
77 size = le_champ_front->valeurs().dimension(0) == 1 ? le_bord.nb_faces() : le_champ_front->valeurs().dimension(0);
78
79 if (size>0)
80 {
81 bool update = le_champ_front->instationnaire();
82 if (flux_impose_.dimension(0) != size)
83 {
84 int nb_comp = le_champ_front->valeurs().nb_dim() == 1 ? 1 : le_champ_front->valeurs().dimension(1);
85 flux_impose_.resize(size, nb_comp);
86 update = true;
87 }
88 update = true; // Provisoire (ecarts sur Quasi_Comp_Obst_GP_VEF_Pmoy ???)
89 if (update)
90 {
91 int nb_comp = flux_impose_.dimension(1);
92 for (int i = 0; i < size; i++)
93 for (int j = 0; j < nb_comp; j++)
94 flux_impose_(i, j) = flux_impose(i, j);
95 }
96 }
97 return flux_impose_;
98}
99
100
classe Cond_lim_base Classe de base pour la hierarchie des classes qui representent les differentes c...
virtual Frontiere_dis_base & frontiere_dis()
Renvoie la frontiere discretisee a laquelle les conditions aux limites s'appliquent.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Front_VF
Definition Front_VF.h:36
int nb_faces() const
Definition Front_VF.h:53
int nb_faces_tot() const
Definition Front_VF.h:58
Classe Neumann Cette classe est la classe de base de la hierarchie des conditions aux limites de type...
Definition Neumann.h:31
virtual double flux_impose(int i) const
Renvoie la valeur du flux impose sur la i-eme composante du champ representant le flux a la frontiere...
Definition Neumann.cpp:35
DoubleTab flux_impose_
Definition Neumann.h:39
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 de base des flux de sortie.
Definition Sortie.h:52