TrioCFD 1.9.9_beta
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 << " Reading 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 << "Error while reading Traitement_particulier_Brech_VEF" << finl;
106 Cerr << "Possible keywords are: calcul_flux or Richardson " << finl;
107 Cerr << "You read: " << motlu << finl;
108 exit();
109 break;
110 }
111 }
112 }
113 }
114 is >> motlu;
115 if (motlu != accfermee)
116 {
117 Cerr << "Error while reading Traitement_particulier_NS_Brech_VEF 1: ";
118 Cerr << "Expected a } but got " << 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 //we want 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; // because div = -B
159 solveur_pression_.resoudre_systeme(mon_equation->matrice_pression().valeur(),secmem, inc_pre);
160 Cerr <<"inc_pre " << inc_pre << finl;
161}
Class Champ_Inc_base.
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
class Domaine_VDF
Definition Domaine_VDF.h:61
int nb_faces() const
Returns the total number of faces.
Definition Domaine_VF.h:471
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
A character string (Nom) in uppercase.
Definition Motcle.h:26
An array of Motcle objects.
Definition Motcle.h:63
int search(const Motcle &t) const
Definition Motcle.cpp:319
friend class Entree
Definition Objet_U.h:71
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
Operateur_Div Generic class of the hierarchy of operators computing the divergence.
Classe Operateur_Grad Generic class of the hierarchy of operators computing the gradient.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
class SolveurSys A SolveurSys represents any class
Definition SolveurSys.h:32
int resoudre_systeme(const Matrice_Base &matrice, const DoubleVect &secmem, DoubleVect &solution)
Base class for output streams.
Definition Sortie.h:52
Traitement_particulier_NS_Pression_VDF class.
int a_pour_Champ_Fonc(const Motcle &mot, OBS_PTR(Champ_base)&ch_ref) const
OBS_PTR(Navier_Stokes_std) mon_equation