TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Pb_Fluide_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 <Cond_lim_rayo_milieu_transp.h>
17#include <Pb_Fluide_base.h>
18#include <Fluide_base.h>
19
20Implemente_base(Pb_Fluide_base, "Pb_Fluide_base", Probleme_base);
21
24
26{
27 assert (mot == "Modele_rayonnement_milieu_transparent" || mot == "Transparent_medium_radiation_model");
28
29 // TODO FIXME do better here ...
30 if (!(Motcle(que_suis_je()).debute_par("Pb_HYDRAULIQUE") || Motcle(que_suis_je()).debute_par("Pb_THERMOHYDRAULIQUE") ))
31 {
32 Cerr << "The transparent medium radiation model is not yet tested with a problem of type " << que_suis_je() << finl;
33 Cerr << "Please contact the TRUST team." << finl;
35 }
36
37 // set flag is_rad_transp_med_ in Fluide_base
38 bool flag_set = false;
39 for (auto& itr : le_milieu_)
40 if (sub_type(Fluide_base, itr.valeur()))
41 {
42 ref_cast(Fluide_base, itr.valeur()).set_rayo_transp_flag();
43 flag_set = true;
44 break;
45 }
46
47 if (!flag_set)
48 {
49 Cerr << "Using a transparent medium radiation model with a problem of type " << que_suis_je() << " that dont have a fluid medium is forbidden !!!" << finl;
51 }
52
53 // if ok, type and read!
54 mod_rayo_transp_.typer(mot.getChar());
55 is >> mod_rayo_transp_.valeur();
56 mod_rayo_transp_->associer_pb_fluide_rayo(*this);
57
58 return is;
59}
60
62{
64
65 if (mod_rayo_transp_)
66 mod_rayo_transp_->completer();
67}
68
70{
71 int ok = Probleme_base::postraiter(force);
72
73 if (!ok)
74 return 0;
75
76 if (mod_rayo_transp_)
77 mod_rayo_transp_->postraiter();
78
79 return ok;
80}
81
83{
85
86 if (mod_rayo_transp_)
87 mod_rayo_transp_->mettre_a_jour(presentTime());
88}
89
90int Pb_Fluide_base::expression_predefini(const Motcle& motlu, Nom& expression)
91{
92 if (motlu=="ENERGIE_CINETIQUE_TOTALE")
93 {
94 expression = "predefini { pb_champ ";
95 expression += le_nom();
96 expression += " energie_cinetique_totale } ";
97 return 1;
98 }
99 else if (motlu=="ENERGIE_CINETIQUE_ELEM")
100 {
101 expression = "predefini { pb_champ ";
102 expression += le_nom();
103 expression += " energie_cinetique_elem } ";
104 return 1;
105 }
106 else if (motlu=="VISCOUS_FORCE_X")
107 {
108 expression = "predefini { pb_champ ";
109 expression += le_nom();
110 expression += " viscous_force_X } ";
111 return 1;
112 }
113 else if (motlu=="VISCOUS_FORCE_Y")
114 {
115 expression = "predefini { pb_champ ";
116 expression += le_nom();
117 expression += " viscous_force_y } ";
118 return 1;
119 }
120 else if (motlu=="VISCOUS_FORCE_Z")
121 {
122 expression = "predefini { pb_champ ";
123 expression += le_nom();
124 expression += " viscous_force_z } ";
125 return 1;
126 }
127 else if (motlu=="VISCOUS_FORCE")
128 {
129 expression = "predefini { pb_champ ";
130 expression += le_nom();
131 expression += " viscous_force } ";
132 return 1;
133 }
134 else if (motlu=="PRESSURE_FORCE_X")
135 {
136 expression = "predefini { pb_champ ";
137 expression += le_nom();
138 expression += " pressure_force_x } ";
139 return 1;
140 }
141 else if (motlu=="PRESSURE_FORCE_Y")
142 {
143 expression = "predefini { pb_champ ";
144 expression += le_nom();
145 expression += " pressure_force_y } ";
146 return 1;
147 }
148 else if (motlu=="PRESSURE_FORCE_Z")
149 {
150 expression = "predefini { pb_champ ";
151 expression += le_nom();
152 expression += " pressure_force_z } ";
153 return 1;
154 }
155 else if (motlu=="PRESSURE_FORCE")
156 {
157 expression = "predefini { pb_champ ";
158 expression += le_nom();
159 expression += " pressure_force } ";
160 return 1;
161 }
162 else if (motlu=="TOTAL_FORCE_X")
163 {
164 expression = "predefini { pb_champ ";
165 expression += le_nom();
166 expression += " total_force_x } ";
167 return 1;
168 }
169 else if (motlu=="TOTAL_FORCE_Y")
170 {
171 expression = "predefini { pb_champ ";
172 expression += le_nom();
173 expression += " total_force_y } ";
174 return 1;
175 }
176 else if (motlu=="TOTAL_FORCE_Z")
177 {
178 expression = "predefini { pb_champ ";
179 expression += le_nom();
180 expression += " total_force_z } ";
181 return 1;
182 }
183 else if (motlu=="TOTAL_FORCE")
184 {
185 expression = "predefini { pb_champ ";
186 expression += le_nom();
187 expression += " total_force } ";
188 return 1;
189 }
190 else
191 return Probleme_base::expression_predefini(motlu,expression);
192}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Base class for an incompressible fluid and its properties:
Definition Fluide_base.h:36
A character string (Nom) in uppercase.
Definition Motcle.h:26
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
const char * getChar() const
Definition Nom.h:91
friend class Entree
Definition Objet_U.h:71
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
Pb_Fluide_base This class provides a base class for.
void validateTimeStep() override
Validates the calculated unknown by moving the present time at the end of the time step.
int postraiter(int force=1) override
Asks the problem to post-process its fields, probes, etc.
int expression_predefini(const Motcle &motlu, Nom &expression) override
void completer() override
Completes the equations associated with the problem.
Entree & lire_radiation_models(Entree &is, Motcle &mot) override final
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.
double presentTime() const override
Returns the present time.
int postraiter(int force=1) override
If force=1, performs post-processing regardless of the post-processing frequencies.
std::vector< OWN_PTR(Milieu_base)> le_milieu_
virtual void completer()
Completes the equations associated with the problem.
virtual int expression_predefini(const Motcle &motlu, Nom &expression)
void validateTimeStep() override
Validates the calculated unknown by moving the present time at the end of the time step.
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