TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Source_injection_masse_base.cpp
1/****************************************************************************
2* Copyright (c) 2023, 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 <Source_injection_masse_base.h>
17#include <Pb_Multiphase.h>
18#include <Discret_Thyd.h>
19
20
21Implemente_base(Source_injection_masse_base, "Source_injection_masse_base", Sources_Multiphase_base);
22
24{
25 return os;
26}
27
29{
30 Cerr << "Lecture du Champ de masse injectee" << finl;
31
32 OWN_PTR(Champ_Don_base) flux_masse_lu_;
33 Motcle type;
34 is >> type;
35
36 flux_masse_lu_.typer(type);
37 Champ_Don_base& ch_flux_masse_lu_ = ref_cast(Champ_Don_base,flux_masse_lu_.valeur());
38 is >> ch_flux_masse_lu_;
39 const int nb_comp = ch_flux_masse_lu_.nb_comp();
40
41 equation().probleme().discretisation().discretiser_champ("champ_elem", equation().domaine_dis(), "pp", "1",nb_comp,0., flux_masse_);
42 flux_masse_lu_->fixer_nb_comp(nb_comp);
43 if (ch_flux_masse_lu_.le_nom()=="anonyme")
44 ch_flux_masse_lu_.nommer("Flux_masse_injectee");
45
46 for (int n = 0; n < nb_comp; n++)
47 flux_masse_lu_->fixer_nom_compo(n, ch_flux_masse_lu_.le_nom() + (nb_comp > 1 ? Nom(n) :""));
48 for (int n = 0; n < nb_comp; n++)
49 flux_masse_->fixer_nom_compo(n, ch_flux_masse_lu_.le_nom() + (nb_comp > 1 ? Nom(n) :""));
50
51 equation().discretisation().nommer_completer_champ_physique(equation().domaine_dis(),ch_flux_masse_lu_.le_nom(),"1/s",flux_masse_lu_,equation().probleme());
52 equation().discretisation().nommer_completer_champ_physique(equation().domaine_dis(),ch_flux_masse_lu_.le_nom(),"1/s",flux_masse_,equation().probleme());
53 flux_masse_->valeurs() = 0;
54 flux_masse_->affecter(flux_masse_lu_);
55
56 const Pb_Multiphase& pb = ref_cast(Pb_Multiphase, equation().probleme());
57 int N = pb.nb_phases();
58 if (N != flux_masse_->valeurs().line_size()) Process::exit(que_suis_je() + " : you must input as many fluxes as there are phases !!");
59
60 return is;
61}
62
64{
65 flux_masse_->mettre_a_jour(temps);
66}
67
68void Source_injection_masse_base::ajouter_blocs(matrices_t matrices, DoubleTab& secmem, const tabs_t& semi_impl) const
69{
70 const Domaine_VF& domaine = ref_cast(Domaine_VF, equation().domaine_dis());
71 const Pb_Multiphase& pb = ref_cast(Pb_Multiphase, equation().probleme());
72 const DoubleTab& rho = pb.get_champ("masse_volumique").passe(),
73 &tab_inj = flux_masse_->valeurs();
74 const DoubleVect& pe = equation().milieu().porosite_elem(), &ve = domaine.volumes();
75 int cI = (tab_inj.dimension(0)==1), cR = (rho.dimension(0)==1), N =rho.line_size();
76 int e, k;
77
78 for (e = 0; e < domaine.nb_elem(); e++)
79 for (k = 0; k < N; k++)
80 secmem(e, k) += pe[e] * ve[e] * tab_inj(!cI*e, k) * rho(!cR, k);
81}
virtual DoubleTab & passe(int i=1)
Definition Champ_Proto.h:50
void nommer_completer_champ_physique(const Domaine_dis_base &domaine_vdf, const Nom &nom_champ, const Nom &unite, Champ_base &champ, const Probleme_base &pbi) const
void discretiser_champ(const Motcle &directive, const Domaine_dis_base &z, const Nom &nom, const Nom &unite, int nb_comp, int nb_pas_dt, double temps, OWN_PTR(Champ_Inc_base)&champ, const Nom &sous_type=NOM_VIDE) const
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
virtual const Milieu_base & milieu() const =0
const Discretisation_base & discretisation() const
Returns the discretization associated with the equation.
Probleme_base & probleme()
Returns the problem associated with the equation.
const Nom & le_nom() const override
Returns the name of the field.
void nommer(const Nom &) override
Gives a name to the field.
virtual int nb_comp() const
Definition Field_base.h:56
DoubleVect & porosite_elem()
Definition Milieu_base.h:58
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
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
Multiphase thermohydraulics problem of type "3*N equations":
int nb_phases() const
const Champ_base & get_champ(const Motcle &nom) const override
const Discretisation_base & discretisation() const
Returns the discretization associated with the problem.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52
OWN_PTR(Champ_Don_base) flux_masse_
void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={}) const override
void mettre_a_jour(double temps) override
DOES NOTHING - to override in derived classes.
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
int line_size() const
Definition TRUSTVect.tpp:67