TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_front_txyz.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// Nouveau champ frontiere
16
17#include <Champ_front_txyz.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_txyz,"Champ_front_fonc_txyz",Ch_front_var_instationnaire_indep);
24// XD champ_front_fonc_txyz front_field_base champ_front_fonc_txyz NO_BRACE Boundary field which is not constant in
25// XD_CONT space and in time.
26// XD attr val listchaine val REQ Values of field components (mathematical expressions).
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_txyz 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 //Cout << "Dans Champ_front_txyz.readOn !!!!!!!!!" << finl;
58 int dim;
60 fixer_nb_comp(dim);
61
62 fxyz.dimensionner(dim);
63
64
65 // Cout << "dim = " << dim << finl;
66 for (int i = 0; i<dim; i++)
67 {
68 Nom tmp;
69 //Cout << "i = " << i << finl;
70 is >> tmp;
71 //Cout << "fonc = " << tmp << finl;
72 Cerr << "Reading and interpretation of the function " << tmp << finl;
73 fxyz[i].setNbVar(4);
74 fxyz[i].setString(tmp);
75 fxyz[i].addVar("t");
76 fxyz[i].addVar("x");
77 fxyz[i].addVar("y");
78 fxyz[i].addVar("z");
79 fxyz[i].parseString();
80 Cerr << "Interpretation of function " << tmp << " Ok" << finl;
81 // Cout << "end = " << tmp << finl;
82 }
83
84 return is;
85}
86
87
88
89/*! @brief Renvoie l'objet upcaste en Champ_front_base&
90 *
91 * @param (Champ_front_base& ch)
92 * @return (Champ_front_base&) (*this) upcaste en Champ_front_base&
93 */
98
99
101{
102 int dim=nb_comp();
103 const Frontiere_dis_base& fr_dis=frontiere_dis();
104 const Domaine_VF& zvf = ref_cast(Domaine_VF, fr_dis.domaine_dis());
105 int nb_faces=ref_cast(Front_VF, fr_dis).nb_faces();
106 int premiere_face = ref_cast(Front_VF, fr_dis).num_premiere_face();
107 DoubleTab& tab=valeurs_au_temps(temps);
108 for(int i=0; i<nb_faces; i++)
109 {
110 for(int k=0; k<dim; k++)
111 {
112 fxyz[k].setVar(0,temps);
113 fxyz[k].setVar(1,zvf.xv(premiere_face + i, 0));
114 fxyz[k].setVar(2,zvf.xv(premiere_face + i, 1));
115 if (dimension >= 3)
116 fxyz[k].setVar(3,zvf.xv(premiere_face + i, 2));
117 tab(i,k)=fxyz[k].eval();
118 }
119 }
121}
122
123double Champ_front_txyz::valeur_au_temps_et_au_point(double temps,int som,double x,double y, double z, int k) const
124{
125 Parser_U& fxyzk=fxyz[k];
126 fxyzk.setVar(0,temps);
127 fxyzk.setVar(1,x);
128 fxyzk.setVar(2,y);
129 fxyzk.setVar(3,z);
130 return fxyzk.eval();
131}
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_txyz Classe derivee de Champ_front_var qui represente les
Champ_front_base & affecter_(const Champ_front_base &ch) override
Renvoie l'objet upcaste en Champ_front_base&.
void mettre_a_jour(double temps) override
NE FAIT RIEN, a surcharger.
double valeur_au_temps_et_au_point(double temps, int som, double x, double y, double z, int comp) const override
DoubleTab & valeurs_au_temps(double temps) override
Renvoie les valeurs au temps desire.
class Domaine_VF
Definition Domaine_VF.h:44
double xv(int num_face, int k) const
Definition Domaine_VF.h:76
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 Domaine_dis_base & domaine_dis() const
static int dimension
Definition Objet_U.h:99
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")