TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Champ_front_fonc_pois_ipsn.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_ipsn.h>
17#include <Domaine.h>
18#include <Frontiere_dis_base.h>
19
20Implemente_instanciable(Champ_front_fonc_pois_ipsn,"Champ_front_fonc_pois_ipsn",Champ_front_fonc);
21// XD champ_front_fonc_pois_ipsn front_field_base champ_front_fonc_pois_ipsn NO_BRACE Boundary field
22// XD_CONT champ_front_fonc_pois_ipsn.
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
27
29{
30
31 s << que_suis_je() << " " << le_nom() << finl ;
32
33 const DoubleTab& tab=valeurs();
34 s << tab.size() << " ";
35 for(int i=0; i<tab.size(); i++)
36 s << tab(0,i);
37
38 return s ;
39}
40
42{
43
44 is >> R_tube ;
45
46 int nbcomp , i;
47 nbcomp=lire_dimension(is,que_suis_je());
48
49 fixer_nb_comp(nbcomp);
50 U_moy.resize(nbcomp) ;
51 R_loc.resize(nbcomp) ;
52
53 for (i = 0; i < nbcomp; i++)
54 {
55 is >> U_moy(i) ;
56 }
57
58 for (i = 0; i < nbcomp; i++)
59 {
60 is >> R_loc(i) ;
61 }
62
63
64 //Cerr << "Champ_front_fonc_pois_ipsn lu U_moy = "<< U_moy << finl ;
65 return is ;
66}
67
69{
70 if (!Champ_front_fonc::initialiser(temps,inco))
71 return 0;
72
73 int dim = nb_comp();
74
75 const Frontiere& front=la_frontiere_dis->frontiere();
76 const Domaine& domaine=front.domaine();
77 const Faces& faces=front.faces();
78
79 int nb_faces=front.nb_faces();
80 int nbsf=faces.nb_som_faces();
81
82 DoubleTab& tab=valeurs();
83
84 DoubleVect loc_local(dim) ;
85
86 double teta = 40./360.*2.*3.14159 ;
87 double dummy ;
88
89 DoubleTab coord_trans(3,3) ;
90
91 coord_trans(0,0) = cos(teta) ;
92 coord_trans(0,1) = 0. ;
93 coord_trans(0,2) = sin(teta) ;
94
95 coord_trans(1,0) = 0. ;
96 coord_trans(1,1) = 1. ;
97 coord_trans(1,2) = 0. ;
98
99 coord_trans(2,0) = -sin(teta) ;
100 coord_trans(2,1) = 1. ;
101 coord_trans(2,2) = cos(teta) ;
102
103 DoubleVect trans(3) ;
104
105 int k, i ,j ;
106
107 for( int fac=0; fac<nb_faces; fac++)
108 {
109 loc_local = 0.;
110
111 for( k=0; k<nbsf; k++)
112 {
113 for ( i=0; i<dim; i++)
114 loc_local(i)+=domaine.coord(faces.sommet(fac,k),i);
115 }
116 loc_local /= double(nbsf);
117
118 trans = 0. ;
119 for (i=0; i<dimension; i++)
120 for (j=0; j<dimension; j++)
121 trans(i) += (loc_local(j) - R_loc(j)) * coord_trans(i,j) ;
122
123 loc_local = trans ;
124
125 double ray2 = R_tube*R_tube ;
126
127 dummy = loc_local(0)*loc_local(1)*ray2 ;
128 tab(fac,2) = std::fabs(dummy) ;
129 dummy = loc_local(0)*loc_local(2)*ray2 ;
130 tab(fac,1) = std::fabs(dummy) ;
131 dummy = loc_local(1)*loc_local(2)*ray2 ;
132 tab(fac,0) = std::fabs(dummy) ;
133
134 dummy = loc_local(0)*loc_local(0)*loc_local(0)*loc_local(1) ;
135 tab(fac,2) -= std::fabs(dummy) ;
136 dummy = loc_local(1)*loc_local(1)*loc_local(1)*loc_local(0) ;
137 tab(fac,2) -= std::fabs(dummy) ;
138
139 dummy = loc_local(0)*loc_local(0)*loc_local(0)*loc_local(2) ;
140 tab(fac,1) -= std::fabs(dummy) ;
141 dummy = loc_local(2)*loc_local(2)*loc_local(2)*loc_local(0) ;
142 tab(fac,1) -= std::fabs(dummy) ;
143
144 dummy = loc_local(2)*loc_local(2)*loc_local(2)*loc_local(1) ;
145 tab(fac,0) -= std::fabs(dummy) ;
146 dummy = loc_local(1)*loc_local(1)*loc_local(1)*loc_local(2) ;
147 tab(fac,0) -= std::fabs(dummy) ;
148
149 for ( i=0; i<dim; i++)
150 tab(fac,i) *= U_moy(i) ;
151 }
153 return 1;
154}
155
Classe Champ_Inc_base.
int lire_dimension(Entree &, const Nom &)
Verification de la dimension du champ Renvoie la dimension du champ.
virtual int initialiser(double temps, const Champ_Inc_base &inco)
Initialisation en debut de calcul.
virtual DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ.
class Champ_front_fonc_pois_ipsn Classe derivee de Champ_front_fonc
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialisation en debut de calcul.
class Champ_front_fonc Classe derivee de 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
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 void fixer_nb_comp(int i)
Fixe le nombre de composantes du champ.
const Nom & le_nom() const override
Renvoie le nom du champ.
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
static int dimension
Definition Objet_U.h:99
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
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_ size() const
Definition TRUSTVect.tpp:45
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")