TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_front_fonc_pois_tube.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 <Champ_front_fonc_pois_tube.h>
17#include <Domaine.h>
18#include <Frontiere_dis_base.h>
19
20Implemente_instanciable(Champ_front_fonc_pois_tube,"Champ_front_fonc_pois_tube",Champ_front_fonc);
21// XD champ_front_fonc_pois_tube front_field_base champ_front_fonc_pois_tube NO_BRACE Boundary field
22// XD_CONT champ_front_fonc_pois_tube.
23// XD attr r_tube floattant r_tube REQ not_set
24// XD attr umoy list umoy REQ not_set
25// XD attr r_loc listf r_loc REQ not_set
26// XD attr r_loc_mult listentierf r_loc_mult REQ not_set
27
28
30{
31
32 s << que_suis_je() << " " << le_nom() << finl ;
33
34 const DoubleTab& tab=valeurs();
35 s << tab.size() << " ";
36 for(int i=0; i<tab.size(); i++)
37 s << tab(0,i);
38
39 return s ;
40}
41
43{
44
45 is >> R_tube ;
46
47 int nbcomp , i;
48 nbcomp=lire_dimension(is,que_suis_je());
49
50 fixer_nb_comp(nbcomp);
51 U_moy.resize(nbcomp) ;
52 R_loc.resize(nbcomp) ;
53 R_loc_mult.resize(nbcomp) ;
54 for (i = 0; i < nbcomp; i++)
55 {
56 is >> U_moy(i) ;
57 }
58
59 for (i = 0; i < nbcomp; i++)
60 {
61 is >> R_loc(i) ;
62 }
63
64 for (i = 0; i < nbcomp; i++)
65 {
66 is >> R_loc_mult(i) ;
67 }
68
69 //Cerr << "Champ_front_fonc_pois_tube read U_moy = "<< U_moy << finl ;
70 return is ;
71}
72
74{
75 if (!Champ_front_fonc::initialiser(temps,inco))
76 return 0;
77
78 int dim = nb_comp();
79
80 const Frontiere& front=la_frontiere_dis->frontiere();
81 const Domaine& domaine=front.domaine();
82 const Faces& faces=front.faces();
83
84 int nb_faces=front.nb_faces();
85 int nbsf=faces.nb_som_faces();
86
87 DoubleTab& tab=valeurs();
88
89 ArrOfDouble loc_local(dim) ;
90
91 int k, i ,j ;
92
93 for( int fac=0; fac<nb_faces; fac++)
94 {
95 loc_local = 0.;
96
97 for( k=0; k<nbsf; k++)
98 {
99 for ( i=0; i<dim; i++)
100 loc_local[i]+=domaine.coord(faces.sommet(fac,k),i);
101 }
102 loc_local /= double(nbsf);
103
104 loc_local -= R_loc ;
105
106 double ray = 0. ;
107 for ( i=0; i<dim; i++) ray += (loc_local[i]*loc_local[i]) ;
108
109 ray = sqrt(ray) ;
110
111 for ( i=0; i<dim; i++)
112 tab(fac,i)= 2.*U_moy(i) ;
113
114 for ( i=0; i<dim; i++)
115 tab(fac,i) *= ( 1. - ( (ray/R_tube) * (ray/R_tube) ) ) ;
116
117 for ( i=0; i<dim; i++)
118 for ( j=0; j<dim; j++)
119 {
120 double dummy = ( loc_local[j] * double(R_loc_mult(j)) / R_tube );
121 tab(fac,i) *= ( 1. + 1.25 * dummy ) ;
122 }
123 }
125 return 1;
126}
127
128
Class Champ_Inc_base.
int lire_dimension(Entree &, const Nom &)
Verification of the field dimension Returns the dimension of the field.
virtual int initialiser(double temps, const Champ_Inc_base &inco)
Initialization at the beginning of calculation.
virtual DoubleTab & valeurs() override
Returns the array of field values.
class Champ_front_fonc_pois_tube Derived class of Champ_front_fonc
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialization at the beginning of calculation.
class Champ_front_fonc Derived class of Champ_front_var
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
Returns the number of the j-th vertex of the i-th face.
Definition Faces.h:130
int nb_som_faces() const
Returns the number of vertices per face.
Definition Faces.h:149
virtual void fixer_nb_comp(int i)
Sets the number of components of the field.
const Nom & le_nom() const override
Returns the name of the field.
virtual int nb_comp() const
Definition Field_base.h:56
const Domaine_t & domaine() const
Returns the domain associated with the boundary (const version).
int_t nb_faces() const
Returns the number of faces of the boundary.
Definition Frontiere.h:59
const Faces_t & faces() const
Definition Frontiere.h:54
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
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
_SIZE_ size() const
Definition TRUSTVect.tpp:45
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")