TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Fluide_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_base_included
17#define Fluide_base_included
18
19#include <Milieu_base.h>
20#include <TRUST_Ref.h>
21
22class Champ_base;
23
24/*! @brief Base class for an incompressible fluid and its properties:
25 * - kinematic viscosity (mu)
26 * - dynamic viscosity (nu)
27 * - density (rho)
28 * - diffusivity (alpha)
29 * - conductivity (lambda)
30 * - specific heat (Cp)
31 * - constituent thermal expansion coefficient (beta_co)
32 *
33 * @sa Milieu_base
34 */
36{
37 Declare_instanciable(Fluide_base);
38public :
39 void set_param(Param& param) const override;
40 void verifier_coherence_champs(int& err, Nom& message) override;
41 bool initTimeStep(double dt) override;
42 void mettre_a_jour(double) override;
43 int initialiser(const double temps) override;
44 void creer_champs_non_lus() override;
45 void discretiser(const Probleme_base& pb, const Discretisation_base& dis) override;
46 virtual void set_h0_T0(double h0, double T0);
47 virtual int is_incompressible() const { return 0; }
48
49 const Champ_base& energie_interne() const;
51 const Champ_base& enthalpie() const;
55
56 inline const Champ_Don_base& viscosite_cinematique() const { return ch_nu_.valeur(); }
57 inline Champ_Don_base& viscosite_cinematique() { return ch_nu_.valeur(); }
58 inline const Champ_Don_base& viscosite_dynamique() const { return ch_mu_.valeur(); }
59 inline Champ_Don_base& viscosite_dynamique() { return ch_mu_.valeur(); }
60 bool has_viscosite_dynamique() const { return bool(ch_mu_); }
61
62 // Returns the constituent expansion coefficient, beta_co.
63 inline const Champ_Don_base& beta_c() const { return ch_beta_co_.valeur(); }
64 inline Champ_Don_base& beta_c() { return ch_beta_co_.valeur(); }
65 bool has_beta_c() const { return bool(ch_beta_co_); }
66
67 // Returns the fluid absorption coefficient
68 inline Champ_Don_base& kappa() { return coeff_absorption_.valeur(); }
69 inline const Champ_Don_base& kappa() const { return coeff_absorption_.valeur(); }
70 bool has_kappa() const { return bool(coeff_absorption_); }
71
72 // Returns the fluid refractive index
73 inline Champ_Don_base& indice() { return indice_refraction_.valeur(); }
74 inline const Champ_Don_base& indice() const { return indice_refraction_.valeur(); }
75
76 // Returns the radiation penetration depth in the fluid defined as l = 1/(3*kappa)
77 inline Champ_Don_base& longueur_rayo() { return longueur_rayo_.valeur(); }
78 inline const Champ_Don_base& longueur_rayo() const { return longueur_rayo_.valeur(); }
79 void typer_longeur_rayo(const Nom& typ) { longueur_rayo_.typer(typ); }
80
81 inline bool is_rayo_semi_transp() const override { return (coeff_absorption_ && indice_refraction_); }
82 inline bool is_rayo_transp() const override { return is_rad_transp_med_; }
83 inline void set_rayo_transp_flag() { is_rad_transp_med_ = true; }
84 inline bool is_longueur_rayo_discretised() const { return bool(longueur_rayo_); }
85
86protected :
87 void creer_e_int() const; // creation sur demande de e_int / h
88 void creer_temperature_multiphase() const; // only if Energie_Multiphase_Enthalpie
89 void calculer_temperature_multiphase() const; // only if Energie_Multiphase_Enthalpie
90
91 mutable int e_int_auto_ = 0; //1 if e_int was created automatically
92 static void calculer_e_int(const Objet_U& obj, DoubleTab& val, DoubleTab& bval, tabs_t& deriv); // default computation function
93
94 mutable OWN_PTR(Champ_base) ch_e_int_, ch_h_ou_T_; //pour la creation sur demande : h is Energie_Multiphase et T si Energie_Multiphase_Enthalpie
96 double h0_ = 0, T0_ = 0;
97
98 bool is_rad_transp_med_ = false; // transparent radiating fluid
99
100 // Parameters of the semi-transparent radiating fluid
102
103 // Characteristic radiation penetration depth in the semi-transparent medium defined as l = 1/(3*kappa)
104 OWN_PTR(Champ_Don_base) longueur_rayo_;
105
106 void creer_nu();
107 virtual void calculer_nu();
108};
109
110#endif /* Fluide_base_included */
class Champ_Don_base base class of Given Fields (not calculated)
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
Base class for an incompressible fluid and its properties:
Definition Fluide_base.h:36
OWN_PTR(Champ_Don_base) longueur_rayo_
virtual void set_h0_T0(double h0, double T0)
const Champ_Don_base & kappa() const
Definition Fluide_base.h:69
void set_param(Param &param) const override
bool is_longueur_rayo_discretised() const
Definition Fluide_base.h:84
virtual void calculer_nu()
bool is_rayo_semi_transp() const override
Definition Fluide_base.h:81
bool has_viscosite_dynamique() const
Definition Fluide_base.h:60
Champ_Don_base & beta_c()
Definition Fluide_base.h:64
const Champ_Don_base & longueur_rayo() const
Definition Fluide_base.h:78
void mettre_a_jour(double) override
Performs a time update of the medium and therefore of its characteristic parameters.
void typer_longeur_rayo(const Nom &typ)
Definition Fluide_base.h:79
const Champ_Don_base & viscosite_dynamique() const
Definition Fluide_base.h:58
void calculer_temperature_multiphase() const
bool has_kappa() const
Definition Fluide_base.h:70
const Champ_base & energie_interne() const
bool is_rayo_transp() const override
Definition Fluide_base.h:82
const Champ_Don_base & viscosite_cinematique() const
Definition Fluide_base.h:56
OWN_PTR(Champ_base) ch_e_int_
int initialiser(const double temps) override
Initializes the fluid parameters.
void creer_temperature_multiphase() const
Champ_Don_base & viscosite_cinematique()
Definition Fluide_base.h:57
const Champ_Don_base & indice() const
Definition Fluide_base.h:74
void set_rayo_transp_flag()
Definition Fluide_base.h:83
bool is_rad_transp_med_
Definition Fluide_base.h:98
static void calculer_e_int(const Objet_U &obj, DoubleTab &val, DoubleTab &bval, tabs_t &deriv)
bool has_beta_c() const
Definition Fluide_base.h:65
void verifier_coherence_champs(int &err, Nom &message) override
Verifies that the fields read have been set correctly.
const Champ_base & enthalpie() const
void creer_champs_non_lus() override
const Champ_Don_base & beta_c() const
Definition Fluide_base.h:63
Champ_Don_base & kappa()
Definition Fluide_base.h:68
void creer_e_int() const
Champ_Don_base & viscosite_dynamique()
Definition Fluide_base.h:59
void creer_nu()
If the object referenced by nu is of type Champ_Uniforme, types nu as "Champ_Uniforme" and fills it w...
Champ_Don_base & longueur_rayo()
Definition Fluide_base.h:77
virtual int is_incompressible() const
Definition Fluide_base.h:47
Champ_Don_base & indice()
Definition Fluide_base.h:73
bool initTimeStep(double dt) override
void discretiser(const Probleme_base &pb, const Discretisation_base &dis) override
const Champ_base & temperature_multiphase() const
Milieu_base This class is the base of the (physical) medium hierarchy.
Definition Milieu_base.h:50
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
Definition Objet_U.cpp:54
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.