TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Source.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 <Champ_Uniforme.h>
18#include <Equation_base.h>
19#include <Milieu_base.h>
20#include <TRUSTTabs.h>
21#include <Source.h>
22#include <Perf_counters.h>
23
24Implemente_instanciable(Source,"Source",OWN_PTR(Source_base));
25
26Sortie& Source::printOn(Sortie& os) const
27{
28 return OWN_PTR(Source_base)::printOn(os);
29}
30
31Entree& Source::readOn(Entree& is)
32{
33 return OWN_PTR(Source_base)::readOn(is);
34}
35
36
37/*! @brief
38 *
39 * @param (Nom& typ) le nom de type a donner a la source
40 */
41void Source::typer_direct(const Nom& typ)
42{
43 OWN_PTR(Source_base)::typer(typ);
44}
45
46
47/*! @brief Type la source en calculant le nom du type necessaire grace aux parametres fournis.
48 *
49 * @param (Nom& typ) le debut du type
50 * @param (Equation_base& eqn) l'equation associee a la source
51 */
52void Source::typer(const Nom& typ, const Equation_base& eqn)
53{
54 Nom type= eqn.discretisation().get_name_of_type_for(que_suis_je(),typ,eqn);
55 if (eqn.que_suis_je() == "Transport_Marqueur_FT")
56 type = typ;
57 if(eqn.que_suis_je() == "Navier_Stokes_standard_sensibility" && typ=="boussinesq_temperature")
58 type ="boussinesq_temperature_sensibility_VEFPreP1B_P1NC";
59
60
61 Cerr << type << finl;
62 //Cout << "Dans source.cpp type source = " << type << finl;
63 OWN_PTR(Source_base)::typer(type);
64}
65
66/*! @brief Appel a l'objet sous-jacent.
67 *
68 * Ajoute la contribution de la source au tableau passe en parametre.
69 *
70 * @param (DoubleTab& xx) le tableau auquel on ajoute la contribution de la source
71 * @return (DoubleTab&) le parametre xx modifie
72 */
73DoubleTab& Source::ajouter(DoubleTab& xx) const
74{
75 statistics().begin_count(STD_COUNTERS::source_terms,statistics().get_last_opened_counter_level()+1);
76 DoubleTab& tmp = valeur().ajouter(xx);
77 statistics().end_count(STD_COUNTERS::source_terms);
78 return tmp;
79}
80
81/*! @brief Appel a l'objet sous-jacent.
82 *
83 * Affecte le terme source au tableau passe en parametre.
84 *
85 * @param (DoubleTab& xx) le tableau dans lequel on stocke la valeur de la source
86 * @return (DoubleTab&) le parametre xx modifie
87 */
88DoubleTab& Source::calculer(DoubleTab& xx) const
89{
90 statistics().begin_count(STD_COUNTERS::source_terms,statistics().get_last_opened_counter_level()+1);
91 DoubleTab& tmp = valeur().calculer(xx);
92 statistics().end_count(STD_COUNTERS::source_terms);
93 return tmp;
94}
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.
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
Classe de base des flux de sortie.
Definition Sortie.h:52
classe Source_base Un objet Source_base est un terme apparaissant au second membre d'une
Definition Source_base.h:42
classe Source Classe generique de la hierarchie des sources, un objet Source peut
Definition Source.h:33
DoubleTab & ajouter(DoubleTab &) const
Appel a l'objet sous-jacent.
Definition Source.cpp:73
DoubleTab & calculer(DoubleTab &) const
Appel a l'objet sous-jacent.
Definition Source.cpp:88
void typer(const Nom &, const Equation_base &)
Type la source en calculant le nom du type necessaire grace aux parametres fournis.
Definition Source.cpp:52
void typer_direct(const Nom &)
Definition Source.cpp:41