TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Probleme_U.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 Probleme_U_included
17#define Probleme_U_included
18
19#include <ScalarRegister.h>
20#include <TRUST_Ref.h>
21
23class Field_base;
24class Noms;
25
26namespace ICoCo
27{
28class TrioField;
29}
30
31/*! @brief classe Probleme_U
32 *
33 * Cette classe ajoute des specificites TRUST a l'interface
34 * generale definie dans la classe Problem.
35 *
36 * De Probleme_U derivent :
37 * * Probleme_base pour tous les problemes individuels
38 * * Couplage_U pour les couplages de plusieurs Probleme_U
39 *
40 * Toutes ces classes doivent satisfaire l'API de Problem
41 * completee par celle de Probleme_U.
42 *
43 *
44 */
45class Probleme_U : public Objet_U
46{
47 Declare_base(Probleme_U);
48public :
49
50 // Implementation de l'API de Problem
51
52 virtual void initialize();
53 virtual void terminate();
54 virtual double presentTime() const;
55 virtual double computeTimeStep(bool& stop) const;
56 virtual bool initTimeStep(double dt);
57 virtual bool solveTimeStep();
58 virtual void validateTimeStep();
59 virtual bool isStationary() const;
60 virtual std::string newCompute() { return ""; };
61 virtual void setStationary(bool);
62 virtual void abortTimeStep();
63 virtual void resetTime(double time);
64 virtual bool iterateTimeStep(bool& converged);
65 virtual void getInputFieldsNames(Noms& noms) const;
66 virtual void getInputFieldTemplate(const Nom& name, ICoCo::TrioField& afield) const;
67 virtual void setInputField(const Nom& name, const ICoCo::TrioField& afield);
68 virtual void getOutputFieldsNames(Noms& noms) const;
69 virtual void getOutputField(const Nom& nameField, ICoCo::TrioField& afield) const;
70 virtual void setInputIntValue(const Nom& name, const int& val);
71 virtual int getOutputIntValue(const Nom& name) const;
72 virtual bool checkOutputIntEntry(const Nom& name) const;
73
74 virtual void getOutputPointValues(const Nom& name,
75 const std::vector<double>& x,
76 const std::vector<double>& y,
77 const std::vector<double>& z,
78 std::vector<double>& vals, int compo)
79 {
80 Cerr << "Probleme_U::" << __func__ << " must be overloaded in " << que_suis_je() << finl;
82 }
83
84 double getOutputPointValues(const Nom& name, const double x, const double y, const double z, int compo);
85
86 virtual void setInputDoubleValue(const Nom& name, const double val);
87
88 virtual void setInputStringValue(const std::string& name, const std::string& val) { str_params_[name] = val; }
89 virtual std::string getOutputStringValue(const std::string& name);
90
91 virtual void post_initialize() { }
92
93 // Complements a l'API de Problem
94
95 virtual int postraiter(int force=1);
96 virtual int limpr() const;
97 virtual int lsauv() const;
98 virtual void sauver() const;
99 virtual bool updateGivenFields();
100
101 virtual double futureTime() const;
102 virtual bool run();
103 virtual bool runUntil(double time);
104
105 virtual OBS_PTR(Field_base) findInputField(const Nom& name) const;
106 virtual OBS_PTR(Champ_Generique_base) findOutputField(const Nom& name) const;
107
108 inline void nommer(const Nom& name) override { nom_ = name; }
109 inline const Nom& le_nom() const override { return nom_; }
110
111protected :
114 std::map<std::string, std::string> str_params_;
115
116};
117
118#endif /* Probleme_U_included */
class Champ_Generique_base
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
Un tableau de chaine de caracteres (VECT(Nom)).
Definition Noms.h:26
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
Objet_U()
Constructeur par defaut : attribue un numero d'identifiant unique a l'objet (object_id_),...
Definition Objet_U.cpp:55
classe Probleme_U
Definition Probleme_U.h:46
virtual void sauver() const
Sauvegarder l'etat du probleme sur disque.
virtual int postraiter(int force=1)
Demande au probleme de postraiter ses champs, sondes,.
virtual OBS_PTR(Champ_Generique_base) findOutputField(const Nom &name) const
virtual void getInputFieldsNames(Noms &noms) const
This method is used to find the names of input fields understood by the Problem.
virtual bool initTimeStep(double dt)
This method allocates and initializes the unknown and given fields for the future time step.
virtual std::string newCompute()
Definition Probleme_U.h:60
virtual OBS_PTR(Field_base) findInputField(const Nom &name) const
virtual void validateTimeStep()
Validates the calculated unknown by moving the present time at the end of the time step.
virtual int limpr() const
Doit-on imprimer les statistiques d'execution maintenant ?
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
Definition Probleme_U.h:109
virtual void setInputField(const Nom &name, const ICoCo::TrioField &afield)
virtual bool iterateTimeStep(bool &converged)
In the case solveTimeStep uses an iterative process, this method executes a single iteration.
virtual void setInputDoubleValue(const Nom &name, const double val)
virtual void getOutputPointValues(const Nom &name, const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z, std::vector< double > &vals, int compo)
Definition Probleme_U.h:74
virtual void setInputStringValue(const std::string &name, const std::string &val)
Definition Probleme_U.h:88
virtual void terminate()
This method is called once at the end, after any other one.
virtual void abortTimeStep()
Aborts the resolution of the current time step.
virtual double futureTime() const
Returns the future time (end of current computing interval) This value is valid between initTimeStep ...
virtual bool checkOutputIntEntry(const Nom &name) const
virtual bool runUntil(double time)
This method has the same role as the method run, but it stops when reaching the time given in paramet...
virtual int lsauv() const
Doit-on sauvegarder l'etat du probleme sur disque maintenant ?
virtual bool run()
Cette methode est une sorte de main() du Problem Elle peut etre utilisee si le probleme n'est couple ...
virtual bool solveTimeStep()
pour recodage eventuel et appel unifie en python
void nommer(const Nom &name) override
Donne un nom a l'Objet_U Methode virtuelle a surcharger.
Definition Probleme_U.h:108
virtual std::string getOutputStringValue(const std::string &name)
ScalarRegister reg_
Definition Probleme_U.h:113
virtual bool isStationary() const
Tells if the Problem unknowns have changed during the last time step.
virtual double presentTime() const
Returns the present time.
virtual void setStationary(bool)
Tells to the Problem that stationary is reached or not.
virtual void getOutputFieldsNames(Noms &noms) const
std::map< std::string, std::string > str_params_
Definition Probleme_U.h:114
virtual void setInputIntValue(const Nom &name, const int &val)
virtual int getOutputIntValue(const Nom &name) const
virtual void getOutputField(const Nom &nameField, ICoCo::TrioField &afield) const
virtual void resetTime(double time)
Reset the current time of the Problem to a given value.
virtual void getInputFieldTemplate(const Nom &name, ICoCo::TrioField &afield) const
virtual bool updateGivenFields()
ATTENTION :
virtual void post_initialize()
Definition Probleme_U.h:91
virtual void initialize()
This method is called once at the beginning, before any other one of the interface Problem.
virtual double computeTimeStep(bool &stop) const
Compute the value the Problem would like for the next time step.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
: class ScalarRegister