TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Traitement_particulier_NS_Pression_VEF.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 <Traitement_particulier_NS_Pression_VEF.h>
17#include <Assembleur_base.h>
18#include <Milieu_base.h>
19#include <Domaine_Cl_VEF.h>
20
21Implemente_instanciable_sans_constructeur(Traitement_particulier_NS_Pression_VEF,"Traitement_particulier_NS_Pression_VEF",Traitement_particulier_NS_Pression);
22
26
28{
29 return is;
30}
31
33{
34 return is;
35}
36
38{
39 if (mot == "Pression_porosite") return 1 ;
40 return 0 ;
41}
42
44 OBS_PTR(Champ_base)& ch_ref) const
45{
46 if (mot == "Pression_porosite")
47 {
48 ch_ref = ch_p;
49 return 1 ;
50 }
51 return 0 ;
52}
53
55{
56 Motcle accouverte = "{" , accfermee = "}" ;
57 Motcle motbidon, motlu;
58
59 is >> motbidon ;
60
61 Motcles les_mots(1);
62 {
63 les_mots[0] = "Pression_porosite";
64 }
65
66
67 if (motbidon == accouverte)
68 {
69 // is >> motlu;
70
71 while(motlu != accfermee)
72 {
73 is >> motlu;
74 int rang=les_mots.search(motlu);
75 switch(rang)
76 {
77 case 0 :
78 {
79 Cerr << " Lire Pression_porosite " << finl;
80 const Domaine_dis_base& zdis=mon_equation->inconnue().domaine_dis_base();
81 const Domaine_VEF& domaine_VEF=ref_cast(Domaine_VEF, zdis);
82 // const Probleme_base& pb = mon_equation->probleme();
83 const int nb_elem = domaine_VEF.nb_elem() ;
84
85 ch_p.associer_domaine_dis_base(zdis);
86 ch_p.nommer("Pression_porosite");
87 ch_p.fixer_nb_comp(1);
88 ch_p.fixer_nb_valeurs_nodales(nb_elem);
89 ch_p.fixer_unite("Pa.m3/kg");
90 c_pression = 1 ;
91 champs_compris_.ajoute_champ(ch_p);
92 break ;
93
94 }
95 default :
96 {
97 if (motlu == accfermee)
98 {
99 break ;
100 }
101 else
102 {
103 Cerr << "Erreur dans la lecture de Traitement_particulier_Brech_VEF" << finl;
104 Cerr << "Les mots cles possibles sont : calcul_flux ou Richardson " << finl;
105 Cerr << "Vous avez lu :" << motlu << finl;
106 exit();
107 break;
108 }
109 }
110 }
111 }
112 is >> motlu;
113 if (motlu != accfermee)
114 {
115 Cerr << "Erreur dans la lecture de Traitement_particulier_NS_Brech_VEF 1 ";
116 Cerr << "On attendait une } et pas " << motlu << finl;
117 exit();
118 }
119 }
120
121 return is;
122}
123
124
126{
127
128 if (c_pression == 1 ) post_traitement_particulier_calcul_pression() ;
129
130}
131
132void Traitement_particulier_NS_Pression_VEF::post_traitement_particulier_calcul_pression()
133{
134 const Domaine_VEF& zvef=ref_cast(Domaine_VEF, mon_equation->domaine_dis());
135 const DoubleVect& porosite_face = mon_equation->milieu().porosite_face();
136 int i,comp;
137 int nb_face = zvef.nb_faces();
138 Operateur_Div divergence = mon_equation->operateur_divergence();
139 Operateur_Grad gradient = mon_equation->operateur_gradient();
140 SolveurSys solveur_pression_ = mon_equation->solveur_pression();
141
142 DoubleTab& pression=mon_equation->pression().valeurs();
143 DoubleTab& vitesse=mon_equation->vitesse().valeurs();
144 DoubleTab gradP(vitesse);
145 DoubleTab inc_pre(pression);
146 DoubleTab secmem(pression);
147 DoubleTab grad_temp(vitesse);
148
149 inc_pre = 0. ;
150 secmem = 0. ;
151 gradP = 0. ;
152 grad_temp = 0. ;
153
154 gradient.calculer(mon_equation->pression().valeurs(),gradP);
155
156 //on veut BM-1Bt(psi*Pression)
157 mon_equation->solv_masse().appliquer(gradP);
158
159 for(i=0; i<nb_face; i++)
160 {
161 for (comp=0; comp<dimension; comp++)
162 grad_temp(i,comp) = gradP(i,comp)/porosite_face(i);
163
164 }
165 //mon_equation->solv_masse().appliquer(grad_temp);
166 divergence.calculer(grad_temp, secmem);
167
168 secmem *= -1; // car div =-B
169 // Correction du second membre d'apres les conditions aux limites :
170 mon_equation->assembleur_pression()->modifier_secmem(secmem);
171
172 //solveur_pression_.resoudre_systeme(mon_equation->matrice_pression().valeur(),secmem, inc_pre,mon_equation->pression());
173 solveur_pression_.resoudre_systeme(mon_equation->matrice_pression().valeur(),secmem, inc_pre);
174 DoubleVect& la_pression_porosite = ch_p.valeurs();
175 la_pression_porosite = pression;
176 // Cerr << " la_pression_porosite = pression " << la_pression_porosite << finl;
177 // Cerr << " inc_pre " << inc_pre << finl;
178 la_pression_porosite += inc_pre;
179}
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
class Domaine_VEF
Definition Domaine_VEF.h:54
int nb_faces() const
renvoie le nombre global de faces.
Definition Domaine_VF.h:471
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
Un tableau d'objets de la classe Motcle.
Definition Motcle.h:63
int search(const Motcle &t) const
Definition Motcle.cpp:321
friend class Entree
Definition Objet_U.h:76
static int dimension
Definition Objet_U.h:99
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
classe Operateur_Div Classe generique de la hierarchie des operateurs calculant la divergence
Classe Operateur_Grad Classe generique de la hierarchie des operateurs calculant le gradient.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
class SolveurSys Un SolveurSys represente n'importe qu'elle classe
Definition SolveurSys.h:32
int resoudre_systeme(const Matrice_Base &matrice, const DoubleVect &secmem, DoubleVect &solution)
Classe de base des flux de sortie.
Definition Sortie.h:52
classe Traitement_particulier_NS_Pression_VEF Cette classe permet de faire les traitements particulie...
int a_pour_Champ_Fonc(const Motcle &mot, OBS_PTR(Champ_base)&ch_ref) const
OBS_PTR(Navier_Stokes_std) mon_equation