TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Loi_Etat_GP_QC.cpp
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#include <Loi_Etat_GP_QC.h>
17#include <Fluide_Dilatable_base.h>
18
19Implemente_instanciable(Loi_Etat_GP_QC,"Loi_Etat_Gaz_Parfait_QC",Loi_Etat_Mono_GP_base);
20// XD perfect_gaz_QC loi_etat_gaz_parfait_base gaz_parfait_QC BRACE Class for perfect gas state law used with a
21// XD_CONT quasi-compressible fluid.
22// XD attr Cp double Cp REQ Specific heat at constant pressure (J/kg/K).
23// XD attr Cv double Cv OPT Specific heat at constant volume (J/kg/K).
24// XD attr gamma double gamma OPT Cp/Cv
25// XD attr Prandtl double Prandtl REQ Prandtl number of the gas Pr=mu*Cp/lambda
26// XD attr rho_constant_pour_debug field_base rho_constant_pour_debug OPT For developers to debug the code with a
27// XD_CONT constant rho.
28
30{
31 os <<que_suis_je()<< finl;
32 return os;
33}
34
36{
37 Cerr << "Reading the perfect gas equation of state for QC ... " << finl;
39}
40
41double Loi_Etat_GP_QC::calculer_masse_volumique(double P, double T) const
42{
43 return rho_constant_pour_debug_ ? rho_constant_pour_debug_->valeurs()(0,0) :
45}
46
47// View version
48void Loi_Etat_GP_QC::compute_tab_rho(DoubleTab& tab_rho)
49{
50 double rho_constant = rho_constant_pour_debug_ ? rho_constant_pour_debug_->valeurs()(0,0) : 0;
51 double Pth = le_fluide->pression_th();
52 double R = R_;
53 CDoubleArrView tab_ICh = static_cast<const ArrOfDouble&>(le_fluide->inco_chaleur().valeurs()).view_ro();
54 CDoubleArrView rho_n = static_cast<const ArrOfDouble&>(tab_rho_n).view_ro();
55 DoubleArrView rho_np1 = static_cast<ArrOfDouble&>(tab_rho_np1).view_wo();
56 DoubleArrView rho = static_cast<ArrOfDouble&>(tab_rho).view_wo();
57 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), tab_rho.size(), KOKKOS_LAMBDA(const int som)
58 {
59 rho_np1(som) = rho_constant ? rho_constant : Loi_Etat_Mono_GP_base::calculer_masse_volumique(Pth, tab_ICh(som), R);
60 rho(som) = 0.5 * (rho_n(som) + rho_np1(som));
61 });
62 end_gpu_timer(__KERNEL_NAME__);
63}
64
65/*! @brief Computes the density.
66 *
67 */
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
State law class for ideal gases in the quasi-compressible (QC) framework.
public_for_cuda void compute_tab_rho(DoubleTab &) override
void calculer_masse_volumique() override
Computes the density.
double R() const
Base state law class for mono-species ideal gases.
const DoubleTab & rho_n() const
DoubleTab tab_rho_np1
DoubleTab tab_rho_n
virtual void calculer_masse_volumique()
Recomputes the density (masse volumique).
const DoubleTab & rho_np1() const
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
Base class for output streams.
Definition Sortie.h:52
_SIZE_ size() const
Definition TRUSTVect.tpp:45