TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Traitement_particulier_NS_Pression_VDF.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_VDF.h>
17#include <Navier_Stokes_std.h>
18#include <Milieu_base.h>
19#include <Domaine_Cl_VDF.h>
20#include <TRUSTTrav.h>
21#include <Domaine_VDF.h>
22
23Implemente_instanciable_sans_constructeur(Traitement_particulier_NS_Pression_VDF,"Traitement_particulier_NS_Pression_VDF",Traitement_particulier_NS_Pression);
24
28
30{
31 return is;
32}
33
35{
36 return is;
37}
38
40{
41 if (mot == "Pression_porosite") return 1 ;
42 return 0 ;
43}
44
46 OBS_PTR(Champ_base)& ch_ref) const
47{
48 if (mot == "Pression_porosite")
49 {
50 ch_ref = ch_p;
51 return 1 ;
52 }
53 return 0 ;
54}
55
57{
58 Motcle accouverte = "{" , accfermee = "}" ;
59 Motcle motbidon, motlu;
60
61 is >> motbidon ;
62
63 Motcles les_mots(1);
64 {
65 les_mots[0] = "Pression_porosite";
66 }
67
68
69 if (motbidon == accouverte)
70 {
71 // is >> motlu;
72
73 while(motlu != accfermee)
74 {
75 is >> motlu;
76 int rang=les_mots.search(motlu);
77 switch(rang)
78 {
79 case 0 :
80 {
81 Cerr << " Lire Pression_porosite " << finl;
82 const Domaine_dis_base& zdis=mon_equation->inconnue().domaine_dis_base();
83 const Domaine_VDF& domaine_VDF=ref_cast(Domaine_VDF, zdis);
84 // const Probleme_base& pb = mon_equation->probleme();
85 const int nb_elem = domaine_VDF.nb_elem() ;
86
87 ch_p.associer_domaine_dis_base(zdis);
88 ch_p.nommer("Pression_porosite");
89 ch_p.fixer_nb_comp(1);
90 ch_p.fixer_nb_valeurs_nodales(nb_elem);
91 ch_p.fixer_unite("Pa.m3/kg");
92 c_pression = 1 ;
93 champs_compris_.ajoute_champ(ch_p);
94 break ;
95
96 }
97 default :
98 {
99 if (motlu == accfermee)
100 {
101 break ;
102 }
103 else
104 {
105 Cerr << "Erreur dans la lecture de Traitement_particulier_Brech_VEF" << finl;
106 Cerr << "Les mots cles possibles sont : calcul_flux ou Richardson " << finl;
107 Cerr << "Vous avez lu :" << motlu << finl;
108 exit();
109 break;
110 }
111 }
112 }
113 }
114 is >> motlu;
115 if (motlu != accfermee)
116 {
117 Cerr << "Erreur dans la lecture de Traitement_particulier_NS_Brech_VEF 1 ";
118 Cerr << "On attendait une } et pas " << motlu << finl;
119 exit();
120 }
121 }
122
123 return is;
124}
125
126
128{
129 if (c_pression == 1 ) post_traitement_particulier_calcul_pression();
130}
131
132void Traitement_particulier_NS_Pression_VDF::post_traitement_particulier_calcul_pression()
133{
134 const Domaine_VDF& zvdf=ref_cast(Domaine_VDF, mon_equation->domaine_dis());
135 const DoubleVect& porosite_face = mon_equation->milieu().porosite_face();
136 int i;
137 int nb_face = zvdf.nb_faces();
138 OWN_PTR(Champ_Inc_base) gradient_P = mon_equation->grad_P();
139
140 Operateur_Div divergence = mon_equation->operateur_divergence();
141 Operateur_Grad gradient = mon_equation->operateur_gradient();
142 SolveurSys solveur_pression_ = mon_equation->solveur_pression();
143
144 DoubleTab& pression=mon_equation->pression().valeurs();
145 DoubleTrav inc_pre(pression);
146 DoubleTrav secmem(pression);
147 gradient.calculer(mon_equation->pression().valeurs(),gradient_P->valeurs());
148
149 //on veut BM-1Bt(spi*Pression)
150 DoubleTab& grad=gradient_P->valeurs();
151 mon_equation->solv_masse().appliquer(grad);
152 DoubleTab& grad_temp = grad;
153 for(i=0; i<nb_face; i++)
154 {
155 grad_temp(i) /=porosite_face(i);
156 }
157 divergence.calculer(grad_temp, secmem);
158 secmem *= -1; // car div =-B
159 solveur_pression_.resoudre_systeme(mon_equation->matrice_pression().valeur(),secmem, inc_pre);
160 Cerr <<"inc_pre " << inc_pre << finl;
161}
Classe Champ_Inc_base.
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
class Domaine_VDF
Definition Domaine_VDF.h:64
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
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_VDF 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