TrioCFD 1.9.9_beta
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) the type name to assign to the source
40 */
41void Source::typer_direct(const Nom& typ)
42{
43 OWN_PTR(Source_base)::typer(typ);
44}
45
46
47/*! @brief Types the source by computing the required type name from the provided parameters.
48 *
49 * @param (Nom& typ) the beginning of the type name
50 * @param (Equation_base& eqn) the equation associated with the 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 << "In source.cpp source type = " << type << finl;
63 OWN_PTR(Source_base)::typer(type);
64}
65
66/*! @brief Call to the underlying object.
67 *
68 * Adds the contribution of the source to the array passed as parameter.
69 *
70 * @param (DoubleTab& xx) the array to which the source contribution is added
71 * @return (DoubleTab&) the modified parameter xx
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 Call to the underlying object.
82 *
83 * Assigns the source term to the array passed as parameter.
84 *
85 * @param (DoubleTab& xx) the array in which the source value is stored
86 * @return (DoubleTab&) the modified parameter xx
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
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.
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
Base class for output streams.
Definition Sortie.h:52
Source_base A Source_base object is a term appearing on the right-hand side of an.
Definition Source_base.h:42
Source Generic class of the source term hierarchy. A Source object can.
Definition Source.h:33
DoubleTab & ajouter(DoubleTab &) const
Call to the underlying object.
Definition Source.cpp:73
DoubleTab & calculer(DoubleTab &) const
Call to the underlying object.
Definition Source.cpp:88
void typer(const Nom &, const Equation_base &)
Types the source by computing the required type name from the provided parameters.
Definition Source.cpp:52
void typer_direct(const Nom &)
Definition Source.cpp:41