TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Loi_Etat_TPPI_WC_base.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 <Fluide_Weakly_Compressible.h>
17#include <Loi_Etat_TPPI_WC_base.h>
18#include <Champ_Uniforme.h>
19#include <Domaine_VF.h>
20
21
22Implemente_base(Loi_Etat_TPPI_WC_base, "Loi_Etat_TPPI_WC_base", Loi_Etat_TPPI_base);
23
24Sortie& Loi_Etat_TPPI_WC_base::printOn(Sortie& os) const { return os << que_suis_je() << finl; }
26
27// Dans l'ordre on fait ca
28//
29// calculer_Cp();
30// calculer_mu();
31// calculer_lambda();
32// calculer_nu();
33// calculer_alpha();
34// calculer_mu_sur_Sc();
35// calculer_nu_sur_Sc();
37{
38 Fluide_Weakly_Compressible& FWC = ref_cast(Fluide_Weakly_Compressible,le_fluide.valeur());
39 const DoubleTab& pres = FWC.pression_th_tab(), &tab_ICh = le_fluide->inco_chaleur().valeurs();
40 SpanD temp_span = tab_ICh.get_span(), p_span = pres.get_span();
41
42 /* Step 2 : Mu */
43 Champ_Don_base& mu = le_fluide->viscosite_dynamique();
44 DoubleTab& tab_mu = mu.valeurs();
45 TPPI_->tppi_get_mu_pT(p_span, temp_span, tab_mu.get_span());
47 mu.mettre_a_jour(temperature_->temps());
48
49 /* Step 3 : Lambda */
50 Champ_Don_base& lambda = le_fluide->conductivite();
51 DoubleTab& tab_lambda = lambda.valeurs();
52 TPPI_->tppi_get_lambda_pT(p_span, temp_span, tab_lambda.get_span());
53 tab_lambda.echange_espace_virtuel();
54
55 /* Step 4 : Alpha */
56 Champ_Don_base& alpha = le_fluide->diffusivite();
57 DoubleTab& tab_alpha = alpha.valeurs();
58 const DoubleTab& tab_rho = le_fluide->masse_volumique().valeurs();
59
60 const bool isVDF = (alpha.que_suis_je() == "Champ_Fonc_P0_VDF") ? true : false;
61
62 if (isVDF)
63 for (int i = 0; i < tab_alpha.dimension(0); i++)
64 tab_alpha(i, 0) = tab_lambda(i, 0) / (tab_rho(i, 0) * Cp_);
65 else
66 {
67 const IntTab& elem_faces = ref_cast(Domaine_VF, le_fluide->vitesse().domaine_dis_base()).elem_faces();
68 const int nfe = elem_faces.line_size();
69 for (int i = 0; i < tab_alpha.dimension(0); i++)
70 {
71 double rhoelem = 0.;
72 for (int face = 0; face < nfe; face++)
73 rhoelem += tab_rho(elem_faces(i, face), 0);
74 rhoelem /= nfe;
75 tab_alpha(i, 0) = tab_lambda(i, 0) / (rhoelem * Cp_);
76 }
77 }
78 tab_alpha.echange_espace_virtuel();
79}
80
82{
83 Fluide_Weakly_Compressible& FWC = ref_cast(Fluide_Weakly_Compressible,le_fluide.valeur());
84 const DoubleTab& pres = FWC.pression_th_tab(), &tab_ICh = le_fluide->inco_chaleur().valeurs();
85 DoubleTab& tab_rho = le_fluide->masse_volumique().valeurs();
86 SpanD temp_span = tab_ICh.get_span(), p_span = pres.get_span(), rho_span = tab_rho_np1.get_span();
87 TPPI_->tppi_get_rho_pT(p_span, temp_span, rho_span);
88
89 for (int som = 0; som < tab_rho.size(); som++) tab_rho(som, 0) = 0.5 * (tab_rho_n(som) + tab_rho_np1(som));
90
91 tab_rho.echange_espace_virtuel();
92 tab_rho_np1.echange_espace_virtuel();
93 le_fluide->calculer_rho_face(tab_rho_np1);
94}
classe Champ_Don_base classe de base des Champs donnes (non calcules)
void mettre_a_jour(double temps) override
Mise a jour en temps.
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
class Domaine_VF
Definition Domaine_VF.h:44
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Fluide_Weakly_Compressible Cette classe represente un d'un fluide faiblement compressible
const DoubleTab & pression_th_tab() const
void calculer_Cp() override
Calcule le Cp NE FAIT RIEN : le Cp est constant.
void calculer_masse_volumique() override
Recalcule la masse volumique.
std::shared_ptr< TPPI > TPPI_
DoubleTab tab_rho_np1
DoubleTab tab_rho_n
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
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
_SIZE_ size() const
Definition TRUSTVect.tpp:45
int line_size() const
Definition TRUSTVect.tpp:67
Span_ get_span() override
Definition TRUSTVect.h:181
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")