TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_front_ALE.cpp
1/****************************************************************************
2* Copyright (c) 2015 - 2016, 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 <Champ_front_ALE.h>
17#include <Domaine.h>
18#include <Frontiere_dis_base.h>
19#include <MD_Vector_tools.h>
20
21Implemente_instanciable(Champ_front_ALE,"Champ_front_ALE",Ch_front_var_instationnaire_dep);
22// XD Champ_front_ale front_field_base Champ_front_ale NO_BRACE Class to define a boundary condition on a moving
23// XD_CONT boundary of a mesh (only for the Arbitrary Lagrangian-Eulerian framework ).
24// XD attr val listchaine val REQ NL2 Example: 2 -y*0.01 x*0.01
25
26/*Champ_front_ALE::Champ_front_ALE()
27{
28 const Frontiere& front=la_frontiere_dis->frontiere();
29 const Domaine& domaine=front.domaine();
30 const Domaine& domaine=domaine.domaine();
31 vit_som_bord_ALE.resize(domaine.nb_som(),nb_comp());
32 const MD_Vector& md = domaine.domaine().md_vector_sommets();
33 MD_Vector_tools::creer_tableau_distribue(md, vit_som_bord_ALE);
34}*/
35
36/*! @brief Impression sur un flot de sortie au format: taille
37 *
38 * valeur(0) ... valeur(i) ... valeur(taille-1)
39 *
40 * @param (Sortie& os) un flot de sortie
41 * @return (Sortie&) le flot de sortie modifie
42 */
44{
45 // const DoubleTab& tab=valeurs();
46 // os << tab.size() << " ";
47 // for(int i=0; i<tab.size(); i++)
48 // os << tab(0,i);
49 return os;
50}
51
52
53
54
55/*! @brief Lecture a partir d'un flot d'entree au format: nombre_de_composantes
56 *
57 * fonction dependant de xyzt pour chaque composante
58 *
59 * @param (Entree& is) un flot d'entree
60 * @return (Entree&) le flot d'entree modifie
61 * @throws accolade ouvrante attendue
62 * @throws mot clef inconnu a cet endroit
63 * @throws accolade fermante attendue
64 */
66{
67 int dim;
68 is >> dim;
69 fixer_nb_comp(dim);
70
71 fxyzt.dimensionner(dim);
72
73
74 // Cout << "dim = " << dim << finl;
75 for (int i = 0; i<dim; i++)
76 {
77 Nom tmp;
78 //Cout << "i = " << i << finl;
79 is >> tmp;
80 //Cout << "fonc = " << tmp << finl;
81 Cerr << "Lecture et interpretation de la fonction " << tmp << finl;
82 fxyzt[i].setNbVar(4);
83 fxyzt[i].setString(tmp);
84 fxyzt[i].addVar("x");
85 fxyzt[i].addVar("y");
86 fxyzt[i].addVar("z");
87 fxyzt[i].addVar("t");
88 fxyzt[i].parseString();
89 Cerr << "Interpretation de la fonction " << tmp << " Ok" << finl;
90 // Cout << "end = " << tmp << finl;
91 }
92 return is;
93}
94
95
96/*! @brief Pas code !!
97 *
98 * @param (Champ_front_base& ch)
99 * @return (Champ_front_base&)
100 */
102{
103 return *this;
104}
105
106int Champ_front_ALE::initialiser(double temps, const Champ_Inc_base& inco)
107{
109 return 0;
110
111 mettre_a_jour(temps);
112 return 1;
113}
114
115/*! @brief Mise a jour du champ front et remplie un tableau de dimension egale au nombre total de sommets du domaine.
116 *
117 * Ce tableau a des
118 * valeurs nulles aux sommets qui n'appartiennent pas au bord ALE
119 * traite.
120 *
121 * @param (double tps) le temps de mise a jour
122 */
124{
125 //Cerr << "Champ_front_ALE ::mettre_a_jour" << finl;
126
127 const Frontiere& front=la_frontiere_dis->frontiere();
128 int nb_faces=front.nb_faces();
129 const Faces& faces=front.faces();
130 int nbsf=faces.nb_som_faces();
131 int i,j,k;
132 DoubleTab& tab=valeurs_au_temps(temps);
133 tab=0.;
134
135 // appel systematique a remplir_vit_som_bord_ALE()
137
138 for( i=0; i<nb_faces; i++)
139 {
140 for( j=0; j<nb_comp(); j++)
141 {
142 for( k=0; k<nbsf; k++)
143 {
144 tab(i,j)+=vit_som_bord_ALE(faces.sommet(i,k),j);
145 }
146 }
147 }
148 tab/=nbsf;
150}
151
153{
154 //Cerr<<"Champ_front_ALE::remplir_vit_som_bord_ALE"<<finl;
155 const Frontiere& front=la_frontiere_dis->frontiere();
156 int nb_faces=front.nb_faces();
157 const Domaine& domaine=front.domaine();
158 const Faces& faces=front.faces();
159 double x,y,z;
160 int nbsf=faces.nb_som_faces();
161 int i,j,k;
162 int nb_som_tot=domaine.nb_som_tot();
163 vit_som_bord_ALE.resize(nb_som_tot,nb_comp());
164 /*if (vit_som_bord_ALE.dimension(0) != domaine.nb_som())
165 {
166 vit_som_bord_ALE.resize(domaine.nb_som(),nb_comp());
167 const MD_Vector& md = domaine.domaine().md_vector_sommets();
168 MD_Vector_tools::creer_tableau_distribue(md, vit_som_bord_ALE);
169 }*/
170
172
173 for( i=0; i<nb_faces; i++)
174 {
175 x=y=z=0;
176 for( k=0; k<nbsf; k++)
177 {
178 x=domaine.coord(faces.sommet(i,k),0);
179 if(dimension>1)
180 y=domaine.coord(faces.sommet(i,k),1);
181 if(dimension>2)
182 z=domaine.coord(faces.sommet(i,k),2);
183 for( j=0; j<nb_comp(); j++)
184 {
185 fxyzt[j].setVar("x",x);
186 fxyzt[j].setVar("y",y);
187 fxyzt[j].setVar("z",z);
188 fxyzt[j].setVar("t",tps);
189 vit_som_bord_ALE(faces.sommet(i,k),j)=fxyzt[j].eval();
190 //cout << " x y " << x << " " << y << " " << z << " " << vit_som_bord_ALE(faces.sommet(i,k),j) << endl;
191 }
192 }
193 }
194 //vit_som_bord_ALE.echange_espace_virtuel();
195}
classe Ch_front_var_instationnaire_dep Cette classe abstraite represente un champ sur une frontiere,
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialisation en debut de calcul.
Classe Champ_Inc_base.
void mettre_a_jour(double temps) override
Mise a jour du champ front et remplie un tableau de dimension egale au nombre total de sommets du dom...
virtual void remplir_vit_som_bord_ALE(double)
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialisation en debut de calcul.
Champ_front_base & affecter_(const Champ_front_base &ch) override
Pas code !!
DoubleTab vit_som_bord_ALE
classe Champ_front_base Classe de base pour la hierarchie des champs aux frontieres.
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
int_t sommet(int_t, int) const
Renvoie le numero du j-ieme sommet de la i-ieme face.
Definition Faces.h:130
int nb_som_faces() const
Renvoie le nombre de sommet par face.
Definition Faces.h:149
virtual void fixer_nb_comp(int i)
Fixe le nombre de composantes du champ.
virtual int nb_comp() const
Definition Field_base.h:56
const Domaine_t & domaine() const
Renvoie le domaine associe a la frontiere.
int_t nb_faces() const
Renvoie le nombre de faces de la frontiere.
Definition Frontiere.h:59
const Faces_t & faces() const
Definition Frontiere.h:54
static int dimension
Definition Objet_U.h:99
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 de base des flux de sortie.
Definition Sortie.h:52
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")