TrioCFD 1.9.9_beta
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 // otherwise do this ...
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()); //remove the MD_Vector...
49 valeurs().resize(0);
50 int ret = Champ_Inc_base::reprendre(fich);
51 //restore the correct one if possible
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(); // boundary conditions for the field to differentiate
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(); // boundary conditions for the field to differentiate
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
Restores an Objet_U from an input stream. Virtual method to override.
void mettre_a_jour(double tps) override
Update of the base class Champ_base: does nothing!
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
Returns the array of field values at the current time.
int reprendre(Entree &) override
Reads an unknown field from an input stream for a restart.
bool via_ch_fonc_reprise() const
double temps() const
Returns the time of the field.
virtual void mettre_a_jour(double)
Update of the base class Champ_base: does nothing!
class Conds_lim This class represents a vector of boundary conditions.
Definition Conds_lim.h:32
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Nom & le_nom() const override
Returns the name of the field.
: This class is an OWN_PTR but the pointed object is shared among multiple
Definition MD_Vector.h:48
int mon_equation_non_nul() const
Definition MorEqn.h:85
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":
Base class for output streams.
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