TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Source_QC_Chaleur.cpp
1/****************************************************************************
2* Copyright (c) 2025, 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_Quasi_Compressible.h>
17#include <Source_QC_Chaleur.h>
18#include <Schema_Temps_base.h>
19#include <Equation_base.h>
20#include <kokkos++.h>
21#include <TRUSTArray_kokkos.tpp>
22
23Implemente_base(Source_QC_Chaleur,"Source_QC_Chaleur",Source_Chaleur_Fluide_Dilatable_base);
24
26{
27 os <<que_suis_je()<< finl;
28 return os;
29}
30
32{
33 return is;
34}
35
36
37DoubleTab& Source_QC_Chaleur::ajouter(DoubleTab& resu) const
38{
40 {
41 ajouter_blocs({}, resu);
42 return resu;
43 }
44 return ajouter_(resu);
45}
46
47
48/*! @brief Ajoute les termes sources
49 *
50 * @return (Entree&)
51 */
52DoubleTab& Source_QC_Chaleur::ajouter_(DoubleTab& resu) const
53{
54 double dt_= mon_equation->schema_temps().temps_courant() - mon_equation->schema_temps().temps_precedent();
55
56 if (dt_<=0) return resu; // On calcul pas ce terme source si dt<=0
57
58 /*
59 * The source term corresponds to :
60 * d P_tot / d t = del P / del t + u.grad(P_tot)
61 * Here grad(P_tot) = 0 (uniform in space)
62 */
63
64 const Fluide_Quasi_Compressible& FQC = ref_cast(Fluide_Quasi_Compressible,le_fluide.valeur());
65 double Pth = FQC.pression_th(), Pthn = FQC.pression_thn();
66 double dpth = ( Pth - Pthn ) / dt_;
67 // resu+=dpth*volumes*porosites
68 int nsom = resu.dimension(0);
69 CDoubleArrView volumes_v = volumes.view_ro();
70 CDoubleArrView porosites_v = porosites.view_ro();
71 // ToDo_Kokkos : DoubleArrView resu_v = resu.view_rw(); avec resu DoubleTab
72 DoubleTabView resu_v = resu.view_rw();
73 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), nsom, KOKKOS_LAMBDA(
74 const int i)
75 {
76 resu_v(i, 0) += dpth * volumes_v(i) * porosites_v(i);
77 });
78 end_gpu_timer(__KERNEL_NAME__);
79 /* Ne marche pas detect inf en debug: */
80 /* DoubleVect vol(volumes);
81 vol*=porosites;
82 ajoute_alpha_v(resu, dpth, vol); */
83 return resu;
84}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Fluide_Quasi_Compressible Cette classe represente un d'un fluide quasi compressible
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
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
Classe de base des flux de sortie.
Definition Sortie.h:52
class Source_Chaleur_Fluide_Dilatable_base
class Source_QC_Chaleur
DoubleTab & ajouter(DoubleTab &) const override
virtual public_for_cuda DoubleTab & ajouter_(DoubleTab &) const
Ajoute les termes sources.
virtual int has_interface_blocs() const
Definition Source_base.h:68
virtual void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={ }) const
std::enable_if_t< is_default_exec_space< EXEC_SPACE >, View< _TYPE_, _SHAPE_ > > view_rw()
Definition TRUSTTab.h:291
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133