TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Dirichlet.cpp
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#include <Domaine_Cl_dis_base.h>
17#include <Equation_base.h>
18#include <Dirichlet.h>
19
20Implemente_base(Dirichlet, "Dirichlet", Cond_lim_base);
21// XD dirichlet condlim_base dirichlet INHERITS_BRACE Dirichlet condition at the boundary called bord (edge) : 1). For
22// XD_CONT Navier-Stokes equations, velocity imposed at the boundary; 2). For scalar transport equation, scalar imposed
23// XD_CONT at the boundary.
24
25Sortie& Dirichlet::printOn(Sortie& s) const { return s << que_suis_je() << finl; }
26
28
29/*! @brief Renvoie la valeur imposee sur la i-eme composante du champ a la frontiere au temps par defaut du champ_front.
30 *
31 * @param (int i) indice suivant la premiere dimension du champ
32 * @return (double) la valeur imposee sur la composante du champ specifiee
33 * @throws deuxieme dimension du champ de frontiere superieur a 1
34 */
35double Dirichlet::val_imp(int i) const
36{
37 return val_imp_au_temps(le_champ_front->get_temps_defaut(), i);
38}
39
40/*! @brief Renvoie la valeur imposee sur la (i,j)-eme composante du champ a la frontiere au temps par defaut du champ_front.
41 *
42 * @param (int i) indice suivant la premiere dimension du champ
43 * @param (int j) indice suivant la deuxieme dimension du champ
44 * @return (double) la valeur imposee sur la composante du champ specifiee
45 */
46double Dirichlet::val_imp(int i, int j) const
47{
48 return val_imp_au_temps(le_champ_front->get_temps_defaut(), i, j);
49}
50
51/*! @brief Renvoie la valeur imposee sur la i-eme composante du champ a la frontiere au temps precise.
52 *
53 */
54double Dirichlet::val_imp_au_temps(double temps, int i) const
55{
56 const DoubleTab& tab = le_champ_front->valeurs_au_temps(temps);
57 if (tab.size() == 1)
58 return tab(0, 0);
59 if (tab.line_size() == 1)
60 return tab(i, 0);
61 else
62 Cerr << "Dirichlet::val_imp error" << finl;
63 exit();
64 return 0.;
65}
66
67/**
68 * @class Dirichlet
69 * @brief Implements Dirichlet boundary conditions for fields.
70 *
71 * This class defines the Dirichlet boundary condition, which imposes specific values
72 * on the field at the boundary. It provides methods to retrieve the imposed values
73 * at specified times and components of the field.
74 */
75const DoubleTab& Dirichlet::tab_val_imp(double temps) const
76{
77 if (temps==DMAXFLOAT) temps = le_champ_front->get_temps_defaut();
78 const Front_VF& le_bord = ref_cast(Front_VF, frontiere_dis());
79 // ToDo factorize in Champ_front_base::valeurs_face()
80 int size = le_champ_front->valeurs().dimension(0) == 1 ? le_bord.nb_faces_tot() : le_champ_front->valeurs().dimension_tot(0);
81 if (size>0)
82 {
83 bool update = le_champ_front->instationnaire();
84 if (tab_.dimension(0) != size)
85 {
86 tab_.resize(size, le_champ_front->valeurs().dimension(1));
87 update = true;
88 }
89 update = true; // Provisoire
90 if (update)
91 {
92 int nb_comp = tab_.dimension(1);
93 for (int face = 0; face < size; face++)
94 for (int comp = 0; comp < nb_comp; comp++)
95 tab_(face, comp) = val_imp_au_temps(temps, face, comp);
96 }
97 }
98 return tab_;
99}
100
101/*! @brief Renvoie la valeur imposee sur la (i,j)-eme composante du champ a la frontiere au temps precise.
102 *
103 */
104double Dirichlet::val_imp_au_temps(double temps, int i, int j) const
105{
106 const DoubleTab& tab = le_champ_front->valeurs_au_temps(temps);
107 if (tab.dimension(0) == 1)
108 return tab(0, j);
109 else
110 return tab(i, j);
111}
112
114{
115 if (le_champ_front)
116 {
117 const Equation_base& eq = domaine_Cl_dis().equation();
118 const int nb_comp = le_champ_front->nb_comp();
119 eq.verifie_ch_init_nb_comp_cl(eq.inconnue(), nb_comp, *this);
120 }
121}
classe Cond_lim_base Classe de base pour la hierarchie des classes qui representent les differentes c...
Domaine_Cl_dis_base & domaine_Cl_dis()
Renvoie le domaine des conditions aux limites discretisee dont l'objet fait partie.
virtual Frontiere_dis_base & frontiere_dis()
Renvoie la frontiere discretisee a laquelle les conditions aux limites s'appliquent.
classe Dirichlet Cette classe est la classe de base de la hierarchie des conditions aux limites de ty...
Definition Dirichlet.h:31
DoubleTab tab_
Definition Dirichlet.h:42
virtual double val_imp(int i) const
Renvoie la valeur imposee sur la i-eme composante du champ a la frontiere au temps par defaut du cham...
Definition Dirichlet.cpp:35
virtual double val_imp_au_temps(double temps, int i) const
Renvoie la valeur imposee sur la i-eme composante du champ a la frontiere au temps precise.
Definition Dirichlet.cpp:54
void verifie_ch_init_nb_comp() const override
Appel la verification du champ lu par l intermediaire de l equation pour laquelle on considere la con...
virtual const DoubleTab & tab_val_imp(double temps=DMAXFLOAT) const
Definition Dirichlet.cpp:75
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
virtual const Champ_Inc_base & inconnue() const =0
virtual void verifie_ch_init_nb_comp_cl(const Champ_Inc_base &ch_ref, const int nb_comp, const Cond_lim_base &cl) const
class Front_VF
Definition Front_VF.h:36
int nb_faces_tot() const
Definition Front_VF.h:58
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
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
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
_SIZE_ size() const
Definition TRUSTVect.tpp:45
int line_size() const
Definition TRUSTVect.tpp:67