TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Verif_Cl_Turb.cpp
1/****************************************************************************
2* Copyright (c) 2015 - 2016, 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 <Verif_Cl_Turb.h>
17
18#include <Periodique.h>
19#include <Dirichlet_paroi_fixe.h>
20#include <Dirichlet_paroi_defilante.h>
21#include <Dirichlet_entree_fluide_leaves.h>
22#include <Entree_fluide_K_Eps_impose.h>
23#include <Entree_fluide_K_Omega_impose.h>
24#include <Neumann_paroi.h>
25#include <Neumann_paroi_flux_nul.h>
26#include <Symetrie.h>
27#include <Neumann_sortie_libre.h>
28#include <Motcle.h>
29#include <Frontiere_dis_base.h>
30#include <Probleme_base.h>
31#include <Equation_base.h>
32#include <Nom.h>
33
34/*! @brief Teste la compatibilite des conditions aux limites hydrauliques et turbulentes.
35 *
36 * La liste des compatibilites est la suivante:
37 * -----------------------------------------------------------------------
38 * Hydraulique | Turbulence
39 * -----------------------------------------------------------------------
40 * Dirichlet_paroi_fixe ou
41 * Dirichlet_paroi_defilante =======> Neumann_paroi_flux_nul
42 * =================================> Dirichlet_paroi_fixe (pour bas_reynolds)
43 * -----------------------------------------------------------------------
44 * Symetrie ========================> Symetrie
45 * =================================> Neumann_paroi_flux_nul
46 * -----------------------------------------------------------------------
47 * Neumann_sortie_libre ============> Neumann_sortie_libre
48 * =================================> Entree_fluide_K_Eps_impose
49 * -----------------------------------------------------------------------
50 * Entree_fluide_vitesse_imposee ===> Entree_fluide_K_Eps_impose
51 * =================================> Neumann_sortie_libre
52 * =================================> Symetrie
53 * -----------------------------------------------------------------------
54 * Periodique ======================> Periodique
55 * -----------------------------------------------------------------------
56 *
57 * @param (Domaine_Cl_dis_base& domaine_Cl_hydr)
58 * @param (Domaine_Cl_dis_base& domaine_Cl_turb)
59 * @return (int) renvoie toujours 1
60 * @throws nombres de conditions aux limites differents
61 * @throws conditions aux limite hydraulique et turbulentes incompatible
62 */
63int tester_compatibilite_hydr_turb(const Domaine_Cl_dis_base& domaine_Cl_hydr, const Domaine_Cl_dis_base& domaine_Cl_turb)
64{
65
66 int nb_Cl = domaine_Cl_hydr.nb_cond_lim();
67
68 if (domaine_Cl_turb.nb_cond_lim() != nb_Cl)
69 {
70 Cerr << "The two objects of OWN_PTR(Domaine_Cl_dis_base) type don't have" << finl;
71 Cerr << "the same number of boundary conditions." << finl;
73 }
74
75 for (int num_Cl=0; num_Cl<nb_Cl; num_Cl++)
76 {
77 const Cond_lim& la_cl_turb = domaine_Cl_turb.les_conditions_limites(num_Cl);
78 const Cond_lim& la_cl_hydr = domaine_Cl_hydr.les_conditions_limites(num_Cl);
79
80 // on teste si une des deux CL est periodique
81 // et s'il y en a une, on verifie que les CL des deux eq sont periodiques
82 if ( (sub_type(Periodique,la_cl_hydr.valeur()) || sub_type(Periodique,la_cl_turb.valeur())) &&
83 ( ! ( sub_type(Periodique,la_cl_hydr.valeur()) && sub_type(Periodique,la_cl_turb.valeur()) ) ) )
84 {
85 message_erreur_turb( la_cl_hydr, la_cl_turb, num_Cl);
86 }
87
88 // hyd symetrie et turb (symetrie ou Neumann_paroi_flux_nul("paroi"))
89 if ( sub_type(Symetrie,la_cl_hydr.valeur()) &&
90 ! ( sub_type(Symetrie,la_cl_turb.valeur()) ||
91 sub_type(Neumann_paroi_flux_nul,la_cl_turb.valeur()) ) )
92 {
93 message_erreur_turb( la_cl_hydr, la_cl_turb, num_Cl);
94 }
95
96 // hyd (paroi_fixe ou defilante) et turb (paroi ou paroi_fixe)
97 if ( (sub_type(Dirichlet_paroi_fixe,la_cl_hydr.valeur()) || sub_type(Dirichlet_paroi_defilante,la_cl_hydr.valeur())) &&
98 ! ( sub_type(Neumann_paroi_flux_nul,la_cl_turb.valeur()) || sub_type(Dirichlet_paroi_fixe,la_cl_turb.valeur()) ) )
99 {
100 message_erreur_turb( la_cl_hydr, la_cl_turb, num_Cl);
101 }
102
103 // hyd (sortie_libre) et turb (sortie_libre ou k_eps_impose)
104 if ( sub_type(Neumann_sortie_libre,la_cl_hydr.valeur()) &&
105 ! ( sub_type(Neumann_sortie_libre,la_cl_turb.valeur()) ||
106 sub_type(Entree_fluide_K_Eps_impose,la_cl_turb.valeur()) ||
107 sub_type(Entree_fluide_K_Omega_impose,la_cl_turb.valeur())
108 ) )
109 {
110 message_erreur_turb( la_cl_hydr, la_cl_turb, num_Cl);
111 }
112
113 // hyd (Entree_fluide_vitesse_imposee ou Frontiere_ouverte_vitesse_imposee)
114 // et turb (Entree_fluide_K_Eps_impose ou Frontiere_ouverte_K_Eps_impose)
115 Nom pbb = domaine_Cl_hydr.equation().probleme().que_suis_je();
116 if ( sub_type(Entree_fluide_vitesse_imposee,la_cl_hydr.valeur()) &&
117 ! ( sub_type(Neumann_sortie_libre,la_cl_turb.valeur()) ||
118 sub_type(Entree_fluide_K_Eps_impose,la_cl_turb.valeur()) ||
119 sub_type(Entree_fluide_K_Omega_impose,la_cl_turb.valeur()) ||
120 sub_type(Symetrie,la_cl_turb.valeur()) ) &&
121 + !pbb.contient("ALE"))
122 {
123 message_erreur_turb( la_cl_hydr, la_cl_turb, num_Cl);
124 }
125
126 }
127 return 1;
128
129}
130
131
132/*! @brief Affiche un message d'erreur pour la fonction precedente
133 *
134 * @param (Domaine_Cl_dis_base& domaine_Cl_hydr)
135 * @param (Domaine_Cl_dis_base& domaine_Cl_turb)
136 * @param (int num_Cl) numero de la CL
137 * @return (int) renvoie toujours 1
138 */
139int message_erreur_turb(const Cond_lim& la_cl_hydr, const Cond_lim& la_cl_turb, int& num_Cl)
140{
141 Cerr << "The hydraulic and turbulent boundary conditions are not consitent on border:" << finl;
142 Cerr << "Boundary conditions number " << num_Cl << " \"" << la_cl_turb->frontiere_dis().le_nom() << "\" have been assigned to : " << finl;
143 Cerr << la_cl_hydr->que_suis_je() << " and " << la_cl_turb->que_suis_je() << " !! " << finl;
145 return 1;
146}
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 Entree_fluide_K_Eps_impose Cas particulier de la classe Dirichlet_entree_fluide
classe Entree_fluide_K_Omega_impose Cas particulier de la classe Dirichlet_entree_fluide
Entree_fluide_vitesse_imposee Special case of the class Dirichlet_entree_fluide.
Probleme_base & probleme()
Returns the problem associated with the equation.
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
Classe Neumann_paroi_flux_nul This boundary condition imposes a zero flux at the boundary.
Neumann_sortie_libre This class represents an open boundary without imposed velocity.
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
bool contient(const Nom &nom) const
Definition Nom.h:86
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
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
Symetrie On symmetry faces, the following properties hold:
Definition Symetrie.h:37