TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Frontiere_ouverte_rho_u_impose.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_ouverte_rho_u_impose.h>
17#include <Fluide_Dilatable_base.h>
18#include <Frontiere_dis_base.h>
19#include <Equation_base.h>
20
21Implemente_instanciable(Frontiere_ouverte_rho_u_impose, "Frontiere_ouverte_rho_u_impose", Entree_fluide_vitesse_imposee_libre);
22// XD frontiere_ouverte_rho_u_impose frontiere_ouverte_vitesse_imposee_sortie frontiere_ouverte_rho_u_impose INHERITS_BRACE This keyword is used to designate a condition of imposed mass rate at an open boundary called bord (edge). The imposed mass rate field at the inlet is vectorial and the imposed velocity values are expressed in kg.s-1. This boundary condition can be used only with the Quasi compressible model.
23
24
25Sortie& Frontiere_ouverte_rho_u_impose::printOn(Sortie& s) const { return s << que_suis_je() << finl; }
26
28
30{
31 le_fluide = ref_cast(Fluide_Dilatable_base, mon_dom_cl_dis->equation().milieu());
32}
33
35{
36 if (!sub_type(Fluide_Dilatable_base, mon_dom_cl_dis->equation().milieu()))
37 {
38 Cerr << "The boundary condition Frontiere_ouverte_rho_u_impose is only applicable for dialtable fluids and not a fluid of type " << mon_dom_cl_dis->equation().milieu().que_suis_je() << finl;
40 }
41
43}
44
45double Frontiere_ouverte_rho_u_impose::val_imp_au_temps(double temps, int i) const
46{
47 Cerr << "Acces a une condition limite en rho.u sans preciser la composante" << finl;
49 return 0;
50}
51
52double Frontiere_ouverte_rho_u_impose::val_imp_au_temps(double temps, int i, int j) const
53{
54 double rho_u;
55 int ndeb = le_champ_front->frontiere_dis().frontiere().num_premiere_face();
56 const DoubleTab& tab_rho_u = le_champ_front->valeurs_au_temps(temps);
57 assert(tab_rho_u.nb_dim() == 2);
58
59 if (tab_rho_u.dimension(0) == 1)
60 rho_u = tab_rho_u(0, j);
61 else
62 rho_u = tab_rho_u(i, j);
63
64 double rho = le_fluide->rho_face_np1()(i + ndeb);
65 return rho_u / rho;
66}
67
68const DoubleTab& Frontiere_ouverte_rho_u_impose::tab_val_imp(double temps) const
69{
70 if (temps==DMAXFLOAT) temps = le_champ_front->get_temps_defaut();
71 const Front_VF& le_bord = ref_cast(Front_VF, frontiere_dis());
72 // ToDo factorize in Champ_front_base::valeurs_face()
73 int size = le_champ_front->valeurs().dimension(0) == 1 ? le_bord.nb_faces_tot() : le_champ_front->valeurs().dimension_tot(0);
74 if (size>0)
75 {
76 bool update = le_champ_front->instationnaire();
77 if (tab_.dimension(0) != size)
78 {
79 tab_.resize(size, le_champ_front->valeurs().dimension(1));
80 update = true;
81 }
82 update = true; // Provisoire
83 if (update)
84 {
85 int ndeb = le_champ_front->frontiere_dis().frontiere().num_premiere_face();
86 int nb_comp = tab_.dimension(1);
87 CDoubleTabView rho_u = le_champ_front->valeurs_au_temps(temps).view_ro();
88 CDoubleArrView rho_face_np1 = static_cast<const ArrOfDouble&>(le_fluide->rho_face_np1()).view_ro();
89 DoubleTabView tab = tab_.view_wo();
90 bool uniform = (int)rho_u.extent(0) == 1;
91 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), size, KOKKOS_LAMBDA (const int face)
92 {
93 for (int comp = 0; comp < nb_comp; comp++)
94 tab(face, comp) = rho_u(uniform ? 0 : face, comp) / rho_face_np1(face + ndeb);
95 });
96 end_gpu_timer(__KERNEL_NAME__);
97 }
98 }
99 return tab_;
100}
101
virtual int compatible_avec_eqn(const Equation_base &) const
virtual Frontiere_dis_base & frontiere_dis()
Renvoie la frontiere discretisee a laquelle les conditions aux limites s'appliquent.
DoubleTab tab_
Definition Dirichlet.h:42
classe Entree_fluide_vitesse_imposee_libre Cas particulier de la classe Entree_fluide_vitesse_imposee...
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
virtual const Milieu_base & milieu() const =0
classe Fluide_Dilatable_base Cette classe represente un d'un fluide dilatable,
class Front_VF
Definition Front_VF.h:36
int nb_faces_tot() const
Definition Front_VF.h:58
Frontiere ouverte sur laquelle on impose le flux massique rho.
void completer() override
NE FAIT RIEN A surcharger dans les classes derivees.
const DoubleTab & tab_val_imp(double temps=DMAXFLOAT) const override
double val_imp_au_temps(double temps, int i) const override
Renvoie la valeur imposee sur la i-eme composante du champ a la frontiere au temps precise.
int compatible_avec_eqn(const Equation_base &) const override
virtual const Equation_base & equation(const std::string &nom_inc) const
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
int nb_dim() const
Definition TRUSTTab.h:199
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133