TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_front_fonc_gradient_VDF.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
17#include <Champ_front_fonc_gradient_VDF.h>
18#include <distances_VDF.h>
19#include <Paroi_Knudsen_non_negligeable.h>
20#include <TRUSTTrav.h>
21
22Implemente_instanciable(Champ_front_fonc_gradient_VDF,"Champ_front_fonc_gradient_VDF",Champ_front_fonc_gradient);
23
25{
27}
28
29
31{
33 return s;
34}
35
36/*! @brief Updates the field at the given time.
37 *
38 * @param temps Current time.
39 */
40
42{
43 // Cerr << "Champ_front_fonc_gradient_VDF::mettre_a_jour" << finl;
44 const Front_VF& la_front=ref_cast(Front_VF, frontiere_dis());
45 int nb_faces = la_front.nb_faces();
46 int ndeb = la_front.num_premiere_face();
47
48 DoubleTab& tab=valeurs_au_temps(temps);
49
50 const Domaine_VDF& le_dom_VDF = ref_cast(Domaine_VDF,domaine_dis());
51 const IntVect& orientation = le_dom_VDF.orientation();
52 // Retrieve the BC and associated fields
53 const Paroi_Knudsen_non_negligeable& la_condition_limite=ref_cast(Paroi_Knudsen_non_negligeable,condition_limite(la_front.le_nom()));
54 const DoubleTab& la_inconnue_paroi_=la_condition_limite.vitesse_paroi();
55 const DoubleTab& k_=la_condition_limite.k();
56 const DoubleVect& la_inconnue=inconnue->valeurs();
57 int elem,iro,ori,i,j;
58 // double inconnue_moyenne1,inconnue_moyenne2;
59
60 DoubleTab la_inconnue_paroi(nb_faces,dimension);
61 DoubleVect k(nb_faces);
62 DoubleVect inconnue_moyenne(dimension-1);
63 if (la_inconnue_paroi_.dimension(0)==1)
64 for (i=0; i<nb_faces; i++)
65 for (j=0; j<dimension; j++)
66 la_inconnue_paroi(i,j)=la_inconnue_paroi_(0,j);
67 else
68 for (i=0; i<nb_faces; i++)
69 for (j=0; j<dimension; j++)
70 la_inconnue_paroi(i,j)=la_inconnue_paroi_(i,j);
71 if (k_.dimension(0)==1)
72 for (i=0; i<nb_faces; i++)
73 k(i)=k_(0,0);
74 else
75 for (i=0; i<nb_faces; i++)
76 k(i)=k_(i,0);
77 for (i=0; i<nb_faces; i++)
78 {
79 int num_face=ndeb+i;
80 double k_sur_e;
81 if (axi)
82 k_sur_e=k(i)/le_dom_VDF.dist_norm_bord_axi(num_face);
83 else
84 k_sur_e=k(i)/le_dom_VDF.dist_norm_bord(num_face);
85 elem = le_dom_VDF.face_voisins(num_face,0);
86 if ( elem == -1 )
87 elem = le_dom_VDF.face_voisins(num_face,1);
88 // Compute the unknown at the wall as a function
89 // of the orientation
90 ori = orientation(num_face);
91 tab(i,ori) = la_inconnue_paroi(i,ori);
92 if (dimension==2)
93 {
94 moy_2D_vit(la_inconnue,elem,ori,le_dom_VDF,inconnue_moyenne[0]);
95 iro=1-ori;
96 tab(i,iro)=(la_inconnue_paroi(i,iro)+k_sur_e*inconnue_moyenne[0])/(1+k_sur_e);
97 }
98 else if (dimension==3)
99 {
100 moy_3D_vit(la_inconnue,elem,ori,le_dom_VDF,inconnue_moyenne[0],inconnue_moyenne[1]);
101 if (ori==0)
102 {
103 iro=1;
104 tab(i,iro)=(la_inconnue_paroi(i,iro)+k_sur_e*inconnue_moyenne[0])/(1+k_sur_e);
105 iro=2;
106 tab(i,iro)=(la_inconnue_paroi(i,iro)+k_sur_e*inconnue_moyenne[1])/(1+k_sur_e);
107 }
108 else if (ori==1)
109 {
110 iro=0;
111 tab(i,iro)=(la_inconnue_paroi(i,iro)+k_sur_e*inconnue_moyenne[0])/(1+k_sur_e);
112 iro=2;
113 tab(i,iro)=(la_inconnue_paroi(i,iro)+k_sur_e*inconnue_moyenne[1])/(1+k_sur_e);
114 }
115 else if (ori==2)
116 {
117 iro=0;
118 tab(i,iro)=(la_inconnue_paroi(i,iro)+k_sur_e*inconnue_moyenne[0])/(1+k_sur_e);
119 iro=1;
120 tab(i,iro)=(la_inconnue_paroi(i,iro)+k_sur_e*inconnue_moyenne[1])/(1+k_sur_e);
121 }
122 }
123 }
125}
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_fonc_gradient_VDF
void mettre_a_jour(double) override
Updates the field at the given time.
class Champ_front_fonc_gradient
const Cond_lim_base & condition_limite(const Nom &)
DoubleTab & valeurs_au_temps(double temps) override
Returns the values at the desired time.
class Domaine_VDF
Definition Domaine_VDF.h:61
double dist_norm_bord_axi(int num_face) const
Returns the normal distance for a boundary face (cylindrical coordinates).
int orientation(int) const override
inline DoubleVect& Domaine_VDF::porosite_face() {
double dist_norm_bord(int num_face) const override
Returns the normal distance for a boundary face (Cartesian coordinates).
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
const Nom & le_nom() const override
Returns the name of the geometric boundary.
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
static int axi
Definition Objet_U.h:96
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
Paroi_Knudsen_non_negligeable Imposes a wall velocity slip in a Navier_Stokes type equation,...
Base class for output streams.
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")