TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Operateur_Diff.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 <Discretisation_base.h>
17#include <Operateur_Diff.h>
18#include <Champ_base.h>
19
20Implemente_instanciable(Operateur_Diff,"Operateur_Diff",OWN_PTR(Operateur_Diff_base));
21// XD diffusion_deriv objet_lecture diffusion_deriv NO_BRACE not_set
22// XD bloc_diffusion objet_lecture nul NO_BRACE not_set
23// XD attr aco chaine(into=["{"]) aco REQ Opening curly bracket.
24// XD attr operateur diffusion_deriv operateur OPT if none is specified, the diffusive scheme used is a 2nd-order
25// XD_CONT scheme.
26// XD attr op_implicite op_implicite op_implicite OPT To have diffusive implicitation, it use Uzawa algorithm. Very
27// XD_CONT useful when viscosity has large variations.
28// XD attr acof chaine(into=["}"]) acof REQ Closing curly bracket.
29
30/* Here we put the doc for all shared (VDF, VEF,...) keywords: */
31
32// XD diffusion_negligeable diffusion_deriv negligeable NO_BRACE the diffusivity will not taken in count
33
34// XD diffusion_option diffusion_deriv option NO_BRACE not_set
35// XD attr bloc_lecture bloc_lecture bloc_lecture REQ not_set
36
37Sortie& Operateur_Diff::printOn(Sortie& os) const
38{
39 return Operateur::ecrire(os);
40}
41
42Entree& Operateur_Diff::readOn(Entree& is)
43{
44 return Operateur::lire(is);
45}
46
47/*! @brief Types the operator: types as "Op_Diff_"+discretisation() + ("_" or "_Multi_inco_") + inconnue().suffix
48 * Associates the diffusivity to the base operator.
49 *
50 */
52{
53 Cerr << "Operateur_Diff::typer("<<typ<<")" << finl;
54 if (Motcle(typ)==Motcle("negligeable"))
55 {
56 OWN_PTR(Operateur_Diff_base)::typer("Op_Diff_negligeable");
57 valeur().associer_diffusivite(diffusivite());
58 }
59 else
60 {
61 assert(la_diffusivite);
62 Equation_base& eqn=mon_equation.valeur();
63 Nom nom_type= eqn.discretisation().get_name_of_type_for(que_suis_je(),typ,eqn,diffusivite());
64 OWN_PTR(Operateur_Diff_base)::typer(nom_type);
65 valeur().associer_diffusivite(diffusivite());
66 }
67 Cerr << valeur().que_suis_je() << finl;
68}
69
70/*! @brief Returns the underlying object upcast to Operateur_base
71 *
72 * @return (Operateur_base&) the underlying object upcast to Operateur_base
73 */
75{
76 return valeur();
77}
78/*! @brief Returns the underlying object upcast to Operateur_base (const version)
79 *
80 * @return (Operateur_base&) the underlying object upcast to Operateur_base
81 */
83{
84 return valeur();
85}
86
87/*! @brief Call to the underlying object.
88 *
89 * Adds the contribution of the operator to the array
90 * passed as parameter
91 *
92 * @param (DoubleTab& donnee) array containing the data on which the operator is applied.
93 * @param (DoubleTab& resu) array to which the contribution of the operator is added
94 * @return (DoubleTab&) the array containing the result
95 */
96DoubleTab& Operateur_Diff::ajouter(const DoubleTab& donnee,
97 DoubleTab& resu) const
98{
99 statistics().begin_count(STD_COUNTERS::diffusion,statistics().get_last_opened_counter_level()+1);
100 DoubleTab& tmp = valeur().ajouter(donnee, resu);
101 statistics().end_count(STD_COUNTERS::diffusion);
102 return tmp;
103}
104
105/*! @brief Call to the underlying object.
106 *
107 * Initializes the array passed as parameter with the contribution
108 * of the operator.
109 *
110 * @param (DoubleTab& donnee) array containing the data on which the operator is applied.
111 * @param (DoubleTab& resu) array in which the contribution of the operator is stored
112 * @return (DoubleTab&) the array containing the result
113 */
114DoubleTab& Operateur_Diff::calculer(const DoubleTab& donnee,
115 DoubleTab& resu) const
116{
117 statistics().begin_count(STD_COUNTERS::diffusion,statistics().get_last_opened_counter_level()+1);
118 DoubleTab& tmp = valeur().calculer(donnee, resu);
119 statistics().end_count(STD_COUNTERS::diffusion);
120 return tmp;
121}
122
123
124/*! @brief Returns the field representing the diffusivity.
125 *
126 * @return (Champ_Don_base&) the field representing the diffusivity
127 */
129{
130 return la_diffusivite.valeur();
131}
132
133
134/*! @brief Associates the diffusivity to the operator.
135 *
136 * @param (Champ_Don_base& nu) the field representing the diffusivity
137 * @return the field representing the diffusivity
138 */
140{
141 la_diffusivite=nu;
142}
143
145{
146 valeur().associer_diffusivite_pour_pas_de_temps(nu);
147}
148
150{
151 valeur().associer_diffusivite_volumique(champ);
152}
153
154/*! @brief Types the operator.
155 *
156 * @param (Nom& typ) the name representing the type of the operator
157 */
158void Operateur_Diff::typer(const Nom& un_type)
159{
160 OWN_PTR(Operateur_Diff_base)::typer(un_type);
161}
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
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.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Equation_base The role of an equation is the calculation of one or more fields....
const Discretisation_base & discretisation() const
Returns the discretization associated with the equation.
A character string (Nom) in uppercase.
Definition Motcle.h:26
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
Operateur_Diff_base This class is the base of the hierarchy of operators representing.
Operateur_Diff Generic class of the hierarchy of operators representing a diffusion.
DoubleTab & ajouter(const DoubleTab &, DoubleTab &) const override
Call to the underlying object.
const Champ_base & diffusivite() const
Returns the field representing the diffusivity.
void associer_diffusivite_pour_pas_de_temps(const Champ_base &)
void associer_diffusivite(const Champ_base &)
Associates the diffusivity to the operator.
void associer_diffusivite_volumique(const Champ_base &)
void typer() override
Types the operator: types as "Op_Diff_"+discretisation() + ("_" or "_Multi_inco_") + inconnue()....
DoubleTab & calculer(const DoubleTab &, DoubleTab &) const override
Call to the underlying object.
Operateur_base & l_op_base() override
Returns the underlying object upcast to Operateur_base.
class Operateur_base This class is the base of the hierarchy of objects representing an
Entree & lire(Entree &)
Reads an operator from an input stream.
Definition Operateur.cpp:44
Sortie & ecrire(Sortie &) const
Definition Operateur.cpp:24
Motcle typ
Definition Operateur.h:76
Base class for output streams.
Definition Sortie.h:52