TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_Elem_PolyMAC_HFV.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 <Champ_Elem_PolyMAC_HFV.h>
17#include <Domaine_PolyMAC_HFV.h>
18#include <Connectivite_som_elem.h>
19#include <Domaine_Cl_PolyMAC_family.h>
20#include <MD_Vector_base.h>
21
22#include <Pb_Multiphase.h>
23
24Implemente_instanciable(Champ_Elem_PolyMAC_HFV,"Champ_Elem_PolyMAC_HFV",Champ_Elem_PolyMAC_CDO);
25
26Sortie& Champ_Elem_PolyMAC_HFV::printOn(Sortie& s) const { return s << que_suis_je() << " " << le_nom(); }
27
29
31{
32 return ref_cast(Domaine_PolyMAC_HFV, le_dom_VF.valeur());
33}
34
36{
37 assert (n == domaine_dis_base().domaine().nb_elem() || n < 0); //accept both VEF and VDF conventions
38 creer_tableau_distribue(domaine_dis_base().domaine().md_vector_elements());
39 return n;
40}
41
43{
44 return le_dom_VF->nb_elem(); //ignore auxiliary variables
45}
46
48{
50 const IntTab& f_e = domaine.face_voisins();
51 for (int n = 0; n < nb_valeurs_temporelles(); n++)
52 if (futur(n).size_reelle_ok())
53 {
54 DoubleTab& vals = futur(n);
55 vals.set_md_vector(MD_Vector()); //remove the MD_Vector...
56 vals.resize_dim0(domaine.mdv_elems_faces->get_nb_items_tot()); //...resize to the correct size...
57 vals.set_md_vector(domaine.mdv_elems_faces); //...and restore the correct MD_Vector
58 /* initialize face variables: using the value of the upstream element */
59 for (int f = 0, ne_tot = domaine.nb_elem_tot(); f < domaine.nb_faces(); f++)
60 for (int m = 0, e = f_e(f, 0); m < vals.dimension(1); m++)
61 vals(ne_tot + f, m) = vals(e, m);
63 }
64}
65
67{
68 if (! via_ch_fonc_reprise()) return Champ_Inc_base::reprendre(fich); /* ie: resume last time ! */
69
70 const Pb_Multiphase * pbm = mon_equation_non_nul() ? (sub_type(Pb_Multiphase, equation().probleme()) ? &ref_cast(Pb_Multiphase, equation().probleme()) : nullptr) : nullptr;
71 if (pbm) return Champ_Inc_base::reprendre(fich);
72
73 // otherwise do this ...
75 return Champ_Inc_base::reprendre(fich);
76}
77
79{
81 if (domaine.nb_elem_tot() > 0 && ch.valeurs().dimension_tot(0) > domaine.nb_elem_tot())
83 else
84 {
85 DoubleTab_parts part(valeurs());
86 for (int i = 0; i < part.size(); i++) ch.valeur_aux(i ? domaine.xv() : domaine.xp(), part[i]);
88 }
89 return *this;
90}
: class Champ_Elem_PolyMAC_HFV
int reprendre(Entree &fich) override
Restores an Objet_U from an input stream. Virtual method to override.
int fixer_nb_valeurs_nodales(int n) override
int nb_valeurs_nodales() const override
const Domaine_PolyMAC_HFV & domaine_PolyMAC_HFV() const
Champ_base & affecter_(const Champ_base &ch) override
const Domaine & domaine() const
virtual void creer_tableau_distribue(const MD_Vector &, RESIZE_OPTIONS=RESIZE_OPTIONS::COPY_INIT)
DoubleTab & futur(int i=1) override
Returns field values at instant t+i.
virtual int nb_valeurs_temporelles() const
Returns the number of temporal values currently kept.
const Domaine_dis_base & domaine_dis_base() const override
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
virtual DoubleTab & valeurs()=0
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
virtual DoubleTab & valeur_aux(const DoubleTab &positions, DoubleTab &valeurs) const
Causes an error! Must be overridden by derived classes.
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
int size() const
void set_md_vector(const MD_Vector &) override
Definition TRUSTTab.tpp:673
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160
void resize_dim0(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:459
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")