TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Verif_Cl.cpp
1/****************************************************************************
2* Copyright (c) 2025, 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 <Entree_fluide_concentration_imposee.h>
17#include <Dirichlet_entree_fluide_leaves.h>
18#include <Dirichlet_paroi_defilante.h>
19#include <Entree_fluide_T_h_imposee.h>
20#include <Neumann_paroi_adiabatique.h>
21#include <Neumann_paroi_flux_nul.h>
22#include <Echange_global_impose.h>
23#include <Echange_externe_impose.h>
24#include <Scalaire_impose_paroi.h>
25#include <Neumann_sortie_libre.h>
26#include <Dirichlet_paroi_fixe.h>
27#include <Domaine_Cl_dis_base.h>
28#include <Frontiere_dis_base.h>
29
30#include <Neumann_paroi.h>
31#include <Periodique.h>
32#include <Verif_Cl.h>
33#include <Symetrie.h>
34#include <Motcle.h>
35
36/*! @brief Tests the compatibility of the thermal and hydraulic boundary conditions.
37 *
38 * The compatibility list is as follows:
39 * -----------------------------------------------------------------------
40 * Hydraulique | Thermique
41 * -----------------------------------------------------------------------
42 * Entree_fluide_vitesse_imposee ===> Entree_fluide_temperature_imposee
43 * Entree_fluide_vitesse_imposee_libre => Neumann_sortie_libre
44 * -----------------------------------------------------------------------
45 * Dirichlet_paroi_fixe |
46 * Dirichlet_paroi_defilante =======> Neumann_paroi_adiabatique
47 * =================================> Neumann_paroi
48 * =================================> Echange_global_impose
49 * =================================> Echange_externe_impose
50 * =================================> Scalaire_impose_paroi
51 * -----------------------------------------------------------------------
52 * Neumann_sortie_libre ============> Entree_fluide_temperature_imposee
53 * =================================> Neumann_sortie_libre
54 * -----------------------------------------------------------------------
55 * Symetrie ========================> Neumann_paroi_adiabatique
56 * =================================> Neumann_paroi
57 * =================================> Echange_global_impose
58 * =================================> Echange_externe_impose
59 * =================================> Scalaire_impose_paroi
60 * =================================> Symetrie
61 * -----------------------------------------------------------------------
62 * Periodique ======================> Periodique
63 *
64 * @param domaine_Cl_hydr the hydraulic boundary conditions domain
65 * @param[in] domaine_Cl_th the thermal boundary conditions domain
66 * @return always 1
67 * @throws different number of boundary conditions
68 * @throws incompatible hydraulic and thermal boundary conditions
69 */
70int tester_compatibilite_hydr_thermique(const Domaine_Cl_dis_base& domaine_Cl_hydr, const Domaine_Cl_dis_base& domaine_Cl_th)
71{
72
73 int nb_Cl = domaine_Cl_hydr.nb_cond_lim();
74
75 if (domaine_Cl_th.nb_cond_lim() != nb_Cl)
76 {
77 Cerr << "The two objects of OWN_PTR(Domaine_Cl_dis_base) type don't have" << finl;
78 Cerr << "the same number of boundary conditions." << finl;
80 }
81
82 for (int num_Cl = 0; num_Cl < nb_Cl; num_Cl++)
83 {
84 const Cond_lim& la_cl_hydr = domaine_Cl_hydr.les_conditions_limites(num_Cl);
85 const Cond_lim& la_cl_th = domaine_Cl_th.les_conditions_limites(num_Cl);
86 if (sub_type(Entree_fluide_vitesse_imposee_libre, la_cl_hydr.valeur()))
87 {
88 if ((sub_type(Entree_fluide_temperature_imposee, la_cl_th.valeur())) || (sub_type(Neumann_sortie_libre, la_cl_th.valeur())))
89 { /* Do nothing */ }
90 else if ((sub_type(Entree_fluide_T_h_imposee, la_cl_th.valeur())) || (sub_type(Neumann_sortie_libre, la_cl_th.valeur())))
91 { /* Do nothing */ }
92 else
93 {
94 message_erreur_therm(la_cl_hydr, la_cl_th, num_Cl);
95 }
96 }
97 else if (sub_type(Entree_fluide_vitesse_imposee, la_cl_hydr.valeur()) && (la_cl_hydr->que_suis_je() != "Frontiere_ouverte_vitesse_imposee_ALE"))
98 {
99 if (sub_type(Entree_fluide_temperature_imposee, la_cl_th.valeur()))
100 { /* Do nothing */ }
101 else if (sub_type(Entree_fluide_T_h_imposee, la_cl_th.valeur()))
102 { /* Do nothing */ }
103 else
104 {
105 message_erreur_therm(la_cl_hydr, la_cl_th, num_Cl);
106 }
107 }
108 else if ((sub_type(Dirichlet_paroi_fixe, la_cl_hydr.valeur())) || (sub_type(Dirichlet_paroi_defilante, la_cl_hydr.valeur())) || (la_cl_hydr->que_suis_je() == "Frontiere_ouverte_vitesse_imposee_ALE"))
109 {
110 if ((sub_type(Neumann_paroi_adiabatique, la_cl_th.valeur())) || (sub_type(Neumann_paroi, la_cl_th.valeur())) || (sub_type(Echange_global_impose, la_cl_th.valeur()))
111 || (sub_type(Echange_externe_impose, la_cl_th.valeur())) || (sub_type(Scalaire_impose_paroi, la_cl_th.valeur())))
112 { /* Do nothing */ }
113 else
114 {
115 message_erreur_therm(la_cl_hydr, la_cl_th, num_Cl);
116 }
117 }
118 else if (sub_type(Neumann_sortie_libre, la_cl_hydr.valeur()))
119 {
120 if ((sub_type(Entree_fluide_temperature_imposee, la_cl_th.valeur())) || (sub_type(Neumann_sortie_libre, la_cl_th.valeur())))
121 { /* Do nothing */}
122 else
123 {
124 message_erreur_therm(la_cl_hydr, la_cl_th, num_Cl);
125 }
126 }
127 else if (sub_type(Symetrie, la_cl_hydr.valeur()))
128 {
129 if ((sub_type(Neumann_paroi_adiabatique, la_cl_th.valeur())) || (sub_type(Neumann_paroi, la_cl_th.valeur())) || (sub_type(Echange_global_impose, la_cl_th.valeur()))
130 || (sub_type(Echange_externe_impose, la_cl_th.valeur())) || (sub_type(Scalaire_impose_paroi, la_cl_th.valeur())) || (sub_type(Symetrie, la_cl_th.valeur())))
131 { /* Do nothing */}
132 else
133 {
134 message_erreur_therm(la_cl_hydr, la_cl_th, num_Cl);
135 }
136 }
137 else if (sub_type(Periodique, la_cl_hydr.valeur()))
138 {
139 if (sub_type(Periodique, la_cl_th.valeur()))
140 { /* Do nothing */}
141 else
142 {
143 message_erreur_therm(la_cl_hydr, la_cl_th, num_Cl);
144 }
145 }
146 }
147 return 1;
148}
149
150/*! @brief Displays an error message for the preceding function.
151 *
152 * @param la_cl_hydr the hydraulic boundary condition
153 * @param la_cl_th the thermal boundary condition
154 * @param num_Cl the boundary condition index
155 * @return always 1
156 */
157int message_erreur_therm(const Cond_lim& la_cl_hydr, const Cond_lim& la_cl_th, int& num_Cl)
158{
159 Cerr << "The hydraulic and thermal boundary conditions are not consitent on border:" << finl;
160 Cerr << "Boundary conditions number " << num_Cl << " \"" << la_cl_th->frontiere_dis().le_nom() << "\" have been assigned to : " << finl;
161 Cerr << la_cl_hydr->que_suis_je() << " and " << la_cl_th->que_suis_je() << " !! " << finl;
163 return 1;
164}
165
166/*! @brief Tests the compatibility of the concentration and hydraulic boundary conditions.
167 *
168 * The compatibility list is as follows:
169 * -----------------------------------------------------------------------
170 * Hydraulique | Concentration
171 * -----------------------------------------------------------------------
172 * Entree_fluide_vitesse_imposee ===> Entree_fluide_concentration_imposee
173 * =================================> Neumann_sortie_libre
174 * -----------------------------------------------------------------------
175 * Dirichlet_paroi_fixe |
176 * Dirichlet_paroi_defilante =======> Neumann_paroi_flux_nul
177 * -----------------------------------------------------------------------
178 * Neumann_sortie_libre ============> Neumann_sortie_libre
179 * =================================> Entree_fluide_concentration_imposee
180 * -----------------------------------------------------------------------
181 * Symetrie ========================> Symetrie
182 * =================================> Neumann_paroi_flux_nul
183 * -----------------------------------------------------------------------
184 * Periodique ======================> Periodique
185 *
186 * @param domaine_Cl_hydr the hydraulic boundary conditions domain
187 * @param domaine_Cl_co the concentration boundary conditions domain
188 * @return always 1
189 * @throws different number of boundary conditions
190 * @throws incompatible hydraulic and concentration boundary conditions
191 */
192int tester_compatibilite_hydr_concentration(const Domaine_Cl_dis_base& domaine_Cl_hydr, const Domaine_Cl_dis_base& domaine_Cl_co)
193{
194
195 int nb_Cl = domaine_Cl_hydr.nb_cond_lim();
196
197 if (domaine_Cl_co.nb_cond_lim() != nb_Cl)
198 {
199 Cerr << "The two objects of OWN_PTR(Domaine_Cl_dis_base) type don't have" << finl;
200 Cerr << "the same number of boundary conditions." << finl;
202 }
203
204 for (int num_Cl = 0; num_Cl < nb_Cl; num_Cl++)
205 {
206 const Cond_lim& la_cl_hydr = domaine_Cl_hydr.les_conditions_limites(num_Cl);
207 const Cond_lim& la_cl_co = domaine_Cl_co.les_conditions_limites(num_Cl);
208
209 if (sub_type(Entree_fluide_vitesse_imposee, la_cl_hydr.valeur()))
210 {
211 if ((sub_type(Entree_fluide_concentration_imposee, la_cl_co.valeur())) || (sub_type(Neumann_sortie_libre, la_cl_co.valeur())))
212 { /* Do nothing */ }
213 else
214 {
215 message_erreur_conc(la_cl_hydr, la_cl_co, num_Cl);
216 }
217 }
218 else if ((sub_type(Dirichlet_paroi_fixe, la_cl_hydr.valeur())) || (sub_type(Dirichlet_paroi_defilante, la_cl_hydr.valeur())))
219 {
220 if ((!sub_type(Neumann_paroi_flux_nul, la_cl_co.valeur())) && (!sub_type(Neumann_paroi, la_cl_co.valeur())) && (!sub_type(Scalaire_impose_paroi, la_cl_co.valeur())))
221 {
222 message_erreur_conc(la_cl_hydr, la_cl_co, num_Cl);
223 }
224 }
225 else if (sub_type(Neumann_sortie_libre, la_cl_hydr.valeur()))
226 {
227 if ((sub_type(Neumann_sortie_libre, la_cl_co.valeur())) || (sub_type(Entree_fluide_concentration_imposee, la_cl_co.valeur())))
228 { /* Do nothing */}
229 else
230 {
231 message_erreur_conc(la_cl_hydr, la_cl_co, num_Cl);
232 }
233 }
234 else if (sub_type(Symetrie, la_cl_hydr.valeur()))
235 {
236 if ((sub_type(Symetrie, la_cl_co.valeur())) || (sub_type(Neumann_paroi_flux_nul, la_cl_co.valeur()))|| (sub_type(Echange_externe_impose, la_cl_co.valeur())))
237 { /* Do nothing */}
238 else
239 {
240 message_erreur_conc(la_cl_hydr, la_cl_co, num_Cl);
241 }
242 }
243 else if (sub_type(Periodique, la_cl_hydr.valeur()))
244 {
245 if (sub_type(Periodique, la_cl_co.valeur()))
246 { /* Do nothing */}
247 else
248 {
249 message_erreur_conc(la_cl_hydr, la_cl_co, num_Cl);
250 }
251 }
252 }
253
254 return 1;
255}
256
257/*! @brief Displays an error message for the preceding function.
258 *
259 * @param la_cl_hydr the hydraulic boundary condition
260 * @param la_cl_co the concentration boundary condition
261 * @param num_Cl the boundary condition index
262 * @return always 1
263 */
264int message_erreur_conc(const Cond_lim& la_cl_hydr, const Cond_lim& la_cl_co, int& num_Cl)
265{
266 Cerr << "The hydraulic and concentration boundary conditions are not consitent on border:" << finl;
267 Cerr << "Boundary conditions number " << num_Cl << " \"" << la_cl_co->frontiere_dis().le_nom() << "\" have been assigned to : " << finl;
268 Cerr << la_cl_hydr->que_suis_je() << " and " << la_cl_co->que_suis_je() << " !! " << finl;
270 return 1;
271}
272
273/*! @brief Tests the compatibility of the mass fraction and hydraulic boundary conditions.
274 *
275 * The compatibility list is as follows:
276 * -----------------------------------------------------------------------
277 * Hydraulique | Fraction massique
278 * -----------------------------------------------------------------------
279 * Entree_fluide_vitesse_imposee ===> Entree_fluide_fraction_massique_imposee
280 * Entree_fluide_vitesse_imposee_libre => Neumann_sortie_libre
281 * Entree_fluide_vitesse_imposee ===> Echange_externe_impose
282 * Entree_fluide_vitesse_imposee ===> Neumann_paroi
283 * -----------------------------------------------------------------------
284 * Dirichlet_paroi_fixe |
285 * Dirichlet_paroi_defilante =======> Neumann_paroi_flux_nul
286 * =================================> Echange_externe_impose
287 * -----------------------------------------------------------------------
288 * Neumann_sortie_libre ============> Entree_fluide_fraction_massique_imposee
289 * =================================> Neumann_sortie_libre
290 * -----------------------------------------------------------------------
291 * Symetrie ========================> Symetrie
292 * =================================> Neumann_paroi_flux_nul
293 * =================================> Neumann_paroi
294 * -----------------------------------------------------------------------
295 * Periodique ======================> Periodique
296 *
297 * @param domaine_Cl_hydr the hydraulic boundary conditions domain
298 * @param[in] domaine_Cl_fm the mass fraction boundary conditions domain
299 * @return always 1
300 * @throws different number of boundary conditions
301 * @throws incompatible hydraulic and mass fraction boundary conditions
302 */
303int tester_compatibilite_hydr_fraction_massique(const Domaine_Cl_dis_base& domaine_Cl_hydr, const Domaine_Cl_dis_base& domaine_Cl_fm)
304{
305
306 int nb_Cl = domaine_Cl_hydr.nb_cond_lim();
307
308 if (domaine_Cl_fm.nb_cond_lim() != nb_Cl)
309 {
310 Cerr << "The two objects of OWN_PTR(Domaine_Cl_dis_base) type don't have" << finl;
311 Cerr << "the same number of boundary conditions." << finl;
313 }
314
315 for (int num_Cl = 0; num_Cl < nb_Cl; num_Cl++)
316 {
317 const Cond_lim& la_cl_hydr = domaine_Cl_hydr.les_conditions_limites(num_Cl);
318 const Cond_lim& la_cl_fm = domaine_Cl_fm.les_conditions_limites(num_Cl);
319 if (sub_type(Entree_fluide_vitesse_imposee_libre, la_cl_hydr.valeur()))
320 {
321 if ((sub_type(Entree_fluide_fraction_massique_imposee, la_cl_fm.valeur())) || (sub_type(Neumann_sortie_libre, la_cl_fm.valeur())) || (sub_type(Echange_externe_impose, la_cl_fm.valeur()))
322 || (sub_type(Neumann_paroi, la_cl_fm.valeur())))
323 { /* Do nothing */ }
324 else
325 {
326 message_erreur_fraction_massique(la_cl_hydr, la_cl_fm, num_Cl);
327 }
328 }
329 else if (sub_type(Entree_fluide_vitesse_imposee, la_cl_hydr.valeur()))
330 {
331 if (sub_type(Entree_fluide_fraction_massique_imposee, la_cl_fm.valeur()))
332 { /* Do nothing */ }
333 else
334 {
335 message_erreur_fraction_massique(la_cl_hydr, la_cl_fm, num_Cl);
336 }
337 }
338 else if ((sub_type(Dirichlet_paroi_fixe, la_cl_hydr.valeur())) || (sub_type(Dirichlet_paroi_defilante, la_cl_hydr.valeur())))
339 {
340 if ((!sub_type(Neumann_paroi_flux_nul, la_cl_fm.valeur())) && (!sub_type(Neumann_paroi, la_cl_fm.valeur())) && (!sub_type(Scalaire_impose_paroi, la_cl_fm.valeur()))
341 && (!sub_type(Echange_externe_impose, la_cl_fm.valeur())))
342 {
343 message_erreur_fraction_massique(la_cl_hydr, la_cl_fm, num_Cl);
344 }
345
346 }
347 else if (sub_type(Neumann_sortie_libre, la_cl_hydr.valeur()))
348 {
349 if ((sub_type(Entree_fluide_fraction_massique_imposee, la_cl_fm.valeur())) || (sub_type(Neumann_sortie_libre, la_cl_fm.valeur())))
350 { /* Do nothing */}
351 else
352 {
353 message_erreur_fraction_massique(la_cl_hydr, la_cl_fm, num_Cl);
354 }
355 }
356 else if (sub_type(Symetrie, la_cl_hydr.valeur()))
357 {
358 if ((sub_type(Symetrie, la_cl_fm.valeur())) || (sub_type(Neumann_paroi_flux_nul, la_cl_fm.valeur())) || (sub_type(Neumann_paroi, la_cl_fm.valeur())))
359 { /* Do nothing */}
360 else
361 {
362 message_erreur_fraction_massique(la_cl_hydr, la_cl_fm, num_Cl);
363 }
364 }
365 else if (sub_type(Periodique, la_cl_hydr.valeur()))
366 {
367 if (sub_type(Periodique, la_cl_fm.valeur()))
368 { /* Do nothing */}
369 else
370 {
371 message_erreur_fraction_massique(la_cl_hydr, la_cl_fm, num_Cl);
372 }
373 }
374 }
375 return 1;
376}
377
378/*! @brief Displays an error message for the preceding function.
379 *
380 * @param la_cl_hydr the hydraulic boundary condition
381 * @param la_cl_frac_mass the mass fraction boundary condition
382 * @param num_Cl the boundary condition index
383 * @return always 1
384 */
385int message_erreur_fraction_massique(const Cond_lim& la_cl_hydr, const Cond_lim& la_cl_frac_mass, int& num_Cl)
386{
387 Cerr << "The hydraulic and massic fraction boundary conditions are not consitent on border:" << finl;
388 Cerr << "Boundary conditions number " << num_Cl << " \"" << la_cl_frac_mass->frontiere_dis().le_nom() << "\" have been assigned to : " << finl;
389 Cerr << la_cl_hydr->que_suis_je() << " and " << la_cl_frac_mass->que_suis_je() << " !! " << finl;
391 return 1;
392}
class Cond_lim Generic class used to represent any class
Definition Cond_lim.h:31
Dirichlet_paroi_defilante Imposes the wall velocity in an equation of type Navier_Stokes.
Dirichlet_paroi_fixe Represents a fixed wall in a Navier-Stokes type equation.
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
int nb_cond_lim() const
Returns the number of boundary conditions.
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
Classe Echange_externe_impose: This class represents the special case of the class.
Classe Echange_global_impose This class represents the special case of the class.
Entree_fluide_temperature_imposee Special case of the Dirichlet_entree_fluide class.
Entree_fluide_temperature_imposee Special case of the class Dirichlet_entree_fluide for imposed tempe...
Entree_fluide_vitesse_imposee_libre Special case of the class Entree_fluide_vitesse_imposee for impos...
Entree_fluide_vitesse_imposee Special case of the class Dirichlet_entree_fluide.
Classe Neumann_paroi_adiabatique This boundary condition corresponds to an adiabatic wall in a.
Classe Neumann_paroi_flux_nul This boundary condition imposes a zero flux at the boundary.
Classe Neumann_paroi This boundary condition corresponds to an imposed flux for the.
Neumann_sortie_libre This class represents an open boundary without imposed velocity.
class Periodique This class represents a periodic boundary condition.
Definition Periodique.h:31
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Scalaire_impose_paroi Imposes a scalar at the wall in a Convection-Diffusion equation for a scalar.
Symetrie On symmetry faces, the following properties hold:
Definition Symetrie.h:37