TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Fluide_Weakly_Compressible.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_Weakly_Compressible_included
17#define Fluide_Weakly_Compressible_included
18
19#include <Fluide_Dilatable_base.h>
20
21/*! @brief classe Fluide_Weakly_Compressible Cette classe represente un d'un fluide faiblement compressible
22 *
23 * c'est a dire heritant de Fluide_Dilatable_base
24 *
25 * @sa Milieu_base Fluide_Dilatable_base
26 */
27
29{
30 Declare_instanciable(Fluide_Weakly_Compressible);
31
32public :
33 void set_param(Param& param) const override;
34 void completer(const Probleme_base&) override;
35 void checkTraitementPth(const Domaine_Cl_dis_base&) override;
36 void discretiser(const Probleme_base& pb, const Discretisation_base& dis) override;
37 void abortTimeStep() override;
38 void calculer_pression_tot() override;
39 void update_pressure_fields(double ) override;
40 void write_mean_edo(double) override;
41 void write_header_edo() override;
42
43 // Methodes inlines
44 inline void Resoudre_EDO_PT() override;
45 inline const Champ_Don_base& pression_hydro() const { return ch_pression_hydro_; }
47 inline const Champ_Don_base& pression_eos() const { return ch_pression_eos_; }
51 inline const DoubleTab& pression_th_tab() const { return Pth_tab_; } // Tab Pression thermodynamique
52 inline DoubleTab& pression_th_tab() { return Pth_tab_; } // Tab Pression thermodynamique
53 inline const DoubleTab& pression_thn_tab() const { return Pth_n_tab_; } // Tab Pression thermodynamique a l'etape precedente
54 inline DoubleTab& pression_thn_tab() { return Pth_n_tab_; } // Tab Pression thermodynamique a l'etape precedente
55
56 inline void secmembre_divU_Z(DoubleTab& tab_W) const override { eos_tools_->secmembre_divU_Z(tab_W); }
57 inline void set_pression_th_tab(DoubleTab& Pth_tab) { Pth_n_tab_ = Pth_tab_ = Pth_tab; }
58 inline void set_resume_flag() { sim_resumed_ = 1; }
59 inline bool use_total_pressure() { return use_total_pressure_; }
61 inline bool use_pth_xyz() { return bool(ch_Pth_xyz_); }
63 inline bool use_saved_data() { return sim_resumed_; }
65
66protected:
70 double time_activate_ptot_ = -1.;
71
72private:
73 void calculer_pression_hydro();
74 void remplir_champ_pression_tot(int n, const DoubleTab& PHydro, DoubleTab& PTot) override;
75 void remplir_champ_pression_for_EOS();
76};
77
79{
80 if (Pth_ > -1.) Pth_n_ = Pth_;
82
83 if (traitement_PTh_ != 2)
84 {
85 if (Pth_ > -1.)
86 {
87 Pth_ = EDO_Pth_->resoudre(Pth_);
88
89 if (Pth_ <= 0)
90 {
91 Cerr << "Error : the pressure calculated by Resoudre_EDO_PT method is negative : " << Pth_ << finl;
93 }
94
96 {
97 Cerr << "Fluide_Weakly_Compressible:: " << __func__ << " Not yet coded with use_hydrostatic_pressure ..." << finl;
99
100 assert(a_gravite());
101 calculer_pression_hydro();
102 }
103 else if (use_total_pressure())
104 {
105 Cerr << "Fluide_Weakly_Compressible:: " << __func__ << " Not yet coded with use_total_pressure ..." << finl;
107
108 remplir_champ_pression_for_EOS();
109 }
110 else
111 // simple .. equiv QC
112 for (int i = 0; i < Pth_tab_.dimension_tot(0); i++)
113 Pth_tab_(i) = Pth_;
114 }
115 else
116 {
117 Cerr << "Fluide_Weakly_Compressible:: " << __func__ << " Not yet coded with pression_xyz ..." << finl;
119
120 EDO_Pth_->resoudre(Pth_tab_);
121 if (mp_min_vect(Pth_tab_) <= 0)
122 {
123 Cerr << "Error : the pressure calculated by Resoudre_EDO_PT method is negative : " << mp_min_vect(Pth_tab_) << finl;
125 }
126 }
127 }
128}
129
130#endif /* Fluide_Weakly_Compressible_included */
classe Champ_Don_base classe de base des Champs donnes (non calcules)
classe Discretisation_base Cette classe represente un schema de discretisation en espace,...
classe Domaine_Cl_dis_base Les objets Domaine_Cl_dis_base representent les conditions aux limites
classe Fluide_Dilatable_base Cette classe represente un d'un fluide dilatable,
classe Fluide_Weakly_Compressible Cette classe represente un d'un fluide faiblement compressible
const DoubleTab & pression_th_tab() const
OWN_PTR(Champ_Don_base) ch_Pth_xyz_
void set_param(Param &param) const override
const Champ_Don_base & fraction_massique_nonresolue() const
const Champ_Don_base & pression_hydro() const
void discretiser(const Probleme_base &pb, const Discretisation_base &dis) override
void calculer_pression_tot() override
Calcule la pression totale : pression thermodynamique + pression hydrodynamique.
void secmembre_divU_Z(DoubleTab &tab_W) const override
Champ_Don_base & fraction_massique_nonresolue()
void completer(const Probleme_base &) override
Complete le fluide avec les champs inconnus associes au probleme.
void checkTraitementPth(const Domaine_Cl_dis_base &) override
void set_pression_th_tab(DoubleTab &Pth_tab)
const DoubleTab & pression_thn_tab() const
const Champ_Don_base & pression_eos() const
virtual int a_gravite() const
Renvoie 1 si la gravite a ete initialisee.
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
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