TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_front_base.h
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#ifndef Champ_front_base_included
17#define Champ_front_base_included
18
19#include <Field_base.h>
20#include <Champ_Proto.h>
21#include <TRUST_Ref.h>
22#include <Roue.h>
23
25class Champ_Inc_base;
27class Cond_lim_base;
28
29/*! @brief class Champ_front_base Base class for the hierarchy of boundary fields.
30 *
31 * A
32 * Champ_front_base object defines a field on the boundary of a
33 * domain. A Champ_front_base type object will be associated with
34 * each boundary condition.
35 * Champ_front_base derives from Champ_Proto, in order to have an interface
36 * conforming to all fields, and to inherit common operations on
37 * Fields.
38 * The two main methods are initialiser and
39 * mettre_a_jour. These are the only two that can modify the
40 * field values.
41 * The initialiser method is called once at the beginning of
42 * the calculation. It must not depend on data external to
43 * the equation carrying the BC (indeed, nothing guarantees that this
44 * data is initialized). On the other hand, the values of
45 * the unknown on which the BC depends can be useful for
46 * initialization => the unknown is passed as a parameter in
47 * read-only mode.
48 * The mettre_a_jour method is called at the beginning of each time step
49 * or sub-time-step, it can use data
50 * external to the equation. It is the responsibility of the algorithm to ensure
51 * that this data is relevant...
52 * In the case of stationary fields, the mettre_a_jour method
53 * has nothing to do and the values are filled once and
54 * for all by the initialiser method.
55 * In the case of unsteady fields, there are several values in time
56 * and each can be updated.
57 * Champ_front_base are divided into:
58 * * Champ_front_uniforme, constant in time and space
59 * * Champ_front_instationnaire_base, uniform in space but variable in time
60 * * Champ_front_var, variable in space.
61 * Champ_front_var are then classified according to whether they are
62 * stationary or unsteady.
63 *
64 * The values are stored in a wheel of DoubleTab.
65 * If the field is uniform in space, the DoubleTabs are
66 * dimensioned to 1.
67 * If it is stationary, the wheel has only one temporal value
68 * and the time assigned to it is meaningless.
69 * If it is unsteady, the temporal values are those
70 * of the unknown of the equation to which the field refers.
71 *
72 *
73 * @sa Champ_Proto Frontiere_dis_base, Abstract class, Abstract method:, Champ_front_base& affecter_(const Champ_front_base& ch)
74 */
76{
77 Declare_base_sans_constructeur(Champ_front_base);
78public:
80 inline virtual void completer() { }
81 virtual int initialiser(double temps, const Champ_Inc_base& inco);
82 virtual void associer_fr_dis_base(const Frontiere_dis_base&);
84 inline virtual DoubleTab& valeurs() override;
85 inline virtual const DoubleTab& valeurs() const override;
86 virtual bool has_valeurs_au_temps(double temps) const { return true; }
87 virtual DoubleTab& valeurs_au_temps(double temps)=0;
88 virtual const DoubleTab& valeurs_au_temps(double temps) const = 0;
89 virtual const Frontiere_dis_base& frontiere_dis() const;
91 virtual const Domaine_dis_base& domaine_dis() const;
93 virtual void fixer_nb_valeurs_temporelles(int nb_cases);
94 virtual void mettre_a_jour(double temps);
95 virtual void calculer_coeffs_echange(double temps);
96 virtual void valeurs_face(int, DoubleVect&) const;
97 virtual inline void verifier(const Cond_lim_base& la_cl) const;
98 virtual double get_temps_defaut() const { return temps_defaut; }
99 virtual void set_temps_defaut(double temps) { temps_defaut = temps; }
100 virtual void changer_temps_futur(double temps, int i);
101 virtual int avancer(double temps);
102 virtual int reculer(double temps);
103 virtual bool instationnaire() const { return instationnaire_; }
104 virtual void set_instationnaire(bool flag) { instationnaire_ = flag; Gpoint_ = valeurs(); Gpoint_=0; } // Dimensionne Gpoint_
105 virtual inline void set_derivee_en_temps(DoubleTab& Gpoint) { Gpoint_ = Gpoint; }
106 virtual inline const DoubleTab& derivee_en_temps() const { return Gpoint_; }
107 virtual void calculer_derivee_en_temps(double t1, double t2);
108
109protected:
110 double temps_defaut ; // The default time used when the parameter
111 // is not specified. In particular, this is
112 // the time used by operators and solvers.
113 OBS_PTR(Frontiere_dis_base) la_frontiere_dis;
114 Roue_ptr les_valeurs; // The field values
115 DoubleTab Gpoint_; // Time derivative of the boundary condition values
116private:
117 bool instationnaire_ = false; // By default, stationary field
118};
119
120
121/*! @brief Returns the discretized boundary associated with the field.
122 *
123 * (const version)
124 *
125 * @return (Frontiere_dis_base&) the discretized boundary associated with the field
126 */
128{
129 return la_frontiere_dis.valeur();
130}
131
132
133/*! @brief Returns the discretized boundary associated with the field.
134 *
135 * @return (Frontiere_dis_base&) the discretized boundary associated with the field
136 */
138{
139 return la_frontiere_dis.valeur();
140}
141
142
143/*! @brief Returns the array of field values.
144 *
145 * @return (DoubleTab&) the array of field values at the default time.
146 */
147inline DoubleTab& Champ_front_base::valeurs()
148{
150}
151
152
153/*! @brief Returns the array of field values at the default time.
154 *
155 * (const version)
156 *
157 * @return (DoubleTab&) the array of field values
158 */
159inline const DoubleTab& Champ_front_base::valeurs() const
160{
162}
163
164// must be overridden by champ_front classes that want to verify the arguments
165inline void Champ_front_base::verifier(const Cond_lim_base& la_cl) const
166{
167 return;
168}
169
170#endif
Class Champ_Inc_base.
class Champ_Proto Class representing a Field prototype.
Definition Champ_Proto.h:37
virtual DoubleTab & valeurs()=0
virtual int initialiser(double temps, const Champ_Inc_base &inco)
Initialization at the beginning of calculation.
virtual void associer_fr_dis_base(const Frontiere_dis_base &)
Associates a discretized boundary with the field.
virtual const DoubleTab & derivee_en_temps() const
virtual void changer_temps_futur(double temps, int i)
Changes the time value for the i-th temporal value after the present.
virtual const Frontiere_dis_base & frontiere_dis() const
Returns the discretized boundary associated with the field.
virtual Champ_front_base & affecter_(const Champ_front_base &ch)=0
virtual void set_temps_defaut(double temps)
virtual bool instationnaire() const
virtual double get_temps_defaut() const
virtual const Domaine_dis_base & domaine_dis() const
virtual void calculer_coeffs_echange(double temps)
DOES NOTHING, to override. This method can calculate and store useful data for the.
virtual DoubleTab & valeurs() override
Returns the array of field values.
virtual void verifier(const Cond_lim_base &la_cl) const
virtual DoubleTab & valeurs_au_temps(double temps)=0
virtual bool has_valeurs_au_temps(double temps) const
virtual void fixer_nb_valeurs_temporelles(int nb_cases)
Called by Conds_lim::completer. By default does nothing.
virtual const DoubleTab & valeurs_au_temps(double temps) const =0
virtual int reculer(double temps)
To implement in derived classes.
virtual void set_derivee_en_temps(DoubleTab &Gpoint)
virtual int avancer(double temps)
To implement in derived classes.
virtual void mettre_a_jour(double temps)
DOES NOTHING, to override.
OBS_PTR(Frontiere_dis_base) la_frontiere_dis
virtual void completer()
virtual void valeurs_face(int, DoubleVect &) const
Returns the vector of field values for the given face.
virtual void set_instationnaire(bool flag)
virtual void calculer_derivee_en_temps(double t1, double t2)
Computes the rate of change of the field between t1 and t2 and stores it in Gpoint_.
class Cond_lim_base Base class for the hierarchy of classes that represent the different boundary con...
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
class Frontiere_dis_base Class representing a discretized boundary.
Pointer to a wheel.
Definition Roue.h:33