TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Boundary_field_inward.cpp
1/****************************************************************************
2* Copyright (c) 2023, 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 <Boundary_field_inward.h>
17#include <Motcle.h>
18#include <Domaine_VF.h>
19#include <Linear_algebra_tools.h>
20#include <EChaine.h>
21
22Implemente_instanciable(Boundary_field_inward,"Boundary_field_inward",Champ_front_normal);
23// XD boundary_field_inward front_field_base boundary_field_inward BRACE this field is used to define the normal vector
24// XD_CONT field standard at the boundary in VDF or VEF discretization.
25// XD attr normal_value chaine normal_value REQ normal vector value (positive value for a vector oriented outside to
26// XD_CONT inside) which can depend of the time.
27
28
29
31{
33}
34
35
37{
39}
40
41
42/*! @brief Initialize normal inward field given on boundaries
43 *
44 */
45
46// Remark :
47// This code is not in "Champ_front_normal::initialiser" function because in the case of using
48// Champ_front_debit, the readOn function of Champ_front_normal is not called
49// so vit_norm is not initialized and it can leads to critical values detected
50// in debug mode.
51// Moreover, when using Champ_front_debit we don't need to do all these calculations
52// That is why Boundary_field_inward was created
54{
55 if( !Champ_front_normal::initialiser(tps,inco) )
56 return 0;
57 mettre_a_jour(tps);
58 return 1;
59}
60
62{
63 const Domaine_VF& domaine_VF = ref_cast(Domaine_VF,domaine_dis());
64 const Front_VF& le_bord= ref_cast(Front_VF,frontiere_dis());
65 int first=le_bord.num_premiere_face();
66
67 int nb_cases=les_valeurs->nb_cases();
68
69 DoubleTab tab_normal_vector(le_bord.nb_faces(),dimension);
70
71 // Evaluation de vit_norm:
72 vit_norm.setVar("t",tps);
73 double value = vit_norm.eval();
74
75 for(int i=0; i<le_bord.nb_faces(); i++)
76 {
77
78 int signe = -1;//we want the opposite of the normal vector
79 int global_boundary_face_number=i+first;
80 //outward vector associated to the fac global_boundary_face_number
81 DoubleTab normal_vector = domaine_VF.normalized_boundaries_outward_vector(global_boundary_face_number,signe);
82
83 for (int k=0; k<dimension; k++)
84 {
85 tab_normal_vector(i,k) = normal_vector(k);
86 }
87
88 // Fill all moments
89 for (int t=0; t<nb_cases; t++)
90 {
91 DoubleTab& tab=les_valeurs[t].valeurs();
92 for(int j=0; j<dimension; j++)
93 {
94 tab(i,j)=tab_normal_vector(i,j);
95 tab(i,j)*=value;
96 }
97 }
98 }
99}
100
101// Obsolete soon:
102Implemente_instanciable(Champ_front_normal_VEF,"Champ_front_normal_VEF",Boundary_field_inward);
103// XD champ_front_normal_vef front_field_base champ_front_normal_vef NO_BRACE Field to define the normal vector field
104// XD_CONT standard at the boundary in VEF discretization.
105// XD attr mot chaine(into=["valeur_normale"]) mot REQ Name of vector field.
106// XD attr vit_tan floattant vit_tan REQ normal vector value (positive value for a vector oriented outside to inside).
107
108
110{
112}
113
115{
116 Motcle motlu;
117 Motcles les_mots(1);
118 les_mots[0]="valeur_normale";
119 is>>motlu;
120 if (motlu != les_mots[0])
121 {
122 Cerr << "Error while reading a Champ_front_normal" << finl;
123 Cerr << "We expected " << les_mots[0] << " instead of " << motlu << finl;
124 exit();
125 }
126 Nom debit;
127 is >> debit;
128 Nom exp("{ normal_value ");
129 exp+=debit;
130 exp+=" } ";
131 EChaine E(exp);
133}
class Boundary_field_inward
void mettre_a_jour(double tps) override
NE FAIT RIEN, a surcharger.
int initialiser(double tps, const Champ_Inc_base &inco) override
Initialize normal inward field given on boundaries.
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialisation en debut de calcul.
Classe Champ_Inc_base.
virtual const Frontiere_dis_base & frontiere_dis() const
Renvoie la frontiere discretisee associee au champ.
virtual const Domaine_dis_base & domaine_dis() const
class Champ_front_normal
class Domaine_VF
Definition Domaine_VF.h:44
DoubleTab normalized_boundaries_outward_vector(int global_face_number, double scale_factor) const
Compute the normalized boundary outward vector associated to the face global_face_number and eventual...
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
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: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
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52