TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Terme_Source_Canal_perio_VDF_P0.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 <Terme_Source_Canal_perio_VDF_P0.h>
17#include <Domaine_VF.h>
18#include <Domaine_VDF.h>
19#include <Convection_Diffusion_std.h>
20
21Implemente_instanciable(Terme_Source_Canal_perio_VDF_P0, "Canal_perio_VDF_P0_VDF", Terme_Source_Canal_perio_VDF_Face);
22
23//// printOn
24//
26{
27 return s << que_suis_je() ;
28}
29
30//// readOn
31//
33{
35}
36
38{
39 // Compute heat_flux:
40 double heat_flux = compute_heat_flux();
41
42 const Domaine_VF& domaine_vf = ref_cast(Domaine_VF,equation().domaine_dis());
43 const double volume = domaine_vf.domaine().volume_total();
44 int size = domaine_vf.nb_elem();
45 ArrOfDouble s(size);
46 if (velocity_weighting_) // It seems this algorithm do not imply dT/dt -> 0
47 {
48 Cerr << "Option 'velocity_weighting' of source term 'canal_perio' in '" << equation().que_suis_je() << "' is not supported!!" << finl;
49 Cerr << "Contact TRUST support" << finl;
50 exit();
51 }
52 else
53 {
54 // Compute source term with
55 // Source = -Sum(imposed_heat_flux)/Volume
56 // Loop on the faces
57 for (int num_elem = 0; num_elem < size; num_elem++)
58 s[num_elem] = -heat_flux/volume;
59 }
60 return s;
61}
62
63void Terme_Source_Canal_perio_VDF_P0::ajouter_blocs(matrices_t matrices, DoubleTab& secmem, const tabs_t& semi_impl) const
64{
65 const Domaine_VF& domaine_VF = le_dom_VDF.valeur();
66 const DoubleVect& volumes = domaine_VF.volumes();
67 ArrOfDouble s(source());
68
69 // Boucle sur les elements internes
70 int nb_elem = domaine_VF.nb_elem();
71 for (int num_elem = 0; num_elem < nb_elem; num_elem++)
72 {
73 double vol = volumes(num_elem);
74 secmem(num_elem)+= s[num_elem]*vol;
75 }
76}
double volume_total() const
Definition Domaine.cpp:877
class Domaine_VF
Definition Domaine_VF.h:44
double volumes(int i) const
Definition Domaine_VF.h:113
const Domaine & domaine() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
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
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52
class Terme_Source_Canal_perio_VDF_P0 Cette classe permet de conserver le debit dans une simulation
void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl) const override
ArrOfDouble source_convection_diffusion(double debit_e) const override
ArrOfDouble source() const
Term source calculation (called by VDF and VEF implementations) TODO: returning an ArrOfDouble is baa...