TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Operateur_Conv.cpp
1/****************************************************************************
2* Copyright (c) 2025, 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 <Op_Conv_negligeable.h>
18#include <Operateur_Conv.h>
19#include <Perf_counters.h>
20#include <Champ_base.h>
21
22Implemente_instanciable(Operateur_Conv,"Operateur_Conv",OWN_PTR(Operateur_Conv_base));
23// XD convection_deriv objet_lecture convection_deriv NO_BRACE not_set
24// XD bloc_convection objet_lecture nul NO_BRACE not_set
25// XD attr aco chaine(into=["{"]) aco REQ Opening curly bracket.
26// XD attr operateur convection_deriv operateur REQ not_set
27// XD attr acof chaine(into=["}"]) acof REQ Closing curly bracket.
28
29/* Here we put the doc for all shared (VDF, VEF,...) keywords: */
30
31// XD convection_negligeable convection_deriv negligeable NO_BRACE For VDF and VEF discretizations. Suppresses the
32// XD_CONT convection operator.
33
34// XD convection_amont convection_deriv amont NO_BRACE Keyword for upwind scheme for VDF or VEF discretizations.
35
36// XD convection_centre convection_deriv centre NO_BRACE For VDF and VEF discretizations.
37
38// XD convection_centre4 convection_deriv centre4 NO_BRACE For VDF and VEF discretizations.
39
40
41Sortie& Operateur_Conv::printOn(Sortie& os) const
42{
43 return Operateur::ecrire(os);
44}
45
46Entree& Operateur_Conv::readOn(Entree& is)
47{
49 if ((mon_equation->le_nom() == "pb_sensibiliteNavier_Stokes_standard_sensibility") && (valeur().que_suis_je()!="Op_Conv_sensibility_VEF_P1NC"))
50 {
51 Cerr<<" You should use the sensibility convection operator within Navier_Stokes_standard_sensibility equation "<<finl;
52 Cerr<<" Exemple: convection { sensibility { amont } } "<<finl;
53 exit();
54 }
55
56 if (!sub_type(Op_Conv_negligeable, valeur()) && mon_equation->domaine_dis().domaine().que_suis_je().contient("ALE") && !valeur().que_suis_je().contient("ALE"))
57 {
58 Cerr<<" You should use the ALE convection operator within the Navier_Stokes_standard_ALE/Navier_Stokes_Turbulent_ALE equation "<<finl;
59 Cerr<<" Exemple: convection { ALE amont } "<<finl;
61 }
62
63 return is;
64}
65
66/*! @brief Type l'operateur: "Op_Conv" + motcle + discretisation + inconnue
67 *
68 * Associe la vitesse transportante a l'operateur base
69 *
70 */
72{
73 if (Motcle(typ)==Motcle("negligeable"))
74 OWN_PTR(Operateur_Conv_base)::typer("Op_Conv_negligeable");
75 else
76 {
77 Equation_base& eqn=mon_equation.valeur();
78 Nom nom_type=eqn.discretisation().get_name_of_type_for(que_suis_je(),typ,eqn,vitesse());
79 OWN_PTR(Operateur_Conv_base)::typer(nom_type);
80 valeur().associer_vitesse(vitesse());
81 }
82 Cerr << valeur().que_suis_je() << finl;
83}
84
85/*! @brief Ajoute la contribution de l'operateur au tableau passe en parametre
86 *
87 * @param (DoubleTab& donnee) tableau contenant les donnees sur lesquelles on applique l'operateur.
88 * @param (DoubleTab& resu) tableau auquel on ajoute la contribution de l'operateur
89 * @return (DoubleTab&) le tableau contenant le resultat
90 */
91DoubleTab& Operateur_Conv::ajouter(const DoubleTab& donnee,
92 DoubleTab& resu) const
93{
94 statistics().begin_count(STD_COUNTERS::convection,statistics().get_last_opened_counter_level()+1);
95 DoubleTab& tmp = valeur().ajouter(donnee, resu);
96 statistics().end_count(STD_COUNTERS::convection);
97 return tmp;
98}
99
100/*! @brief Initialise le tableau passe en parametre avec la contribution de l'operateur.
101 *
102 * @param (DoubleTab& donnee) tableau contenant les donnees sur lesquelles on applique l'operateur.
103 * @param (DoubleTab& resu) tableau dans lequel stocke la contribution de l'operateur
104 * @return (DoubleTab&) le tableau contenant le resultat
105 */
106DoubleTab& Operateur_Conv::calculer(const DoubleTab& donnee,
107 DoubleTab& resu) const
108{
109 statistics().begin_count(STD_COUNTERS::convection,statistics().get_last_opened_counter_level()+1);
110 DoubleTab& tmp = valeur().calculer(donnee, resu);
111 statistics().end_count(STD_COUNTERS::convection);
112 return tmp;
113}
114
116{
117 assert( op_non_nul() );
118 valeur().associer_norme_vitesse(norme_vitesse);
119}
classe Champ_base Cette classe est la base de la hierarchie des champs.
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
remplit le Nom type en focntion de la classe de operateur, du type de l'operateur et de l'equation
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
const Discretisation_base & discretisation() const
Renvoie la discretisation associee a l'equation.
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
classe Operateur_Conv_base Cette classe est la base de la hierarchie des operateurs representant
classe Operateur_Conv Classe generique de la hierarchie des operateurs representant un terme
void typer() override
Type l'operateur: "Op_Conv" + motcle + discretisation + inconnue.
DoubleTab & calculer(const DoubleTab &, DoubleTab &) const override
Initialise le tableau passe en parametre avec la contribution de l'operateur.
DoubleTab & ajouter(const DoubleTab &, DoubleTab &) const override
Ajoute la contribution de l'operateur au tableau passe en parametre.
const Champ_base & vitesse() const
Renvoie la vitesse transportante de l'operateur.
void associer_norme_vitesse(const Champ_base &)
int op_non_nul() const override
Entree & lire(Entree &)
Lit un operateur sur un flot d'entree.
Definition Operateur.cpp:44
Sortie & ecrire(Sortie &) const
Definition Operateur.cpp:24
Motcle typ
Definition Operateur.h:76
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52