TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Cond_lim_base.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 <Discretisation_base.h>
17#include <Domaine_Cl_dis_base.h>
18#include <Cond_lim_base.h>
19#include <Equation_base.h>
20
21Implemente_base(Cond_lim_base, "Cond_lim_base", Objet_U);
22// XD condlim_base objet_u condlim_base NO_BRACE Basic class of boundary conditions.
23
24Sortie& Cond_lim_base::printOn(Sortie& s) const { return s << le_champ_front; }
25
26Entree& Cond_lim_base::readOn(Entree& s) { return s >> le_champ_front; }
27
28/*! @brief DOES NOTHING must be overridden in derived classes
29 *
30 */
35
37{
38 if (app_domains.size() == 0)
39 {
40 Cerr << "You call Cond_lim_base::compatible_avec_eqn but the std::vector app_domains is not filled ! Check your readOn !!" << finl;
42 }
43
44 Motcle dom_app = eqn.domaine_application();
45 for (const auto &itr : app_domains)
46 if (itr == dom_app) return 1;
47
49 return 0;
50}
51
52/*! @brief Changes the i-th future time of the BC.
53 *
54 */
55void Cond_lim_base::changer_temps_futur(double temps, int i)
56{
58}
59
60/*! @brief Rotates the wheel of the BC
61 *
62 */
63int Cond_lim_base::avancer(double temps)
64{
65 return champ_front().avancer(temps);
66}
67
68/*! @brief Rotates the wheel of the BC
69 *
70 */
71int Cond_lim_base::reculer(double temps)
72{
73 return champ_front().reculer(temps);
74}
75
76/*! @brief Initialization at the beginning of the calculation.
77 *
78 * Must be called before any calculate_exchange_coefficients or update
79 * Unlike the update methods, the
80 * initialize methods of BCs cannot depend on the outside
81 * (it may not be initialized itself)
82 *
83 * @return (0 in case of error, 1 otherwise.)
84 */
86{
87 return le_champ_front->initialiser(temps, domaine_Cl_dis().inconnue());
88}
89
90/*! @brief Performs a time update of the boundary condition.
91 *
92 * @param (double temps) the time step for update
93 */
95{
96 le_champ_front->mettre_a_jour(temps);
97}
98
99/* @brief Reset current time for the boundary condition.
100 *
101 * A BC is regarded as an input, so here this is equivalent to a 'mettre_a_jour'
102 */
104{
105 mettre_a_jour(time);
106}
107
108/*! @brief Indicates whether this boundary condition must be updated during sub-time steps of a time scheme such as RK.
109 *
110 * By default it returns 0 to indicate that no update
111 * is necessary; it must be overloaded to return 1 if needed
112 * (example: Echange_impose_base)
113 *
114 * @param (double temps) the time step for update
115 */
117{
118 return 0;
119}
120
121/*! @brief Computation of exchange coefficients for coupling via Champ_front_contact_VEF.
122 *
123 * These computations are local to the problem and depend only on
124 * the unknown. They must therefore be done every time the
125 * unknown is modified. They are available externally and
126 * stored in the BCs.
127 * WEC: Champ_front_contact_VEF should disappear and this
128 * method with it!!!
129 *
130 * @param (double temps) the time step for update
131 */
133{
134 le_champ_front->calculer_coeffs_echange(temps);
135}
136
137/*! @brief Calls the verification of the field read through the equation for which the boundary condition is considered.
138 *
139 * The method is overloaded in cases where the user must
140 * specify the boundary field.
141 *
142 */
144{
145
146}
147
148/*! @brief Associates the boundary with the object.
149 *
150 * The Frontiere_dis_base object is in fact associated with the member
151 * OWN_PTR(Champ_front_base) of the Cond_lim_base object that represents the field of boundary
152 * conditions imposed on the boundary.
153 *
154 * @param (Frontiere_dis_base& fr) the boundary on which the boundary conditions are imposed
155 */
157{
158 assert(le_champ_front);
159 le_champ_front->associer_fr_dis_base(fr);
161}
162
163/*! @brief Associates the Domaine_Cl_dis_base (domain of discretized boundary conditions) with the object.
164 *
165 * This Domaine_Cl_dis_base stores (references) all the boundary
166 * conditions relative to a geometric domain.
167 *
168 * @param (Domaine_Cl_dis_base& zcl) a domain of discretized boundary conditions to which the Cond_lim_base object refers
169 */
171{
172 mon_dom_cl_dis = zcl;
173 le_champ_front->verifier(*this);
174}
175
176/*! @brief Returns 1 if the boundary condition is compatible with the discretization passed as parameter.
177 *
178 * @param (Discretisation_base&) the discretization with which we want to verify compatibility
179 */
181{
182 if (supp_discs.size() == 0) return 1;
183 else
184 {
185 Nom type_discr = discr.que_suis_je();
186 for (const auto &itr : supp_discs)
187 if (itr == type_discr) return 1;
188
189 err_pas_compatible(discr);
190 return 0;
191 }
192}
193
194/*! @brief This method is called when the boundary condition is not compatible with the equation on which we try
195 *
196 * to apply it.
197 *
198 * @param (Equation_base& eqn) the equation with which the boundary condition is incompatible
199 */
201{
202 Cerr << "The boundary condition " << que_suis_je() << " can't apply to " << finl << "the equation of kind " << eqn.que_suis_je() << finl;
203 exit();
204}
205
206/*! @brief This method is called when the boundary condition is not compatible with the discretization on which we try
207 *
208 * to apply it.
209 *
210 * @param (Discretisation_base& discr) the discretization with which the boundary condition is incompatible
211 */
213{
214 Cerr << "The boundary condition " << que_suis_je() << " can't be used with " << finl << "the discretization of kind " << discr.que_suis_je() << finl;
215 exit();
216}
217
218void Cond_lim_base::champ_front(int face, DoubleVect& var) const
219{
220 le_champ_front->valeurs_face(face, var);
221}
222
224{
225 Cerr << "Cond_lim_base::injecter_dans_champ_inc()" << finl;
226 Cerr << "this method does nothing and must be overloaded " << finl;
227 Cerr << "Contact TRUST support." << finl;
228 exit();
229}
230/*! @brief Changes the i-th future time of the BC.
231 *
232 */
234{
236}
237/*! @brief Called by Conds_lim::completer. Calls cha_front_base::fixer_nb_valeurs_temporelles.
238 *
239 */
Class Champ_Inc_base.
virtual void changer_temps_futur(double temps, int i)
Changes the time value for the i-th temporal value after the present.
virtual void set_temps_defaut(double temps)
virtual void fixer_nb_valeurs_temporelles(int nb_cases)
Called by Conds_lim::completer. By default does nothing.
virtual int reculer(double temps)
To implement in derived classes.
virtual int avancer(double temps)
To implement in derived classes.
virtual void completer()
virtual void valeurs_face(int, DoubleVect &) const
Returns the vector of field values for the given face.
class Cond_lim_base Base class for the hierarchy of classes that represent the different boundary con...
std::vector< Nom > supp_discs
virtual void changer_temps_futur(double temps, int i)
Changes the i-th future time of the BC.
virtual int compatible_avec_eqn(const Equation_base &) const
virtual void mettre_a_jour(double temps)
Performs a time update of the boundary condition.
virtual void fixer_nb_valeurs_temporelles(int nb_cases)
Called by Conds_lim::completer. Calls cha_front_base::fixer_nb_valeurs_temporelles.
virtual void calculer_coeffs_echange(double temps)
Computation of exchange coefficients for coupling via Champ_front_contact_VEF.
virtual void associer_fr_dis_base(const Frontiere_dis_base &)
Associates the boundary with the object.
virtual int a_mettre_a_jour_ss_pas_dt()
Indicates whether this boundary condition must be updated during sub-time steps of a time scheme such...
virtual int avancer(double temps)
Rotates the wheel of the BC.
void err_pas_compatible(const Equation_base &) const
This method is called when the boundary condition is not compatible with the equation on which we try...
Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the domain of discretized boundary conditions to which the object belongs.
virtual int compatible_avec_discr(const Discretisation_base &) const
Returns 1 if the boundary condition is compatible with the discretization passed as parameter.
virtual void verifie_ch_init_nb_comp() const
Calls the verification of the field read through the equation for which the boundary condition is con...
virtual int reculer(double temps)
Rotates the wheel of the BC.
virtual void injecter_dans_champ_inc(const Champ_Inc_base &) const
virtual void completer()
DOES NOTHING must be overridden in derived classes.
std::vector< Motcle > app_domains
virtual int initialiser(double temps)
Initialization at the beginning of the calculation.
Champ_front_base & champ_front()
virtual void resetTime(double time)
virtual void set_temps_defaut(double temps)
Changes the i-th future time of the BC.
virtual void associer_domaine_cl_dis_base(const Domaine_Cl_dis_base &)
Associates the Domaine_Cl_dis_base (domain of discretized boundary conditions) with the object.
class Discretisation_base This class represents a spatial discretization scheme, which
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
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....
virtual const Motcle & domaine_application() const
Returns "indeterminate" Navier_Stokes_standard for example overrides this method.
class Frontiere_dis_base Class representing a discretized boundary.
A character string (Nom) in uppercase.
Definition Motcle.h:26
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
Base class for TRUST objects (Objet_U).
Definition Objet_U.h:68
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52