TrioCFD 1.9.9_beta
TrioCFD documentation
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 Probleme_U
32 *
33 * This class adds TRUST-specific features to the general
34 * interface defined in the Problem class.
35 *
36 * Derived from Probleme_U:
37 * * Probleme_base for all individual problems
38 * * Couplage_U for couplings of several Probleme_U objects
39 *
40 * All these classes must satisfy the Problem API
41 * extended by the Probleme_U API.
42 *
43 *
44 */
45class Probleme_U : public Objet_U
46{
47 Declare_base(Probleme_U);
48public :
49
50 // Implementation of the Problem API
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 to the Problem API
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: a character string for naming TRUST objects.
Definition Nom.h:31
An array of character strings (VECT(Nom)).
Definition Noms.h:26
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
Definition Objet_U.cpp:54
Probleme_U.
Definition Probleme_U.h:46
virtual void sauver() const
Save the problem state to disk.
virtual int postraiter(int force=1)
Asks the problem to post-process its fields, probes, etc.
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
Should we print the execution statistics now?
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
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
Should we save the problem state to disk now?
virtual bool run()
This method is a sort of main() for the Problem. It can be used if the problem is not coupled with an...
virtual bool solveTimeStep()
For possible re-implementation and unified call from python.
void nommer(const Nom &name) override
Assigns a name to the Objet_U. Virtual method to override.
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()
WARNING:
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)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
: class ScalarRegister