TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Fluide_Diphasique.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_Diphasique.h>
17#include <Champ_Uniforme.h>
18#include <Interprete.h>
19#include <TRUST_Ref.h>
20#include <Motcle.h>
21#include <Param.h>
22
23
24Implemente_instanciable(Fluide_Diphasique, "Fluide_Diphasique", Milieu_base);
25// XD fluide_diphasique milieu_base fluide_diphasique INHERITS_BRACE Two-phase fluid.
26
27Sortie& Fluide_Diphasique::printOn(Sortie& os) const { return os; }
28
30{
32 if sub_type(Solid_Particle_base, phase0_.valeur())
33 {
34 is_solid_particle_ = true; // useful for fpi module
36 }
37 else if sub_type(Solid_Particle_base, phase1_.valeur())
38 {
39 is_solid_particle_ = true; // useful for fpi module
41 }
42 return is;
43}
44
46{
47 param.ajouter("sigma", &sigma_, Param::REQUIRED); // XD_ADD_P champ_don_base
48 // XD_CONT surfacic tension (J/m2)
49 // NB: the two parameters TODO TODO
50 param.ajouter("fluide0|phase0", &phase0_, Param::REQUIRED); // XD_ADD_P fluide_base
51 // XD_CONT first phase fluid
52 param.ajouter("fluide1|phase1", &phase1_, Param::REQUIRED); // XD_ADD_P fluide_base
53 // XD_CONT second phase fluid
54 param.ajouter("chaleur_latente", &chaleur_latente_); // XD_ADD_P champ_don_base
55 // XD_CONT phase changement enthalpy h(phase1_) - h(phase0_) (J/kg/K)
56 param.ajouter("formule_mu", &formule_mu_); // XD_ADD_P chaine
57 // XD_CONT (into=[standard,arithmetic,harmonic]) formula used to calculate average
58 Milieu_base::set_additional_params(param); // XD attr gravite field_base gravite OPT not_set
59}
60
62{
63 msg = "";
64 if (!sub_type(Fluide_Incompressible, phase0_.valeur()) && !sub_type(Fluide_Incompressible, phase1_.valeur()))
65 {
66 msg += "Both phases defined in the bloc Fluide_Diphasique must be of type Fluide_Incompressible. \n";
67 err = 1;
68 }
69
70 if (phase0_->a_gravite() || phase1_->a_gravite())
71 {
72 msg += "The gravity field should be defined in the Fluide_Diphasique bloc and not inside the Incompressible fluids bloc. \n";
73 err = 1;
74 }
75
76 if (!sub_type(Champ_Uniforme, sigma_.valeur()))
77 {
78 msg += "The surface tension sigma must be specify with a Champ_Uniforme type field. \n";
79 err = 1;
80 }
81 else
82 {
83 if (sigma_->valeurs()(0, 0) < 0)
84 {
85 msg += "The surface tension sigma is not positive. \n";
86 err = 1;
87 }
88 }
89
90 if (chaleur_latente_)
91 if (!sub_type(Champ_Uniforme, chaleur_latente_.valeur()))
92 {
93 msg += "The latent heat chaleur_latente must be specify with a Champ_Uniforme type field. \n";
94 err = 1;
95 }
96
98}
99
101{
102 assert(phase == 0 || phase == 1);
103 return (phase == 0) ? ref_cast(Fluide_Incompressible, phase0_.valeur()) : ref_cast(Fluide_Incompressible, phase1_.valeur());
104}
105
107{
108 return sigma_->valeurs()(0, 0);
109}
110
112{
113 if (!chaleur_latente_)
114 {
115 Cerr << "Fluide_Diphasique::chaleur_latente() : The latent heat has not been specified." << finl;
117 }
118 return chaleur_latente_->valeurs()(0, 0);
119}
120
121// These values are used in the switch of Navier_Stokes_FT_Disc::FT_disc_calculer_champs_rho_mu_nu_dipha
123{
124 if (formule_mu_ == "standard")
125 return 0;
126 else if ((formule_mu_ == "arithmetique") or (formule_mu_ == "arithmetic"))
127 return 1;
128 else if ((formule_mu_ == "harmonique") or (formule_mu_ == "harmonic"))
129 return 2;
130 else
131 return -1;
132}
133
134int Fluide_Diphasique::initialiser(const double temps)
135{
136 phase0_->initialiser(temps);
137 phase1_->initialiser(temps);
139 return 1;
140}
141
143{
145 phase0_->mettre_a_jour(temps);
146 phase1_->mettre_a_jour(temps);
147}
149{
150 phase0_->discretiser(pb, dis);
151 phase1_->discretiser(pb, dis);
152 discretiser_porosite(pb, dis);
154}
classe Champ_Uniforme Represente un champ constant dans l'espace et dans le temps.
classe Discretisation_base Cette classe represente un schema de discretisation en espace,...
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
double chaleur_latente() const
int initialiser(const double temps) override
const Fluide_Incompressible & fluide_phase(int la_phase) const
void set_param(Param &param) const override
void verifier_coherence_champs(int &err, Nom &message) override
void mettre_a_jour(double temps) override
void discretiser(const Probleme_base &pb, const Discretisation_base &dis) override
classe Fluide_Incompressible Cette classe represente un d'un fluide incompressible ainsi que
classe Milieu_base Cette classe est la base de la hierarchie des milieux (physiques)
Definition Milieu_base.h:50
void discretiser_porosite(const Probleme_base &pb, const Discretisation_base &dis)
virtual void mettre_a_jour(double temps)
int initialiser_porosite(const double temps)
void discretiser_diametre_hydro(const Probleme_base &pb, const Discretisation_base &dis)
virtual void verifier_coherence_champs(int &err, Nom &message)
virtual void set_additional_params(Param &param) const
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
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
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
@ REQUIRED
Definition Param.h:115
classe Probleme_base C'est un Probleme_U qui n'est pas un couplage.
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