TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Terme_Boussinesq_PolyMAC_CDO_Face.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 <Convection_Diffusion_Temperature.h>
17#include <Terme_Boussinesq_PolyMAC_CDO_Face.h>
18#include <Fluide_Incompressible.h>
19#include <Neumann_sortie_libre.h>
20#include <Champ_Face_PolyMAC_CDO.h>
21#include <Domaine_PolyMAC_MPFA.h>
22#include <Domaine_Cl_PolyMAC_family.h>
23#include <Navier_Stokes_std.h>
24#include <Champ_Uniforme.h>
25#include <Pb_Multiphase.h>
26#include <Synonyme_info.h>
27#include <Dirichlet.h>
28
29Implemente_instanciable(Terme_Boussinesq_PolyMAC_CDO_Face, "Boussinesq_PolyMAC_CDO_Face|Boussinesq_PolyMAC_HFV_Face", Terme_Boussinesq_base);
30Add_synonym(Terme_Boussinesq_PolyMAC_CDO_Face, "Boussinesq_PolyMAC_MPFA_Face");
31
32Add_synonym(Terme_Boussinesq_PolyMAC_CDO_Face, "Boussinesq_temperature_Face_PolyMAC_HFV");
33Add_synonym(Terme_Boussinesq_PolyMAC_CDO_Face, "Boussinesq_temperature_Face_PolyMAC_MPFA");
34Add_synonym(Terme_Boussinesq_PolyMAC_CDO_Face, "Boussinesq_temperature_Face_PolyMAC_CDO");
35
36Add_synonym(Terme_Boussinesq_PolyMAC_CDO_Face, "Boussinesq_concentration_PolyMAC_HFV_Face");
37Add_synonym(Terme_Boussinesq_PolyMAC_CDO_Face, "Boussinesq_concentration_PolyMAC_MPFA_Face");
38Add_synonym(Terme_Boussinesq_PolyMAC_CDO_Face, "Boussinesq_concentration_PolyMAC_CDO_Face");
39
41
43
45{
46 le_dom_PolyMAC_CDO = ref_cast(Domaine_PolyMAC_CDO, domaine_dis);
47 le_dom_Cl_PolyMAC_CDO = ref_cast(Domaine_Cl_PolyMAC_family, domaine_Cl_dis);
48}
49
50void Terme_Boussinesq_PolyMAC_CDO_Face::ajouter_blocs(matrices_t matrices, DoubleTab& secmem, const tabs_t& semi_impl) const
51{
52 const Domaine_PolyMAC_CDO& domaine = le_dom_PolyMAC_CDO.valeur();
53 const DoubleTab& param = equation_scalaire().inconnue().valeurs();
54 const DoubleTab& beta_valeurs = beta().valeurs();
55 const IntTab& f_e = domaine.face_voisins(), &fcl = ref_cast(Champ_Face_PolyMAC_CDO, equation().inconnue()).fcl();
56 const DoubleTab& rho = equation().milieu().masse_volumique().passe(), &vfd = domaine.volumes_entrelaces_dir(), &nf = domaine.face_normales(),
57 *alp = sub_type(Pb_Multiphase, equation().probleme()) ? &ref_cast(Pb_Multiphase, equation().probleme()).equation_masse().inconnue().passe() : nullptr;
58 const DoubleVect& pf = equation().milieu().porosite_face(), &pe = equation().milieu().porosite_elem(), &ve = domaine.volumes(), &fs = domaine.face_surfaces(), &grav = gravite().valeurs();
59
60 DoubleVect g(dimension);
61 g = grav;
62
63 // Check validity of T0:
64 check();
65 int e, i, f, n, calc_cl = !sub_type(Domaine_PolyMAC_MPFA, domaine), nb_dim = param.line_size(), cR = (rho.dimension_tot(0) == 1), d, D = dimension, nf_tot = domaine.nb_faces_tot();
66 for (f = 0; f < domaine.nb_faces(); f++)
67 for (i = 0; (calc_cl || fcl(f, 0) < 2) && i < 2 && (e = f_e(f, i)) >= 0; i++) //upwind/downwind contributions
68 {
69 double coeff = 0;
70 for (n = 0; n < nb_dim; n++)
71 coeff += (alp ? (*alp)(e, n) * rho(!cR * e, n) : 1) * valeur(beta_valeurs, e, e, n) * (Scalaire0(n) - valeur(param, e, n));
72
73 secmem(f) += coeff * domaine.dot(&nf(f, 0), g.addr()) / fs(f) * vfd(f, i) * pf(f);
74 }
75
76 if (sub_type(Domaine_PolyMAC_MPFA, domaine))
77 for (e = 0; e < domaine.nb_elem_tot(); e++)
78 {
79 double coeff = 0;
80 for (n = 0; n < nb_dim; n++)
81 coeff += (alp ? (*alp)(e, n) * rho(!cR * e, n) : 1) * valeur(beta_valeurs, e, e, n) * (Scalaire0(n) - valeur(param, e, n));
82 for (d = 0; d < dimension; d++)
83 secmem(nf_tot + D * e + d) += coeff * g(d) * pe(e) * ve(e);
84 }
85}
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
DoubleTab & valeurs() override
Returns the array of field values at the current time.
virtual DoubleTab & passe(int i=1)
Definition Champ_Proto.h:50
const Champ_Inc_base & inconnue() const override=0
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
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
DoubleVect & porosite_elem()
Definition Milieu_base.h:58
virtual const Champ_base & masse_volumique() const
Returns the mass density of the medium (const version).
DoubleVect & porosite_face()
Definition Milieu_base.h:62
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
static int dimension
Definition Objet_U.h:94
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":
Base class for output streams.
Definition Sortie.h:52
_TYPE_ * addr()
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160
int line_size() const
Definition TRUSTVect.tpp:67
class Terme_Boussinesq_scalaire_PolyMAC_HFV_Face
void associer_domaines(const Domaine_dis_base &, const Domaine_Cl_dis_base &) override
void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={}) const override
Classe Terme_Boussinesq_base This class represents the gravity term appearing in the momentum equatio...
double Scalaire0(int i) const
const Convection_Diffusion_std & equation_scalaire() const
const Champ_Don_base & gravite() const
const Champ_Don_base & beta() const