TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Source_WC_Chaleur.cpp
1/****************************************************************************
2* Copyright (c) 2024, 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_Weakly_Compressible.h>
17#include <Domaine_Cl_dis_base.h>
18#include <Source_WC_Chaleur.h>
19#include <Schema_Temps_base.h>
20#include <Equation_base.h>
21#include <Domaine_VF.h>
22
23Implemente_base(Source_WC_Chaleur,"Source_WC_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
36DoubleTab& Source_WC_Chaleur::ajouter(DoubleTab& resu) const
37{
39 {
40 ajouter_blocs({}, resu);
41 return resu;
42 }
43 return ajouter_(resu);
44}
45
46/*! @brief Adds the weakly compressible source term d P_tot / d t = del P / del t + u.
47 *
48 * grad(P_tot)
49 *
50 * @return (Entree&)
51 */
52DoubleTab& Source_WC_Chaleur::ajouter_(DoubleTab& resu) const
53{
54 double dt_ = mon_equation->schema_temps().temps_courant() - mon_equation->schema_temps().temps_precedent();
55 if (dt_ <= 0.) return resu; // Do not compute this source term if dt<=0
56
57 Fluide_Weakly_Compressible& FWC = ref_cast_non_const(Fluide_Weakly_Compressible,le_fluide.valeur());
58 DoubleTab& Ptot = FWC.pression_th_tab(), &Ptot_n = FWC.pression_thn_tab(); // present & previous
59
61
62 DoubleTab UgradP(Ptot); // element field in VDF and face field in VEF
63 UgradP = 0.;
64
65 // Only if non uniform and if the flag use_grad_pression_eos is 1
67
68 assert (resu.dimension(0) == UgradP.dimension(0));
69 assert (resu.size() == UgradP.size());
70
71 for (int i=0 ; i< resu.dimension(0); i++)
72 {
73 double dpth = ( Ptot(i,0) - Ptot_n(i,0) ) / dt_ + UgradP(i,0);
74 resu(i) += dpth * volumes(i)*porosites(i) ;
75 }
76 return resu;
77}
78
79const DoubleTab& Source_WC_Chaleur::correct_grad_boundary(const Domaine_VF& domaine, DoubleTab& grad_Ptot) const
80{
81 // We dont have a CL for Ptot => we apply explicitly to have a null gradient on the boundary ...
82 const Domaine_Cl_dis_base& domaine_cl = mon_equation->domaine_Cl_dis();
83 for (int n_bord=0; n_bord<domaine.nb_front_Cl(); n_bord++)
84 {
85 const Cond_lim& la_cl = domaine_cl.les_conditions_limites(n_bord);
86 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
87 // retrieve face and replace gradient by 0
88 const int ndeb = le_bord.num_premiere_face(), nfin = ndeb + le_bord.nb_faces();
89 for (int num_face=ndeb; num_face<nfin; num_face++) grad_Ptot(num_face,0) = 0.;
90 }
91 return grad_Ptot;
92}
class Cond_lim Generic class used to represent any class
Definition Cond_lim.h:31
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
class Domaine_VF
Definition Domaine_VF.h:44
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Fluide_Weakly_Compressible class This class represents a weakly compressible fluid,...
const DoubleTab & pression_th_tab() const
const DoubleTab & pression_thn_tab() const
class Front_VF
Definition Front_VF.h:36
int nb_faces() const
Definition Front_VF.h:53
int num_premiere_face() const
Definition Front_VF.h:63
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
Additional source term for the heat equation when the fluid is quasi-compressible.
class Source_WC_Chaleur
DoubleTab & ajouter(DoubleTab &) const override
const DoubleTab & correct_grad_boundary(const Domaine_VF &domaine, DoubleTab &grad_Ptot) const
DoubleTab & ajouter_(DoubleTab &) const
Adds the weakly compressible source term d P_tot / d t = del P / del t + u.
virtual void compute_interpolate_gradP(DoubleTab &gradP, const DoubleTab &Ptot) const =0
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
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
_SIZE_ size() const
Definition TRUSTVect.tpp:45
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")