TrioCFD 1.9.9_beta
TrioCFD documentation
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 Types the operator: "Op_Conv" + keyword + discretisation + unknown
67 *
68 * Associates the transporting velocity to the base operator
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 Adds the contribution of the operator to the array passed as parameter
86 *
87 * @param (DoubleTab& donnee) array containing the data on which the operator is applied.
88 * @param (DoubleTab& resu) array to which the contribution of the operator is added
89 * @return (DoubleTab&) the array containing the result
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 Initializes the array passed as parameter with the contribution of the operator.
101 *
102 * @param (DoubleTab& donnee) array containing the data on which the operator is applied.
103 * @param (DoubleTab& resu) array in which the contribution of the operator is stored
104 * @return (DoubleTab&) the array containing the result
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}
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_Conv_base This class is the base of the hierarchy of operators representing.
Operateur_Conv Generic class of the hierarchy of operators representing a convection term.
void typer() override
Types the operator: "Op_Conv" + keyword + discretisation + unknown.
DoubleTab & calculer(const DoubleTab &, DoubleTab &) const override
Initializes the array passed as parameter with the contribution of the operator.
DoubleTab & ajouter(const DoubleTab &, DoubleTab &) const override
Adds the contribution of the operator to the array passed as parameter.
const Champ_base & vitesse() const
Returns the transporting velocity of the operator.
void associer_norme_vitesse(const Champ_base &)
int op_non_nul() const override
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
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