TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Fluide_Dilatable_base.h
1/****************************************************************************
2* Copyright (c) 2026, 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#ifndef Fluide_Dilatable_base_included
17#define Fluide_Dilatable_base_included
18
19#include <EDO_Pression_th_base.h>
20#include <EOS_Tools_base.h>
21
22#include <Loi_Etat_base.h>
23#include <Fluide_base.h>
24#include <TRUST_Deriv.h>
25#include <TRUST_Ref.h>
26
27
28class Probleme_base;
29
30/*! @brief Base class for a dilatable fluid, inheriting from Fluide_base.
31 *
32 * @sa Milieu_base Fluide_base
33 */
34
36{
37 Declare_base(Fluide_Dilatable_base);
38public :
39 void verifier_coherence_champs(int& err,Nom& message) override;
40 void set_Cp(double);
41 void update_rho_cp(double temps) override;
42 void creer_champs_non_lus() override;
43 void initialiser_radiatives(const double temps);
45 int initialiser(const double temps) override;
46
47 const DoubleTab& temperature() const;
48 const Champ_Don_base& ch_temperature() const;
50
51 virtual void calculer_pression_tot();
52 void preparer_pas_temps();
53 void abortTimeStep() override;
54 void set_param(Param& param) const override;
55 void discretiser(const Probleme_base& pb, const Discretisation_base& dis) override;
56 void mettre_a_jour(double ) override;
57 virtual void update_pressure_fields(double );
58 void preparer_calcul() override;
59 virtual void completer(const Probleme_base&);
60 int lire_motcle_non_standard(const Motcle&, Entree&) override;
61 virtual void checkTraitementPth(const Domaine_Cl_dis_base&);
63 virtual void write_mean_edo(double);
64 virtual void write_header_edo();
65
66 // Pure virtual methods
67 virtual void secmembre_divU_Z(DoubleTab& ) const=0;
68 virtual void Resoudre_EDO_PT()=0;
69
70 // Post-processing field interface methods
71 const Champ_base& get_champ(const Motcle& nom) const override;
72 void creer_champ(const Motcle& motlu) override;
73 bool has_champ(const Motcle& nom, OBS_PTR(Champ_base) &ref_champ) const override;
74 bool has_champ(const Motcle& nom) const override;
75 void get_noms_champs_postraitables(Noms& nom,Option opt=NONE) const override;
76
77 // Inline methods
78 inline const Nom type_fluide() const { return loi_etat_->type_fluide(); }
79 inline const OWN_PTR(Loi_Etat_base)& loi_etat() const { return loi_etat_; }
80 inline OWN_PTR(Loi_Etat_base)& loi_etat() { return loi_etat_; }
81 inline const Champ_Inc_base& inco_chaleur() const { return ch_inco_chaleur_.valeur(); }
82 inline Champ_Inc_base& inco_chaleur() { return ch_inco_chaleur_.valeur(); }
83 inline const Champ_Inc_base& vitesse() const { return ch_vitesse_.valeur(); }
84 inline const Champ_Don_base& pression_tot() const { return ch_pression_tot_; }
85 inline Champ_Don_base& pression_tot() { return ch_pression_tot_; }
86 inline const Champ_Don_base& mu_sur_Schmidt() const { return ch_mu_sur_Sc; }
88 inline const Champ_Don_base& nu_sur_Schmidt() const { return ch_nu_sur_Sc; }
90 inline const Champ_Don_base& source_masse_espece() const { assert (ch_source_masse_esp_); return ch_source_masse_esp_; }
91 inline Champ_Don_base& source_masse_espece() { assert (ch_source_masse_esp_); return ch_source_masse_esp_; }
94
95 inline bool has_source_masse_espece_champ() const { return bool(ch_source_masse_esp_); }
96 inline bool has_source_masse_projection_champ() const { return bool(ch_source_masse_proj_); }
97
98 inline const DoubleTab& rho_n() const { return loi_etat_->rho_n(); }
99 inline const DoubleTab& rho_np1() const { return loi_etat_->rho_np1(); }
100 inline void calculer_coeff_T();
101 inline void initialiser_inco_ch() { loi_etat_->initialiser_inco_ch(); }
102 inline void calculer_Cp() { loi_etat_->calculer_Cp(); }
103 inline void calculer_lambda() { loi_etat_->calculer_lambda(); }
104 inline void calculer_mu() { loi_etat_->calculer_mu(); }
105 inline void calculer_nu() override { loi_etat_->calculer_nu(); }
106 inline void calculer_alpha() override { loi_etat_->calculer_alpha(); }
107 inline void calculer_mu_sur_Sc() { loi_etat_-> calculer_mu_sur_Sc(); }
108 inline void calculer_nu_sur_Sc() { loi_etat_-> calculer_nu_sur_Sc(); }
109 inline void calculer_masse_volumique() { loi_etat_->calculer_masse_volumique(); }
110 inline void set_pression_th(double Pth) { Pth_n_ = Pth_ = Pth; }
111 inline int getTraitementPth() const { return traitement_PTh_; }
112 inline double pression_th() const { return Pth_; } // Thermodynamic pressure
113 inline const double& get_pression_th() const { return Pth_; } // Reference to thermodynamic pressure (for PDI, can't share a copy...)
114 inline double pression_thn() const { return Pth_n_; } // Thermodynamic pressure at the previous time step
115 inline double pression_th1() const { return Pth1_; } // Thermodynamic pressure computed to conserve mass
116 inline double calculer_H(double hh) const { return loi_etat_->calculer_H(Pth_,hh); }
117
118 // Inline methods from EOS_Tools
119 inline Probleme_base& get_problem() { return le_probleme_.valeur(); }
120 inline const DoubleTab& rho_discvit() const { return eos_tools_->rho_discvit(); }
121 inline const DoubleTab& rho_face_n() const { return eos_tools_->rho_face_n(); }
122 inline const DoubleTab& rho_face_np1() const { return eos_tools_->rho_face_np1(); }
123 inline void calculer_rho_face(const DoubleTab& tab_rho) { eos_tools_->calculer_rho_face_np1(tab_rho); }
124 inline void divu_discvit(DoubleTab& secmem1, DoubleTab& secmem2) { eos_tools_->divu_discvit(secmem1,secmem2); }
125 inline double moyenne_vol(const DoubleTab& A) const { return eos_tools_->moyenne_vol(A); }
126
127 bool is_dilatable() const override { return true; }
128
129protected :
130 virtual void remplir_champ_pression_tot(int n, const DoubleTab& PHydro, DoubleTab& PTot) = 0;
131 void completer_edo(const Probleme_base& );
132
133 int traitement_PTh_ = 0; // flag for the treatment of thermodynamic pressure
134 double Pth_ = -1., Pth_n_ = -1., Pth1_ = -1.;
136 OBS_PTR(Probleme_base) le_probleme_;
138 OWN_PTR(Champ_Don_base) ch_source_masse_esp_, ch_source_masse_proj_; /* si besoin */
143};
144
146{
147 loi_etat_->remplir_T();
148 calculer_Cp();
149 calculer_mu();
151 calculer_nu();
155}
156
157#endif /* Fluide_Dilatable_base_included */
class Champ_Don_base base class of Given Fields (not calculated)
Class Champ_Inc_base.
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
class Discretisation_base This class represents a spatial discretization scheme, which
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
Base class of the ODE hierarchy for thermodynamic pressure associated with the scheme resolution for ...
Abstract base class for EOS tools used with dilatable fluids.
Base class for a dilatable fluid, inheriting from Fluide_base.
const Champ_Don_base & ch_temperature() const
Returns the temperature field.
const Champ_base & get_champ(const Motcle &nom) const override
void creer_champ(const Motcle &motlu) override
int initialiser(const double temps) override
Initializes the fluid parameters.
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
OBS_PTR(Champ_Inc_base) ch_inco_chaleur_
const DoubleTab & temperature() const
Returns the array of temperature values.
const DoubleTab & rho_n() const
bool has_source_masse_espece_champ() const
const Champ_Don_base & source_masse_projection() const
virtual void Resoudre_EDO_PT()=0
double moyenne_vol(const DoubleTab &A) const
void mettre_a_jour(double) override
Performs a time update of the medium and therefore of its characteristic parameters.
const DoubleTab & rho_face_n() const
Champ_Don_base & nu_sur_Schmidt()
const DoubleTab & rho_discvit() const
OWN_PTR(Loi_Etat_base) loi_etat_
const double & get_pression_th() const
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
bool has_source_masse_projection_champ() const
OWN_PTR(Loi_Etat_base) &loi_etat()
Champ_Inc_base & inco_chaleur()
Champ_Don_base & mu_sur_Schmidt()
Champ_Don_base & pression_tot()
Champ_Don_base & source_masse_espece()
virtual void calculer_pression_tot()
Computes the total pressure: thermodynamic pressure + hydrodynamic pressure.
virtual void checkTraitementPth(const Domaine_Cl_dis_base &)
void completer_edo(const Probleme_base &)
const Champ_Inc_base & inco_chaleur() const
virtual void remplir_champ_pression_tot(int n, const DoubleTab &PHydro, DoubleTab &PTot)=0
const Champ_Don_base & source_masse_espece() const
virtual void secmembre_divU_Z(DoubleTab &) const =0
const Champ_Don_base & nu_sur_Schmidt() const
virtual void update_pressure_fields(double)
const Champ_Don_base & mu_sur_Schmidt() const
void calculer_alpha() override
Computes alpha=lambda/(rho*Cp).
virtual void write_mean_edo(double)
void discretiser(const Probleme_base &pb, const Discretisation_base &dis) override
void preparer_calcul() override
Prepares the fluid for computation.
void preparer_pas_temps()
Prepares the time step.
const OWN_PTR(Loi_Etat_base) &loi_etat() const
OWN_PTR(EDO_Pression_th_base) EDO_Pth_
void update_rho_cp(double temps) override
const Champ_Inc_base & vitesse() const
const DoubleTab & rho_np1() const
OBS_PTR(Probleme_base) le_probleme_
const DoubleTab & rho_face_np1() const
double calculer_H(double hh) const
void initialiser_radiatives(const double temps)
OWN_PTR(EOS_Tools_base) eos_tools_
void set_Cp(double)
Completes the fluid with a constant Cp.
void verifier_coherence_champs(int &err, Nom &message) override
Verifies that the fields read have been correctly set.
Champ_Don_base & source_masse_projection()
void set_param(Param &param) const override
const Nom type_fluide() const
bool is_dilatable() const override
void divu_discvit(DoubleTab &secmem1, DoubleTab &secmem2)
const Champ_Don_base & pression_tot() const
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
virtual void completer(const Probleme_base &)
Completes the fluid with the unknown fields associated with the problem.
void calculer_rho_face(const DoubleTab &tab_rho)
Base class for an incompressible fluid and its properties:
Definition Fluide_base.h:36
Base class for the state law hierarchy defining a dilatable fluid.
A character string (Nom) in uppercase.
Definition Motcle.h:26
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
An array of character strings (VECT(Nom)).
Definition Noms.h:26
friend class Entree
Definition Objet_U.h:71
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
class Probleme_base It is a Probleme_U that is not a coupling.