TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Loi_Fermeture_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
17#include <Loi_Fermeture_base.h>
18#include <Probleme_base.h>
19#include <Param.h>
20#include <Champs_compris.h>
21#include <Schema_Temps_base.h>
22
23Implemente_base_sans_constructeur(Loi_Fermeture_base, "Loi_Fermeture_base", Objet_U);
24// XD loi_fermeture_base objet_u loi_fermeture_base BRACE Class for appends fermeture to problem
25
26Loi_Fermeture_base::Loi_Fermeture_base()
27{
29}
30
31/*! @brief This method is the first called by the problem to construct the object when it is associated with the problem.
32 *
33 * We check that it is not already associated.
34 *
35 */
37{
38 if (status_ == PB_ASSOCIE)
39 {
40 Cerr << "Error associating " << que_suis_je() << " " << le_nom();
41 Cerr << " to problem " << pb.que_suis_je();
42 Cerr << ".\n This object is already associated to problem " << mon_probleme().le_nom() << finl;
43 barrier();
44 exit();
45 }
46 assert(status_ == INITIAL);
47 mon_probleme_ = pb;
49}
50
51/*! @brief This method is called by the problem after the discretization of equations and medium and before
52 *
53 * the call to readOn() for reading parameters.
54 * In derived classes it must at least discretize the fields
55 * that will be required in the readOn() of equations or other
56 * closure laws.
57 *
58 */
64
65/*! @brief This method calls the set_param() method to initialize the parameters, then reads the parameters.
66 *
67 * In the implementation of derived classes we can simply
68 * call the base class method and check the parameters.
69 *
70 */
72{
73 assert(status_ == DISCRETISE);
74 Param param(que_suis_je());
75 set_param(param);
76 param.lire_avec_accolades_depuis(is);
78 return is;
79}
80
81/*! @brief For now, exit()
82 *
83 */
85{
86 Cerr << "Loi_Fermeture_base::printOn not coded" << finl;
87 exit();
88 return os;
89}
90
91/*! @brief This method is called by the readOn of the class.
92 *
93 * It must be overridden in derived classes to add to "param" the
94 * various parameters to be read from the dataset and call
95 * the ancestor method. In the base class: no parameters.
96 *
97 */
99{
100}
101
102/*! @brief This method is called after reading all equations and closure laws (all fields and boundary conditions
103 *
104 * of the problem are available)
105 *
106 */
108{
109 assert(status_ == READON_FAIT);
111}
112
113/*! @brief Returns the problem (this method was created to avoid giving write access to the problem via the REF)
114 *
115 */
117{
118 return mon_probleme_.valeur();
119}
120
121/*! @brief This method is called by the problem after preparer_calcul() of equations and medium.
122 *
123 * It must update all fields it manages based on the other
124 * fields of the problem.
125 *
126 */
128{
129 assert(status_ == COMPLET);
130 const double temps = mon_probleme().schema_temps().temps_courant();
131 mettre_a_jour(temps);
132}
133
134/*! @brief This method is called by the problem after mettre_a_jour() of equations and medium.
135 *
136 * It must update all fields it manages based on the other
137 * fields of the problem.
138 *
139 */
141{
142 assert(status_ == COMPLET);
143}
144
145/*! @brief This method returns the field named "nom" if it is understood by the class, otherwise calls the get_champ method of the ancestor.
146 *
147 * In the base class, the Champ_compris_erreur exception is raised.
148 *
149 */
151{
152 return champs_compris_.get_champ(nom);
153}
154bool Loi_Fermeture_base::has_champ(const Motcle& nom, OBS_PTR(Champ_base) &ref_champ) const
155{
156 return champs_compris_.has_champ(nom, ref_champ);
157}
158
160{
161 return champs_compris_.has_champ(nom);
162}
163
165{
166 if (opt == DESCRIPTION)
167 Cerr << que_suis_je() << ": " << champs_compris_.liste_noms_compris() << finl;
168 else
169 noms.add(champs_compris_.liste_noms_compris());
170}
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
bool has_champ(const Motcle &nom, OBS_PTR(FIELD_TYPE)&ref_champ) const
class Discretisation_base This class represents a spatial discretization scheme, which
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
: Base class of closure laws.
const Champ_base & get_champ(const Motcle &nom) const override
This method returns the field named "nom" if it is understood by the class, otherwise calls the get_c...
virtual void discretiser(const Discretisation_base &)
This method is called by the problem after the discretization of equations and medium and before.
const Probleme_base & mon_probleme() const
Returns the problem (this method was created to avoid giving write access to the problem via the REF)...
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
virtual void associer_pb_base(const Probleme_base &)
This method is the first called by the problem to construct the object when it is associated with the...
virtual void preparer_calcul()
This method is called by the problem after preparer_calcul() of equations and medium.
virtual void set_param(Param &param) const override
This method is called by the readOn of the class.
Champs_compris champs_compris_
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base)&ref_champ) const override
virtual void completer()
This method is called after reading all equations and closure laws (all fields and boundary condition...
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
virtual void mettre_a_jour(double temps)
This method is called by the problem after mettre_a_jour() of equations and medium.
A character string (Nom) in uppercase.
Definition Motcle.h:26
An array of character strings (VECT(Nom)).
Definition Noms.h:26
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
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Probleme_U.h:109
class Probleme_base It is a Probleme_U that is not a coupling.
const Schema_Temps_base & schema_temps() const
Returns the time scheme associated with the problem.
static void barrier()
Synchronizes all processors in the current group (waits until all processors have reached the barrier...
Definition Process.cpp:133
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
double temps_courant() const
Returns the current time.
Base class for output streams.
Definition Sortie.h:52