TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Ch_front_input_ALE.cpp
1/****************************************************************************
2* Copyright (c) 2015 - 2018, 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 <Ch_front_input_ALE.h>
17#include <Probleme_base.h>
18#include <Schema_Temps_base.h>
19#include <Interprete.h>
20#include <Domaine.h>
21#include <Frontiere_dis_base.h>
22#include <communications.h>
23#include <Convert_ICoCoTrioField.h>
24#include <MD_Vector_tools.h>
25#include <Roue.h>
26
27Implemente_instanciable_sans_constructeur(Ch_front_input_ALE,"Ch_front_input_ALE",Ch_front_input_P1);
28// XD Ch_front_input_ALE front_field_base Ch_front_input_ALE INHERITS_BRACE Class to define a boundary condition on a
29// XD_CONT moving boundary of a mesh (only for the Arbitrary Lagrangian-Eulerian framework ) . NL2 Example:
30// XD_CONT Ch_front_input_ALE { nb_comp 3 nom VITESSE_IN_ALE probleme pb initial_value 3 1. 0. 0. }
31
35
37{
38 return Ch_front_input::readOn(is);
39}
40
42{
43 return Ch_front_input::printOn(os);
44}
45
46void Ch_front_input_ALE::getTemplate(TrioField& afield) const
47{
48 buildSommetsFaces(); //From Ch_front_input in order to update mesh
50}
51
52void Ch_front_input_ALE::setValue(const TrioField& afield)
53{
54 int NrOfNodesIn_les_valeurs_som=les_valeurs_som[1].valeurs().size()/nb_comp();
55 for(int i=0; i<NrOfNodesIn_les_valeurs_som; i++)
56 {
57 for(int j=0; j<afield._nb_field_components; j++)
58 {
59 les_valeurs_som[1].valeurs()(i,j)=afield._field[afield._nb_field_components*i+j]; //Values to nodes.
60 }
61 }
62 les_valeurs_som[1].valeurs().echange_espace_virtuel() ;
63}
64
65int Ch_front_input_ALE::initialiser(double temps, const Champ_Inc_base& inco)
66{
67 Cout << "initialiser Ch_front_input_ALE" << finl ;
68 if (alreadyInit_)
69 return 1;
70 alreadyInit_ = true;
71 if (!Ch_front_input_P1::initialiser(temps,inco))
72 return 0;
73
74 //ALE part:
75 mettre_a_jour(temps);
76
77 return 1;
78}
79
81{
82 Cerr << "Champ_front_input_ALE ::mettre_a_jour" << finl;
83
84 const Frontiere& front=la_frontiere_dis->frontiere();
85 int nb_faces=front.nb_faces();
86 const Faces& faces=front.faces();
87 int nbsf=faces.nb_som_faces();
88 int i,j,k;
89
90 DoubleTab& tab=valeurs_au_temps(temps);
92 tab=0.;
93
94 for( i=0; i<nb_faces; i++)
95 {
96 for( j=0; j<nb_comp(); j++)
97 {
98 for( k=0; k<nbsf; k++)
99 {
100 tab(i,j)+=vit_som_bord_ALE(faces.sommet(i,k),j);
101 }
102 }
103 }
104 tab/=nbsf;
106}
107
109{
110 Cout<<"Champ_front_input_ALE::remplir_vit_som_bord_ALE"<<finl;
111
112 const Frontiere& front=la_frontiere_dis->frontiere();
113 //int nb_faces=front.nb_faces();
114 const Domaine& domaine=front.domaine();
115 const Faces& faces=front.faces();
116 //int nbsf=faces.nb_som_faces();
117 int i,j;
118 int nb_som_tot=domaine.nb_som_tot();
119 vit_som_bord_ALE.resize(nb_som_tot,nb_comp());
120 //int nb_som=domaine.nb_som();
121 //if (vit_som_bord_ALE.dimension(0) != domaine.nb_som())
122 // {
123 // vit_som_bord_ALE.resize(domaine.nb_som(),nb_comp());
124 // const MD_Vector& md = domaine.domaine().md_vector_sommets();
125 // MD_Vector_tools::creer_tableau_distribue(md, vit_som_bord_ALE);
126 // }
127
128
130 double InitialTimeValue=mon_pb->schema_temps().temps_init();
131
132 // Construction de la liste des sommets
133 int nn=0;
134 ArrOfInt liste_sommets(nb_som_tot);
135 ArrOfInt marqueur(domaine.les_sommets().dimension(0));
136 const IntTab& ffaces=faces.les_sommets() ;
137 marqueur=-1;
138 for (int f=0; f<ffaces.dimension(0); f++)
139 {
140 for (int s=0; s<ffaces.dimension(1); s++)
141 {
142 int som=ffaces(f,s);
143 if (som >= 0 && marqueur[som]==-1)
144 {
145
146 marqueur[som]=nn;
147 liste_sommets[nn]=som ;
148 nn++;
149 }
150 }
151 }
152
153 /*Cout << "nb_sommets " << sommets_.size() << finl ;
154 Cout << "Sommets: " ;
155 for (i=0 ; i < nn ; i++)
156 { Cout << liste_sommets(i) << ", " ;}
157 Cout << finl ;*/
158
159 if(tps==InitialTimeValue) //Initial values.
160 {
161 // for( i=0; i<nb_som; i++)
162 for( i=0; i<nn; i++)
163 {
164 for( j=0; j<nb_comp(); j++)
165 {
166 vit_som_bord_ALE(liste_sommets[i],j)=initial_value_[j];
167 }
168 }
169 }
170 else
171 {
172 // for( i=0; i<nb_som; i++)
173 for( i=0; i<nn; i++)
174 {
175 for( j=0; j<nb_comp(); j++)
176 {
177 vit_som_bord_ALE(liste_sommets[i],j)=les_valeurs_som[1].valeurs()(i,j);
178 //std::cout << "i : " << i << ", j: " << j << ", les_valeurs_som: " << les_valeurs_som[1].valeurs()(i,j) << std::endl ;
179 }
180 }
181 }
182 //vit_som_bord_ALE.echange_espace_virtuel();
183}
184
class Ch_front_input_ALE
void mettre_a_jour(double temps) override
NE FAIT RIEN, a surcharger.
void getTemplate(TrioField &afield) const override
Provides afield with a name, a time interval, components, and no field ownership.
void remplir_vit_som_bord_ALE(double)
void setValue(const TrioField &afield) override
Uses the first value in afield as uniform value, regardless of geometry.
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialisation en debut de calcul.
class Ch_front_input
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialisation en debut de calcul.
void getTemplate(TrioField &afield) const override
Provides afield with a name, a time interval, components, and no field ownership.
void buildSommetsFaces() const
Classe Champ_Inc_base.
ArrOfDouble initial_value_
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
const IntTab_t & les_sommets() const
Renvoie le tableau des sommets de toutes les faces.
Definition Faces.h:74
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 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
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
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")