TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_Elem_PolyMAC_MPFA.cpp
1/****************************************************************************
2* Copyright (c) 2026, 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 <Champ_Elem_PolyMAC_MPFA.h>
17#include <Connectivite_som_elem.h>
18#include <Domaine_PolyMAC_MPFA.h>
19#include <Domaine_Cl_PolyMAC_family.h>
20#include <Pb_Multiphase.h>
21
22Implemente_instanciable(Champ_Elem_PolyMAC_MPFA,"Champ_Elem_PolyMAC_MPFA",Champ_Elem_PolyMAC_HFV);
23
24Sortie& Champ_Elem_PolyMAC_MPFA::printOn(Sortie& s) const { return s << que_suis_je() << " " << le_nom(); }
25
27
29{
30 return ref_cast(Domaine_PolyMAC_MPFA, le_dom_VF.valeur());
31}
32
38
40{
41 if (! via_ch_fonc_reprise()) return Champ_Inc_base::reprendre(fich); /* ie: resume last time ! */
42
43 const Pb_Multiphase * pbm = mon_equation_non_nul() ? (sub_type(Pb_Multiphase, equation().probleme()) ? &ref_cast(Pb_Multiphase, equation().probleme()) : nullptr) : nullptr;
44 if (pbm) return Champ_Inc_base::reprendre(fich);
45
46 // sinon on fait ca ...
47 const Domaine_PolyMAC_MPFA* domaine = le_dom_VF ? &ref_cast( Domaine_PolyMAC_MPFA,le_dom_VF.valeur()) : nullptr;
48 valeurs().set_md_vector(MD_Vector()); //on enleve le MD_Vector...
49 valeurs().resize(0);
50 int ret = Champ_Inc_base::reprendre(fich);
51 //et on remet le bon si on peut
52 if (domaine) valeurs().set_md_vector(valeurs().dimension_tot(0) > domaine->nb_elem_tot() ? domaine->mdv_elems_faces : domaine->domaine().md_vector_elements());
53 return ret;
54}
55
56void Champ_Elem_PolyMAC_MPFA::init_grad(int full_stencil) const
57{
58 if (fgrad_d.size()) return;
59 const IntTab& f_cl = fcl();
60 const Domaine_PolyMAC_MPFA& domaine = ref_cast(Domaine_PolyMAC_MPFA, le_dom_VF.valeur());
61 const Conds_lim& cls = domaine_Cl_dis().les_conditions_limites(); // CAL du champ a deriver
62 domaine.fgrad(1, 0, cls, f_cl, nullptr, nullptr, 1, full_stencil, fgrad_d, fgrad_e, fgrad_w);
63}
64
65void Champ_Elem_PolyMAC_MPFA::calc_grad(int full_stencil) const
66{
67 if (grad_a_jour) return;
68 const IntTab& f_cl = fcl();
69 const Domaine_PolyMAC_MPFA& domaine = ref_cast(Domaine_PolyMAC_MPFA, le_dom_VF.valeur());
70 const Conds_lim& cls = domaine_Cl_dis().les_conditions_limites(); // CAL du champ a deriver
71 domaine.fgrad(1, 0, cls, f_cl, nullptr, nullptr, 1, full_stencil, fgrad_d, fgrad_e, fgrad_w);
72 grad_a_jour = 1;
74}
: class Champ_Elem_PolyMAC_HFV
: class Champ_Elem_PolyMAC_MPFA
const Domaine_PolyMAC_MPFA & domaine_PolyMAC_MPFA() const
void calc_grad(int full_stencil) const
int reprendre(Entree &fich) override
Reprise d'un Objet_U sur un flot d'entree Methode a surcharger.
void mettre_a_jour(double tps) override
mettre_a_jour de la classe de base Champ_base :ne fait rien !
void init_grad(int full_stencil) const
const IntTab & fcl() const
const Domaine & domaine() const
const Domaine_Cl_dis_base & domaine_Cl_dis() const
DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ au temps courant.
int reprendre(Entree &) override
Lecture d'un champ inconnue a partir d'un flot d'entree en vue d'une reprise.
bool via_ch_fonc_reprise() const
double temps() const
Renvoie le temps du champ.
virtual void mettre_a_jour(double)
mettre_a_jour de la classe de base Champ_base :ne fait rien !
classe Conds_lim Cette classe represente un vecteur de conditions aux limites.
Definition Conds_lim.h:32
const Cond_lim & les_conditions_limites(int) const
Renvoie la i-ieme condition aux limites.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Nom & le_nom() const override
Renvoie le nom du champ.
: Cette classe est un OWN_PTR mais l'objet pointe est partage entre plusieurs
Definition MD_Vector.h:48
int mon_equation_non_nul() const
Definition MorEqn.h:85
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
classe Pb_Multiphase Cette classe represente un probleme de thermohydraulique multiphase de type "3*N...
Classe de base des flux de sortie.
Definition Sortie.h:52
void set_md_vector(const MD_Vector &) override
Definition TRUSTTab.tpp:673
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469