TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_Inc_P0_base.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 <Echange_externe_impose.h>
17#include <Echange_global_impose.h>
18#include <Domaine_Cl_dis_base.h>
19#include <Domaine_Cl_dis_base.h>
20#include <Frontiere_dis_base.h>
21#include <Dirichlet_homogene.h>
22#include <Champ_Inc_P0_base.h>
23#include <Domaine_dis_base.h>
24#include <Neumann_homogene.h>
25#include <Neumann_val_ext.h>
26
27#include <Neumann_paroi.h>
28#include <Equation_base.h>
29#include <Dirichlet.h>
30#include <Symetrie.h>
31#include <Domaine.h>
32
33Implemente_base(Champ_Inc_P0_base,"Champ_Inc_P0_base",Champ_Inc_base);
34
36{
37 return os << que_suis_je() << " " << le_nom();
38}
39
41{
42 lire_donnees(is) ;
43 return is;
44}
45
47{
48 // Ugly syntax, otherwise we don't know whether to call
49 // domaine_dis_base() from champ_inc_base or from champ_impl...
50 const Domaine_dis_base& domainedis = ref_cast(Champ_Inc_base, *this).domaine_dis_base();
51 assert(n == domainedis.domaine().nb_elem());
52 const MD_Vector& md = domainedis.domaine().md_vector_elements();
54 return 1;
55}
56
62
64{
65 assert(le_dom_VF);
66 const DoubleTab& val = valeurs();
67 double la_val_bord;
68
69 int n0 = le_dom_VF->face_voisins(face, 0);
70 if (n0 != -1) la_val_bord = val[n0];
71 else la_val_bord = val[le_dom_VF->face_voisins(face, 1)];
72
73 return la_val_bord;
74}
75
76/*! @brief Trace of the P0 field on the boundary
77 *
78 */
79DoubleTab& Champ_Inc_P0_base::trace(const Frontiere_dis_base& fr, DoubleTab& x, double tps,int distant) const
80{
81 return Champ_implementation_P0::trace(fr, valeurs(tps), x, distant);
82}
83
84//utility functions for boundary conditions
86{
87 const Conds_lim& cls = mon_dom_cl_dis->les_conditions_limites();
88 int i, f, n;
89
90 const Domaine_VF& domaine = ref_cast(Domaine_VF, mon_equation->domaine_dis());
91 fcl_.resize(domaine.nb_faces_tot(), 3);
92 for (n = 0; n < cls.size(); n++)
93 {
94 const Front_VF& fvf = ref_cast(Front_VF, cls[n]->frontiere_dis());
95 int idx = sub_type(Echange_externe_impose, cls[n].valeur()) + 2 * sub_type(Echange_global_impose, cls[n].valeur())
96 + 4 * sub_type(Neumann_paroi, cls[n].valeur()) + 5 * (sub_type(Neumann_homogene, cls[n].valeur()) || sub_type(Neumann_val_ext, cls[n].valeur()) || sub_type(Symetrie, cls[n].valeur()))
97 + 6 * sub_type(Dirichlet, cls[n].valeur()) + 7 * sub_type(Dirichlet_homogene, cls[n].valeur());
98 if (cls[n]->que_suis_je().debute_par("Paroi_Echange_contact"))
99 idx = 3;
100 if (!idx)
101 {
102 Cerr << "Champ_Inc_P0_base : unhandled boundary condition encountered! " << cls[n]->que_suis_je() << finl;
104 }
105 for (i = 0; i < fvf.nb_faces_tot(); i++)
106 f = fvf.num_face(i), fcl_(f, 0) = idx, fcl_(f, 1) = n, fcl_(f, 2) = i;
107 }
108 fcl_init_ = 1;
109}
: class Champ_Inc_P0_base
virtual void init_fcl() const
double valeur_au_bord(int face) const
DoubleTab & trace(const Frontiere_dis_base &, DoubleTab &, double, int distant) const override
Trace of the P0 field on the boundary.
Champ_base & affecter_(const Champ_base &) override
Assignment of a generic OWN_PTR(Champ_base) (Champ_base) to an unknown field.
int fixer_nb_valeurs_nodales(int n) override
Class Champ_Inc_base.
const Domaine & domaine() const
virtual void creer_tableau_distribue(const MD_Vector &, RESIZE_OPTIONS=RESIZE_OPTIONS::COPY_INIT)
int lire_donnees(Entree &)
Reads the field values from an input stream.
DoubleTab & valeurs() override
Returns the array of field values at the current time.
Champ_base & affecter_(const Champ_base &) override
Assignment of a generic OWN_PTR(Champ_base) (Champ_base) to an unknown field.
Champ_base()
Default constructor of a Champ_base.
int affecter_(const Champ_base &)
DoubleTab & trace(const Frontiere_dis_base &fr, const DoubleTab &y, DoubleTab &x, int distant) const
class Conds_lim This class represents a vector of boundary conditions.
Definition Conds_lim.h:32
Classe Dirichlet_homogene This class is the base class of the hierarchy of homogeneous Dirichlet-type...
Dirichlet This class is the base class of the hierarchy of Dirichlet-type boundary conditions.
Definition Dirichlet.h:31
int_t nb_elem() const
Definition Domaine.h:131
virtual const MD_Vector & md_vector_elements() const
Returns the parallel descriptor of element arrays of the domain.
Definition Domaine.cpp:859
class Domaine_VF
Definition Domaine_VF.h:44
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
const Domaine & domaine() const
Classe Echange_externe_impose: This class represents the special case of the class.
Classe Echange_global_impose This class represents the special case of the class.
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.
class Front_VF
Definition Front_VF.h:36
int nb_faces_tot() const
Definition Front_VF.h:58
int num_face(const int) const
Definition Front_VF.h:68
class Frontiere_dis_base Class representing a discretized boundary.
: This class is an OWN_PTR but the pointed object is shared among multiple
Definition MD_Vector.h:48
Classe Neumann_homogene This class is the base class of the hierarchy of homogeneous Neumann-type bou...
Classe Neumann_paroi This boundary condition corresponds to an imposed flux for the.
Classe Neumann_val_ext This class is the base class of the hierarchy of.
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
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
Symetrie On symmetry faces, the following properties hold:
Definition Symetrie.h:37