TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Champ_front_t.cpp
1/****************************************************************************
2* Copyright (c) 2022, 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// Nouveau champ frontiere
16
17#include <Champ_front_t.h>
18#include <Domaine.h>
19#include <Frontiere_dis_base.h>
20#include <Domaine_VF.h>
21#include <TRUSTTrav.h>
22
23Implemente_instanciable(Champ_front_t,"Champ_front_fonc_t",Ch_front_var_instationnaire_indep);
24// XD champ_front_fonc_t front_field_base champ_front_fonc_t NO_BRACE Boundary field that depends only on time.
25// XD attr val listchaine val REQ Values of field components (mathematical expressions).
26
27
28/*! @brief Imprime le champ sur flot de sortie.
29 *
30 * Imprime la taille du champ et la valeur (constante) sur
31 * la frontiere.
32 *
33 * @param (Sortie& os) un flot de sortie
34 * @return (Sortie&) le flot de sortie modifie
35 */
37{
38
39 const DoubleTab& tab=valeurs();
40 os << tab.size() << " ";
41 for(int i=0; i<tab.size(); i++)
42 os << tab(0,i);
43 return os;
44}
45
46
47/*! @brief Lit le champ a partir d'un flot d'entree.
48 *
49 * Format:
50 * Champ_front_t nb_compo vrel_1 ... [vrel_i]
51 *
52 * @param (Entree& is) un flot d'entree
53 * @return (Entree& is) le flot d'entree modifie
54 */
56{
57 int dim;
59 fixer_nb_comp(dim);
60
61 f_t.dimensionner(dim);
62
63
64 for (int i = 0; i<dim; i++)
65 {
66 Nom tmp;
67 is >> tmp;
68 Cerr << "Reading and interpretation of the function " << tmp << finl;
69 f_t[i].setNbVar(1);
70 f_t[i].setString(tmp);
71 f_t[i].addVar("t");
72 f_t[i].parseString();
73 Cerr << "Interpretation of function " << tmp << " Ok" << finl;
74 }
75
76 return is;
77}
78
79
80
81/*! @brief Renvoie l'objet upcaste en Champ_front_base&
82 *
83 * @param (Champ_front_base& ch)
84 * @return (Champ_front_base&) (*this) upcaste en Champ_front_base&
85 */
87{
88 return *this;
89}
90
91
93{
94 int dim=nb_comp();
95 const Frontiere_dis_base& fr_dis=frontiere_dis();
96 int nb_faces=ref_cast(Front_VF, fr_dis).nb_faces();
97 int i,k;
98 DoubleTab& tab=valeurs_au_temps(temps);
99 for( i=0; i<nb_faces; i++)
100 {
101 for( k=0; k<dim; k++)
102 {
103 f_t[k].setVar("t",temps);
104 tab(i,k)=f_t[k].eval();
105 }
106 }
108}
109
110double Champ_front_t::valeur_au_temps(double temps,int som, int k) const
111{
112 Parser_U& f_tk=f_t[k];
113 f_tk.setVar("t",temps);
114 return f_tk.eval();
115}
classe Ch_front_var_instationnaire_indep Cette classe abstraite represente un champ sur une frontiere...
int lire_dimension(Entree &, const Nom &)
Verification de la dimension du champ Renvoie la dimension du champ.
classe Champ_front_base Classe de base pour la hierarchie des champs aux frontieres.
virtual const Frontiere_dis_base & frontiere_dis() const
Renvoie la frontiere discretisee associee au champ.
virtual DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ.
classe Champ_front_t Classe derivee de Champ_front_var qui represente les
void mettre_a_jour(double temps) override
NE FAIT RIEN, a surcharger.
virtual double valeur_au_temps(double temps, int som, int comp) const
Champ_front_base & affecter_(const Champ_front_base &ch) override
Renvoie l'objet upcaste en Champ_front_base&.
DoubleTab & valeurs_au_temps(double temps) override
Renvoie les valeurs au temps desire.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual void fixer_nb_comp(int i)
Fixe le nombre de composantes du champ.
virtual int nb_comp() const
Definition Field_base.h:56
class Front_VF
Definition Front_VF.h:36
classe Frontiere_dis_base Classe representant une frontiere discretisee.
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
classe Parser_U Version de la classe Parser, derivant de Objet_U.
Definition Parser_U.h:32
void setVar(const char *sv, double val)
Definition Parser_U.h:149
double eval()
Definition Parser_U.h:125
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ size() const
Definition TRUSTVect.tpp:45
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")