TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_front_recyclage.h
1/****************************************************************************
2* Copyright (c) 2026, 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#ifndef Champ_front_recyclage_included
17#define Champ_front_recyclage_included
18
19#include <Ch_front_var_instationnaire_dep.h>
20#include <TRUSTArrays.h>
21#include <TRUSTTabs.h>
22#include <TRUST_Ref.h>
23#include <Parser_U.h>
24#include <Noms.h>
25
28class Champ_Inc_base;
29class Front_dis_base;
30class Equation_base;
31class Milieu_base;
32class Param;
33
34/*! @brief Champ_front_recyclage
35 *
36 * delt_dist delt_dist
37 * pb1 <----------> pb2 <--------> pb
38 * ch_fr2 ch_fr
39 * _____________________ ____________________________ ____________________________
40 * | | | | | | | |
41 * | dom1 | | | dom2 | | | dom |
42 * | ch1 | | |bord2 | |bord | ch |
43 * |_________________|___| |____________________________| |________|__________________|
44 * plan1 plan
45 *
46 * Fig. 1 Fig. 2
47 *
48 * The goal of this class is to evaluate the values of a boundary field (ch_fr2) on the boundary of a domain (bord2)
49 * by exploiting the values of a field 1 (ch1, called the evaluator field) evaluated in a plane (plan1) at a distance
50 * delt_dist from bord2 (Fig. 1).
51 *
52 */
53
54// Problems pb2 and pb1, domains dom2 and dom1, and fields 2 and 1 can be identical
55// (pb2=pb1=pb dom2=dom1=dom and ch2=ch1=ch)
56// in which case the values of the boundary field (ch_fr) on the boundary (bord) will be built
57// from the values of field ch (which becomes the evaluator field) computed in the plane (plan)
58// at a distance delt_dist from the boundary (Fig. 2).
59
60// The expression for the values assigned to the boundary field on bord2 (or bord) is:
61// val_ch_fr2(dir) = ampli_moy_imposee(dir)*moyenne_imposee(dir)
62// + ampli_fluct(dir)*(val_evaluateur(dir)-ampli_moy_recyclee(dir)*moyenne_recyclee(dir))
63//
64// val_ch_fr2 : values taken by the boundary field ch_fr2 (or ch_fr)
65// moyenne_imposee : mean of the boundary field (can be imposed analytically or read from a file)
66// val_evaluateur : values of the evaluator field in plane1 (or plane) evaluated by interpolation
67// moyenne_recyclee : mean of the evaluator field (can be computed by surface averaging or from a special treatment)
68// ampli_moy_imposee : amplification factor for the imposed mean
69// ampli_moy_recyclee : amplification factor for the recycled mean
70// ampli_fluct : amplification factor for the recycled fluctuation
71// dir : direction
72
73// User syntax:
74// Champ_front_recyclage
75// {
76// pb_champ_evaluateur nom_pb1 nom_inco1 nb_compo1
77// [ moyenne_imposee methode_moy [fichier] nom_fich1 (nom_fich2) ]
78// [ moyenne_recyclee methode_recyc [fichier] nom_fich1 (nom_fich2) ]
79// [ direction_anisotrope direction ]
80// [ distance_plan dist0 dist1 (dist2) ]
81// [ ampli_fluctuation nb_comp ampli_fluc0 ampli_fluc1 (ampli_fluc2) ]
82// [ ampli_moyenne_imposee nb_comp ampli_moy0 ampli_moy1 (ampli_moy2) ]
83// [ ampli_moyenne_recyclee nb_comp ampli_recy0 ampli_recy1 (ampli_recy2) ]
84// }
85//
86// methode_moy = 1 (keyword profil)
87// to impose an analytical profile
88// methode_moy = 2 (keyword interpolation):
89// reads from a file and builds a mean field
90// by interpolating the data read.
91// The mean is built for a preferred direction
92// (direction_anisotrope) and is 0 for other directions
93// methode_moy = 3 (keyword connexion_approchee)
94// reads from a file and retains the value of the
95// variable read by connection with the closest point
96// to the considered boundary face
97// methode_moy = 4 (keyword connexion_exacte)
98// reads a geometry file containing the coordinates of points
99// located in the evaluation plane and reads from a separate file
100// the mean values. The mean values read
101// are stored when the exact correspondence between
102// facing points is verified.
103// methode_moy = 5 (keyword logarithmique)
104// builds the mean using a wall law (logarithmic)
105//
106//
107// methode_moy = 2 and methode_moy = 3:
108// a single file to read containing positions and values of the variable
109// methode_moy = 4: two files to read: the first containing the values of the variable
110// and the second containing the positions
111//
112//
113// methode_recyc = 1 (keyword surfacique)
114// surface average of the recycled values
115// (the average is computed on bord2 where the values are retrieved)
116// methode_recyc = 2 (keyword interpolation):
117// see methode_moy = 2
118// methode_recyc = 3 (keyword connexion_approchee)
119// see methode_moy = 3
120// methode_recyc = 4 (keyword connexion_exacte)
121// see methode_moy = 4
122//
123// methode_recyc = 2 and methode_moy = 3:
124// a single file to read containing positions and values of the variable
125// methode_recyc = 4: two files to read: the first containing the values of the variable
126// and the second containing the positions
127//
128//////////////////////////////////////////////////////////////////////////////
129
131{
132
133 Declare_instanciable_sans_constructeur(Champ_front_recyclage);
134
135public:
136
140 void calcul_moyenne_imposee(const DoubleTab& tab,double temps);
141 void calcul_moyenne_recyclee(const DoubleTab& tab,double temps);
142 void initialiser_moyenne_imposee(DoubleTab& moyenne);
143 void initialiser_moyenne_recyclee(DoubleTab& moyenne);
144 void associer_champ_evaluateur(const Nom&, const Motcle&);
145 int initialiser(double temps, const Champ_Inc_base& inco) override;
146 void mettre_a_jour(double temps) override;
147
148 static void get_coord_faces(const Frontiere_dis_base& fr_vf,
149 DoubleTab& coords,
150 const DoubleVect& delt_dist);
151
152 void lire_fichier_format1(DoubleTab& moyenne,
153 const Frontiere_dis_base& fr_vf,
154 const Nom& nom_fich);
155 void lire_fichier_format2(DoubleTab& moyenne,
156 const Frontiere_dis_base& fr_vf,
157 const Nom& nom_fich);
158 void lire_fichier_format3(DoubleTab& moyenne,
159 const Frontiere_dis_base& fr_vf,
160 const Nom& nom_fich1, const Nom& nom_fich2);
161 double UPb(double y,Nom nom_fich);
162
163protected :
164 void set_param(Param& param) const override;
165 int lire_motcle_non_standard(const Motcle&, Entree&) override;
166
167 OBS_PTR(Champ_Inc_base) l_inconnue1; //Reference to the unknown field (ch1) used as evaluator
168 //in the plane where the values are retrieved
169
170 DoubleVect delt_dist; //distance vector between bord2 and the plane (plan1)
171 //for computing the values of ch1
172
173 Nom nom_pb1; //name of the evaluator problem (pb1)
174
175 Motcle nom_inco1; //name of the evaluator unknown field (ch1)
176
177 DoubleTab moyenne_imposee_; //See description above
179 DoubleVect ampli_fluct_;
182
183 int methode_moy_impos_; //method to evaluate moyenne_imposee_
184 int methode_moy_recycl_; //method to evaluate moyenne_recyclee_
185
186 Nom fich_impos_,fich_recycl_; //Names of files optionally used
187 Nom fich_maillage_; //to evaluate moyenne_imposee_ and moyenne_recyclee_
188
189 int ndir; //direction of anisotropy
190
191 VECT(Parser_U) profil_2; //Parser and expressions for imposing an analytical mean
193
194 double u_tau,diametre,visco_cin; //parameters for imposing a mean using a logarithmic profile
195
196 // Set of points where inconnue1 must be evaluated (only coordinates
197 // included in the local domain1), sorted by the processor to which
198 // the evaluation result must be sent. Note that there is not necessarily
199 // equality between the local unknown on the face and the remote unknown on the face if
200 // the surface meshes of the local and remote boundaries are not identical...
202
203 // For each point where inconnue1 must be evaluated, index of the element in which
204 // this point lies (always by destination processor)
206
207 // Upon reception of values, indices of the boundary faces where the
208 // result received from each processor must be stored
210};
211
212#endif
class Ch_front_var_instationnaire_dep This abstract class represents a field on a boundary,
Class Champ_Inc_base.
void calcul_moyenne_recyclee(const DoubleTab &tab, double temps)
void calcul_moyenne_imposee(const DoubleTab &tab, double temps)
void initialiser_moyenne_imposee(DoubleTab &moyenne)
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialization at the beginning of calculation.
void lire_fichier_format2(DoubleTab &moyenne, const Frontiere_dis_base &fr_vf, const Nom &nom_fich)
int lire_info_moyenne_recyclee(Entree &is)
void associer_champ_evaluateur(const Nom &, const Motcle &)
void lire_fichier_format1(DoubleTab &moyenne, const Frontiere_dis_base &fr_vf, const Nom &nom_fich)
void initialiser_moyenne_recyclee(DoubleTab &moyenne)
int lire_info_moyenne_imposee(Entree &is)
VECT(Parser_U) profil_2
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
OBS_PTR(Champ_Inc_base) l_inconnue1
void set_param(Param &param) const override
void mettre_a_jour(double temps) override
DOES NOTHING, to override.
double UPb(double y, Nom nom_fich)
static void get_coord_faces(const Frontiere_dis_base &fr_vf, DoubleTab &coords, const DoubleVect &delt_dist)
void lire_fichier_format3(DoubleTab &moyenne, const Frontiere_dis_base &fr_vf, const Nom &nom_fich1, const Nom &nom_fich2)
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Equation_base The role of an equation is the calculation of one or more fields....
class Frontiere_dis_base Class representing a discretized boundary.
Milieu_base This class is the base of the (physical) medium hierarchy.
Definition Milieu_base.h:50
A character string (Nom) in uppercase.
Definition Motcle.h:26
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
An array of character strings (VECT(Nom)).
Definition Noms.h:26
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
class Parser_U Version of the Parser class, deriving from Objet_U.
Definition Parser_U.h:32