TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Source_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 Source_base_included
17#define Source_base_included
18
19#include <Champs_compris_interface.h>
20#include <TRUSTTabs_forward.h>
21#include <Interface_blocs.h>
22
23#include <Champs_compris.h>
24#include <Matrice_Bloc.h>
25#include <SFichier.h>
26#include <MorEqn.h>
27
28class Probleme_base;
29class Matrice_Morse;
32class Champ_Don_base;
33
34/*! @brief Source_base A Source_base object is a term appearing on the right-hand side of an
35 *
36 * equation. This class is the base of the Sources hierarchy; a
37 * source is a piece of an equation, so Source_base inherits from MorEqn.
38 *
39 */
40
42{
43 Declare_base(Source_base);
44
45public:
46
47 virtual DoubleTab& ajouter(DoubleTab&) const;
48 virtual DoubleTab& calculer(DoubleTab&) const;
49 virtual void mettre_a_jour(double temps);
50 virtual void resetTime(double t);
51 virtual void completer();
52 virtual void dimensionner(Matrice_Morse&) const;
53 virtual void dimensionner_bloc_vitesse(Matrice_Morse&) const;
54 virtual void contribuer_a_avec(const DoubleTab&, Matrice_Morse&) const;
55 virtual void contribuer_au_second_membre(DoubleTab&) const;
56 virtual int impr(Sortie& os) const;
57 // temporary: associer_domaines will be made public
58 inline void associer_domaines_public(const Domaine_dis_base& zdis, const Domaine_Cl_dis_base& zcldis) { associer_domaines(zdis,zcldis); }
59 virtual int initialiser(double temps);
60 virtual void discretiser() {}
61 virtual void associer_champ_rho(const Champ_base& champ_rho);
62 virtual int a_pour_Champ_Fonc(const Motcle& mot, OBS_PTR(Champ_base) &ch_ref) const;
63 virtual void contribuer_jacobienne(Matrice_Bloc&, int) const { }
64 virtual int reprendre(Entree& ) override { return 1; }
65 virtual int sauvegarder(Sortie& ) const override { return 0; }
66
67 /* interface {dimensionner,ajouter}_blocs -> cf Equation_base.h */
68 virtual int has_interface_blocs() const { return 0; }
69 virtual void dimensionner_blocs(matrices_t matrices, const tabs_t& semi_impl = { }) const;
70 virtual void ajouter_blocs(matrices_t matrices, DoubleTab& secmem, const tabs_t& semi_impl = { }) const;
71
72 // Methods of the post-processable fields interface
73 /////////////////////////////////////////////////////
74 void creer_champ(const Motcle& motlu) override { }
75 const Champ_base& get_champ(const Motcle& nom) const override;
76 bool has_champ(const Motcle& nom, OBS_PTR(Champ_base) &ref_champ) const override;
77 bool has_champ(const Motcle& nom) const override;
78 void get_noms_champs_postraitables(Noms& nom, Option opt = NONE) const override;
79 /////////////////////////////////////////////////////
80
81 virtual void ouvrir_fichier(SFichier& os, const Nom&, const int flag = 1) const;
82 void set_fichier(const Nom&);
83 inline void set_description(const Nom& nom) { description_ = nom; }
84 inline void set_col_names(const Noms& col_names) { col_names_ = col_names; }
85 inline const Nom fichier() const { return out_; }
86 inline const Nom description() const { return description_; }
87
88 inline DoubleVect& bilan() { return bilan_; }
89 inline DoubleVect& bilan() const { return bilan_; }
90 inline Champs_compris& champs_compris() { return champs_compris_; }
91
92 // Liste des champs des sources:
93 const LIST(OBS_PTR(Champ_Don_base))& champs_don() const { return champs_don_; }
94
95protected:
96
98 virtual void associer_pb(const Probleme_base&) =0;
99 int col_width_ = 0;
100 Nom out_; // Name of the .out file for output
102 Noms col_names_; // column names (optional)
103 mutable DoubleVect bilan_; // Vector containing the source term values in the domain
104 mutable SFichier Flux;
105 Champs_compris champs_compris_;
107};
108
109#endif /* Source_base_included */
class Champ_Don_base base class of Given Fields (not calculated)
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
class Champs_compris_interface This class contains an interface of methods intended to manage
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
Matrice_Morse class - Represents a (sparse) matrix M, not necessarily square,.
class MorEqn Class that groups the functionalities of linking with an
Definition MorEqn.h:35
OBS_PTR(Equation_base) mon_equation
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
friend class Entree
Definition Objet_U.h:71
friend class Sortie
Definition Objet_U.h:70
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.
SFichier is to the C++ ofstream class what Sortie is to the C++ ostream class.
Definition SFichier.h:29
Source_base A Source_base object is a term appearing on the right-hand side of an.
Definition Source_base.h:42
LIST(OBS_PTR(Champ_Don_base)) champs_don_
void set_fichier(const Nom &)
virtual void mettre_a_jour(double temps)
DOES NOTHING - to override in derived classes.
virtual void associer_pb(const Probleme_base &)=0
Champs_compris champs_compris_
const Nom fichier() const
Definition Source_base.h:85
DoubleVect & bilan()
Definition Source_base.h:88
const Champ_base & get_champ(const Motcle &nom) const override
virtual void associer_domaines(const Domaine_dis_base &, const Domaine_Cl_dis_base &)=0
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
const Nom description() const
Definition Source_base.h:86
virtual int impr(Sortie &os) const
void creer_champ(const Motcle &motlu) override
Definition Source_base.h:74
virtual void resetTime(double t)
DOES NOTHING - to override in derived classes.
Champs_compris & champs_compris()
Definition Source_base.h:90
virtual void associer_champ_rho(const Champ_base &champ_rho)
This method (or the method of the derived class) is called by Sources::associer_champ_rho for each so...
virtual DoubleTab & calculer(DoubleTab &) const
virtual void ouvrir_fichier(SFichier &os, const Nom &, const int flag=1) const
Opening/creation of a file for printing a source term. To override in derived classes.
virtual void contribuer_au_second_membre(DoubleTab &) const
contribution to the right-hand side of source terms implicitly, by default error
virtual int sauvegarder(Sortie &) const override
Saves an Objet_U to an output stream. Virtual method to override.
Definition Source_base.h:65
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
virtual int initialiser(double temps)
Unlike the mettre_a_jour methods, the initializer methods of sources cannot depend on the outside.
virtual void contribuer_a_avec(const DoubleTab &, Matrice_Morse &) const
contribution to the implicit matrix of source terms, by default no contribution
const LIST(OBS_PTR(Champ_Don_base)) &champs_don() const
Definition Source_base.h:93
virtual void contribuer_jacobienne(Matrice_Bloc &, int) const
Definition Source_base.h:63
void set_col_names(const Noms &col_names)
Definition Source_base.h:84
virtual void dimensionner_blocs(matrices_t matrices, const tabs_t &semi_impl={ }) const
DoubleVect & bilan() const
Definition Source_base.h:89
virtual void dimensionner_bloc_vitesse(Matrice_Morse &) const
void set_description(const Nom &nom)
Definition Source_base.h:83
virtual void completer()
Updates internal references of the Source_base object.
virtual int has_interface_blocs() const
Definition Source_base.h:68
SFichier Flux
virtual DoubleTab & ajouter(DoubleTab &) const
void associer_domaines_public(const Domaine_dis_base &zdis, const Domaine_Cl_dis_base &zcldis)
Definition Source_base.h:58
DoubleVect bilan_
virtual void discretiser()
Definition Source_base.h:60
virtual int a_pour_Champ_Fonc(const Motcle &mot, OBS_PTR(Champ_base) &ch_ref) const
If the source understands the keyword "mot", it fills the reference to ch_ref and returns 1,...
virtual void dimensionner(Matrice_Morse &) const
Sizing of the implicit matrix of source terms.
virtual int reprendre(Entree &) override
Restores an Objet_U from an input stream. Virtual method to override.
Definition Source_base.h:64
virtual void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={ }) const