TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_front_tangentiel_VEF.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
16#include <Champ_front_tangentiel_VEF.h>
17#include <Domaine_VEF.h>
18#include <TRUSTTrav.h>
19Implemente_instanciable(Champ_front_tangentiel_VEF,"Champ_front_tangentiel_VEF",Champ_front_tangentiel);
20// XD champ_front_tangentiel_vef front_field_base champ_front_tangentiel_vef NO_BRACE Field to define the tangential
21// XD_CONT velocity vector field standard at the boundary in VEF discretization.
22// XD attr mot chaine(into=["vitesse_tangentielle"]) mot REQ Name of vector field.
23// XD attr vit_tan floattant vit_tan REQ Vector field standard [m/s].
24
26{
28}
29
30
32{
35}
36
37
38// WEC : apparently assumes dimension 3, that the surfaces are vertical
39// (normal vector orthogonal to z) and that the rotation vector is along z.
40
41// This field is in fact stationary => everything is done in initialiser.
42
44{
46 return 0;
47
48 const Domaine_VEF& domaine_VEF = ref_cast(Domaine_VEF,domaine_dis());
49 const Front_VF& le_bord= ref_cast(Front_VF,frontiere_dis());
50 int premiere=le_bord.num_premiere_face();
51 // int derniere=premiere+le_bord.nb_faces();
52 const DoubleTab& face_normales = domaine_VEF.face_normales();
53 const IntTab& face_voisins = domaine_VEF.face_voisins();
54
55 int nb_cases=les_valeurs->nb_cases();
56
57 // process the faces on the boundary
58
59 DoubleTab vecteur_tang(le_bord.nb_faces(),3);
60
61 for(int i=0; i<le_bord.nb_faces(); i++)
62 {
63 int elem1=face_voisins(i+premiere,0);
64 if (elem1 == -1)
65 elem1=face_voisins(i+premiere,1);
66 int signe = domaine_VEF.oriente_normale(i+premiere,elem1);
67
68 vecteur_tang(i,2) = 0.0;
69
70 vecteur_tang (i,0) = -face_normales(i+premiere,1)*signe;
71
72 vecteur_tang (i,1) =face_normales(i+premiere,0)*signe;
73
74 double norme=0.0;
75
76 for (int k=0; k<2; k++)
77 norme += vecteur_tang(i,k)* vecteur_tang(i,k);
78
79 norme = sqrt(norme);
80
81 // Fill all time steps
82 for (int t=0; t<nb_cases; t++)
83 {
84 DoubleTab& tab=les_valeurs[t].valeurs();
85
86 tab(i,2)=0.0;
87
88 // WEC : Indices were i+premiere.
89 // Removed as it was clearly a bug!
90 // Also changed in domaine_Cl_VEF
91 for(int j=0; j<2; j++)
92 {
93 tab(i,j)=vecteur_tang(i,j);
94 tab(i,j)*=vit_tang;
95 tab(i,j)=tab(i,j)/norme;
96 }
97 }
98 }
99
100 return 1;
101}
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialization at the beginning of calculation.
Class Champ_Inc_base.
virtual const Frontiere_dis_base & frontiere_dis() const
Returns the discretized boundary associated with the field.
virtual const Domaine_dis_base & domaine_dis() const
class Champ_front_tangentiel_VEF
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialization at the beginning of calculation.
class Champ_front_tangentiel
class Domaine_VEF
Definition Domaine_VEF.h:53
virtual double face_normales(int face, int comp) const
Definition Domaine_VF.h:47
int oriente_normale(int f, int e) const
Definition Domaine_VF.h:194
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
Definition Domaine_VF.h:418
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)
Sets the number of components of the field.
class Front_VF
Definition Front_VF.h:36
int nb_faces() const
Definition Front_VF.h:53
int num_premiere_face() const
Definition Front_VF.h:63
static int dimension
Definition Objet_U.h:94
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
Base class for output streams.
Definition Sortie.h:52