TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Discretisation_base.h
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#ifndef Discretisation_base_included
17#define Discretisation_base_included
18
19#include <Domaine_forward.h>
20#include <Champ_base.h> // For Nature_du_champ
21
22#include <TRUST_Ref.h>
23#include <Reorder_Mesh.h>
24
28class Champ_Fonc_base;
29class Champ_Inc_base;
30class Champ_Don_base;
31class Probleme_base;
32class Equation_base;
33class Champ_base;
34class Motcle;
35
36/*! @brief class Discretisation_base This class represents a spatial discretization scheme, which
37 *
38 * will be associated with a problem. Discretisation_base is the
39 * abstract class that is the basis of the hierarchy of
40 * spatial discretizations.
41 *
42 * @sa Probleme_base, Abstract class from which all spatial discretizations must derive., Abstract method:, void domaine_Cl_dis(Domaine_dis_base& , Domaine_Cl_dis_base& ) const
43 */
45{
46 Declare_base(Discretisation_base);
47
48public :
49
50 // MODIF ELI LAUCOIN (7/06/2007):
51 // Adding a pure virtual method that specifies the mode of assembling contributions to the residual of operators and sources.
52 //
53 // By default, in TRUST, we go through contribuer_a_avec, then through ajouter. In the porous modules MTMS (and EF?), we rather go through contribuer_a_avec and
54 // contribuer_au_second_membre, because we do not use a priori a convection scheme (like Quick) for which the Jacobian is not exact.
55 //
56 // The default value returned is VIA_AJOUTER, so as not to disturb the normal behavior of Trio-U classes outside the kernel.
57 //
60
61 void associer_domaine(const Domaine& dom);
62
63 virtual Nom domaine_cl_dis_type() const = 0;
64
65 virtual void discretiser_variables() const;
66 virtual Domaine_dis_base& discretiser() const;
67
68 // Creation of scalar or vector fields (essentially call to the general method, do not overload these methods, they are only here for convenience)
69 void discretiser_champ(const Motcle& directive, const Domaine_dis_base& z, const Nom& nom, const Nom& unite, int nb_comp, int nb_pas_dt, double temps, OWN_PTR(Champ_Inc_base)& champ,
70 const Nom& sous_type=NOM_VIDE) const;
71 void discretiser_champ(const Motcle& directive, const Domaine_dis_base& z, const Nom& nom, const Nom& unite, int nb_comp, double temps, OWN_PTR(Champ_Fonc_base)& champ) const;
72 void discretiser_champ(const Motcle& directive, const Domaine_dis_base& z, const Nom& nom, const Nom& unite, int nb_comp, double temps, OWN_PTR(Champ_Don_base)& champ) const;
73
74 // Creation of general fields (possibly multiscalar):
75 // * These methods must be overloaded.
76 // * Each method includes the demande_description keyword, which causes the display of all understood directives (and calls the ancestor with the same keyword).
77 // * If scalar or vector field, the first name and first unit are used
78 virtual void discretiser_champ(const Motcle& directive, const Domaine_dis_base& z, Nature_du_champ nature, const Noms& nom, const Noms& unite, int nb_comp, int nb_pas_dt, double temps,
79 OWN_PTR(Champ_Inc_base)& champ, const Nom& sous_type=NOM_VIDE) const;
80 virtual void discretiser_champ(const Motcle& directive, const Domaine_dis_base& z, Nature_du_champ nature, const Noms& nom, const Noms& unite, int nb_comp, double temps, OWN_PTR(Champ_Fonc_base)& champ) const;
81 virtual void discretiser_champ(const Motcle& directive, const Domaine_dis_base& z, Nature_du_champ nature, const Noms& nom, const Noms& unite, int nb_comp, double temps, OWN_PTR(Champ_Don_base)& champ) const;
82
83 void nommer_completer_champ_physique(const Domaine_dis_base& domaine_vdf, const Nom& nom_champ, const Nom& unite, Champ_base& champ, const Probleme_base& pbi) const;
84 int verifie_sous_type(Nom& type, const Nom& sous_type, const Motcle& directive) const;
85
86 void volume_maille(const Schema_Temps_base& sch, const Domaine_dis_base& z, OWN_PTR(Champ_Fonc_base)& ch) const;
87 void mesh_numbering(const Schema_Temps_base& sch, const Domaine_dis_base& z, OWN_PTR(Champ_Fonc_base)& ch) const;
88 virtual void residu(const Domaine_dis_base&, const Champ_Inc_base&, OWN_PTR(Champ_Fonc_base)&) const;
89
90 static void creer_champ(OWN_PTR(Champ_Inc_base)& ch, const Domaine_dis_base& z, const Nom& type, const Nom& nom, const Nom& unite, int nb_comp, int nb_ddl, int nb_pas_dt, double temps,
91 const Nom& directive=NOM_VIDE, const Nom& nom_discretisation=NOM_VIDE);
92 static void creer_champ(OWN_PTR(Champ_Fonc_base)& ch, const Domaine_dis_base& z, const Nom& type, const Nom& nom, const Nom& unite, int nb_comp, int nb_ddl, double temps, const Nom& directive = NOM_VIDE,
93 const Nom& nom_discretisation=NOM_VIDE);
94 static void creer_champ(OWN_PTR(Champ_Don_base)& ch, const Domaine_dis_base& z, const Nom& type, const Nom& nom, const Nom& unite, int nb_comp, int nb_ddl, double temps, const Nom& directive = NOM_VIDE,
95 const Nom& nom_discretisation=NOM_VIDE);
96
97 virtual Nom get_name_of_type_for(const Nom& class_operateur, const Nom& type_operteur,const Equation_base& eqn, const OBS_PTR(Champ_base)& champ_supp =OBS_PTR(Champ_base)()) const;
98
99 // usefull methods to detect discretization
100 virtual bool is_ef() const { return false; }
101 virtual bool is_dg() const { return false; }
102 virtual bool is_vdf() const { return false; }
103 virtual bool is_vef() const { return false; }
104 virtual bool is_PolyMAC_CDO() const { return false; }
105 virtual bool is_PolyMAC_MPFA() const { return false; }
106 virtual bool is_PolyMAC_HFV() const { return false; }
107 virtual bool is_poly_family() const { return false; }
108 virtual bool is_coloc() const { return false; }
109
110 const Reorder_Mesh& get_reorder() const { return reorder_; }
111
112protected:
114 static const Nom NOM_VIDE;
115 OBS_PTR(Domaine) le_domaine_;
116 Reorder_Mesh reorder_; ///< Helper object to renumber entities (nodes, elems, faces) if requested
117
118private:
119 void test_demande_description(const Motcle& , const Nom&) const;
120 static void champ_fixer_membres_communs(Champ_base& ch, const Domaine_dis_base& z, const Nom& type, const Nom& nom, const Nom& unite, int nb_comp, int nb_ddl, double temps);
121
122 virtual void modifier_champ_tabule(const Domaine_dis_base& domaine_dis,Champ_Fonc_Tabule& ch_tab,const VECT(OBS_PTR(Champ_base))& ch_inc) const ;
123};
124
125using Discretisation = TRUST_Deriv<Discretisation_base>;
126
127#endif /* Discretisation_base_included */
class Champ_Don_base base class of Given Fields (not calculated)
Class Champ_Fonc_Tabule Derived class of Champ_Fonc_base representing.
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
Class Champ_Inc_base.
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
class Discretisation_base This class represents a spatial discretization scheme, which
virtual void discretiser_variables() const
void nommer_completer_champ_physique(const Domaine_dis_base &domaine_vdf, const Nom &nom_champ, const Nom &unite, Champ_base &champ, const Probleme_base &pbi) const
virtual bool is_poly_family() const
virtual bool is_dg() const
virtual bool is_ef() const
virtual bool is_vdf() const
void mesh_numbering(const Schema_Temps_base &sch, const Domaine_dis_base &z, OWN_PTR(Champ_Fonc_base)&ch) const
virtual Domaine_dis_base & discretiser() const
OBS_PTR(Domaine) le_domaine_
virtual bool is_PolyMAC_MPFA() const
virtual Nom domaine_cl_dis_type() const =0
static void creer_champ(OWN_PTR(Champ_Inc_base)&ch, const Domaine_dis_base &z, const Nom &type, const Nom &nom, const Nom &unite, int nb_comp, int nb_ddl, int nb_pas_dt, double temps, const Nom &directive=NOM_VIDE, const Nom &nom_discretisation=NOM_VIDE)
Static method that creates an OWN_PTR(Champ_Inc_base) of the specified type.
Reorder_Mesh reorder_
Helper object to renumber entities (nodes, elems, faces) if requested.
void volume_maille(const Schema_Temps_base &sch, const Domaine_dis_base &z, OWN_PTR(Champ_Fonc_base)&ch) const
virtual Nom get_name_of_type_for(const Nom &class_operateur, const Nom &type_operteur, const Equation_base &eqn, const OBS_PTR(Champ_base)&champ_supp=OBS_PTR(Champ_base)()) const
Fills the Nom type depending on the class of operator, the type of operator and the equation.
virtual bool is_vef() const
virtual bool is_coloc() const
void associer_domaine(const Domaine &dom)
static const Nom NOM_VIDE
virtual bool is_PolyMAC_CDO() const
virtual bool is_PolyMAC_HFV() const
static const Motcle DEMANDE_DESCRIPTION
virtual type_calcul_du_residu codage_du_calcul_du_residu() const
virtual void residu(const Domaine_dis_base &, const Champ_Inc_base &, OWN_PTR(Champ_Fonc_base)&) const
void discretiser_champ(const Motcle &directive, const Domaine_dis_base &z, const Nom &nom, const Nom &unite, int nb_comp, int nb_pas_dt, double temps, OWN_PTR(Champ_Inc_base)&champ, const Nom &sous_type=NOM_VIDE) const
const Reorder_Mesh & get_reorder() const
int verifie_sous_type(Nom &type, const Nom &sous_type, const Motcle &directive) const
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
class Equation_base The role of an equation is the calculation of one or more fields....
A character string (Nom) in uppercase.
Definition Motcle.h:26
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
An array of character strings (VECT(Nom)).
Definition Noms.h:26
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
Definition Objet_U.cpp:54
class Probleme_base It is a Probleme_U that is not a coupling.
Reorder_Mesh allows the user to trigger the renumbering of the mesh entities.
class Schema_Temps_base