TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Pb_Couple_rayo_semi_transp.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 <Source_rayo_semi_transp_base.h>
17#include <Pb_Couple_rayo_semi_transp.h>
18#include <Pb_rayo_semi_transp.h>
19#include <Fluide_base.h>
20
21Implemente_instanciable(Pb_Couple_rayo_semi_transp, "Pb_Couple_rayo_semi_transp", Probleme_Couple);
22
24
26
28{
29 // First thing to do
30 int nb_pb_ray = 0;
31 for (int l = 0; l < nb_problemes(); l++)
32 {
33 Probleme_base& le_pb = ref_cast(Probleme_base, probleme(l));
34
35 if (!sub_type(Pb_rayo_semi_transp, le_pb))
36 if (sub_type(Fluide_base, le_pb.milieu()))
37 if (ref_cast(Fluide_base, le_pb.milieu()).is_rayo_semi_transp())
38 nb_pb_ray++;
39 }
40
41 if (nb_pb_ray > 1)
42 {
43 Cerr << "Pb_Couple_rayo_semi_transp::initialize - We can only treat 1 semi-transparent problem at present. You defined " << nb_pb_ray << " !!!" << finl;
45 }
46 else if (nb_pb_ray == 0)
47 Process::exit("Pb_Couple_rayo_semi_transp::initialize - It seems you forgot to define the radiation properties in your medium !!!\n");
48
49 // associate the fluid problem with the radiation problem
50 for (int l = 0; l < nb_problemes(); l++)
51 {
52 Probleme_base& le_pb = ref_cast(Probleme_base, probleme(l));
53
54 if (!sub_type(Pb_rayo_semi_transp, le_pb))
55 if (sub_type(Fluide_base, le_pb.milieu()))
56 if (ref_cast(Fluide_base, le_pb.milieu()).is_rayo_semi_transp())
57 {
58 pb_rayo_semi_transp_->associer_probleme_fluide(le_pb);
59 break;
60 }
61 }
62
63 pb_rayo_semi_transp_->discretise_longueur_rayo();
64
66 Probleme_base& le_pb = pb_rayo_semi_transp_->probleme_fluide();
67 // Associate the radiation problem with the radiation source terms
68 for (int i = 0; i < le_pb.nombre_d_equations(); i++)
69 {
70 Sources& les_sources = le_pb.equation(i).sources();
71 for (int j = 0; j < les_sources.size(); j++)
72 {
73 Source& la_source = les_sources[j];
74 if (sub_type(Source_rayo_semi_transp_base, la_source.valeur()))
75 {
76 Source_rayo_semi_transp_base& source_rayo = ref_cast(Source_rayo_semi_transp_base, la_source.valeur());
77 Cerr << "Association pb rayo semi transp au terme source rayo" << finl;
78 source_rayo.associer_pb_rayo_semi_transp(pb_rayo_semi_transp_.valeur());
79 }
80 }
81 }
82
83 pb_rayo_semi_transp_->eq_rayo().resoudre(presentTime());
84 pb_rayo_semi_transp_->calculer_flux_radiatif();
85
86 for (int i = 0; i < nb_problemes(); i++)
87 {
88 Probleme_base& pb = ref_cast(Probleme_base, probleme(i));
89 for (int j = 0; j < pb.nombre_d_equations(); j++)
91 }
92}
93
95{
96 if (sub_type(Pb_rayo_semi_transp, ob))
97 {
98 Cerr << "associating the semi-transparent radiation problem with the coupled problem" << finl;
99 if (pb_rayo_semi_transp_)
100 Process::exit("Attention : on ne peut associer qu'un pb de rayonnement a un Pb_Couple_rayo_semi_transp !!! \n");
101
102 pb_rayo_semi_transp_ = ref_cast(Pb_rayo_semi_transp, ob);
103 ajouter(pb_rayo_semi_transp_.valeur());
104
105 return 1;
106 }
107 else
109}
double presentTime() const override
Returns the present time.
const Probleme_U & probleme(int i) const
Definition Couplage_U.h:127
int nb_problemes() const
Definition Couplage_U.h:117
virtual int calculer_coeffs_echange(double temps)
Computes the exchange coefficients for thermally coupled problems.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Sources & sources()
Returns the source terms associated with the equation.
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the discretized boundary condition domain associated with the equation.
Base class for an incompressible fluid and its properties:
Definition Fluide_base.h:36
Base class for TRUST objects (Objet_U).
Definition Objet_U.h:68
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
Coupled problem class for semi-transparent radiation.
int associer_(Objet_U &) override
Associates the Objet_U with another Objet_U. Virtual method to override.
void initialize() override
This method is called once at the beginning, before any other one of the interface Problem.
Semi-transparent radiation problem. Pb_rayo_semi_transp is a Probleme_base with 4 specific features:
Probleme_Couple This is the historical coupling class of TRUST.
void initialize() override
This method is called once at the beginning, before any other one of the interface Problem.
int associer_(Objet_U &) override
Overrides Objet_U::associer_(Objet_U&): associates an object with the coupled problem,...
void ajouter(Probleme_base &)
Adds a problem to the list of coupled problems.
class Probleme_base It is a Probleme_U that is not a coupling.
virtual const Milieu_base & milieu() const
Returns the physical medium associated with the problem (const version).
virtual int nombre_d_equations() const =0
virtual const Equation_base & equation(int) const =0
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
Source_rayo_semi_transp_base Base class of the source term hierarchy for the temperature.
virtual void associer_pb_rayo_semi_transp(Pb_rayo_semi_transp &)
Source Generic class of the source term hierarchy. A Source object can.
Definition Source.h:33
class Sources Sources represents a list of Source objects.
Definition Sources.h:31