TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Convection_Diffusion_Espece_Multi_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 <Convection_Diffusion_Espece_Multi_base.h>
17#include <Fluide_Dilatable_base.h>
18#include <Probleme_base.h>
19#include <Param.h>
20
21Implemente_base(Convection_Diffusion_Espece_Multi_base,"Convection_Diffusion_Espece_Multi_base",Convection_Diffusion_Espece_Fluide_Dilatable_base);
22
24{
26}
27
29{
32 Nom conv = "Convection_", diff = "Diffusion_";
33 conv += alias_;
34 diff += alias_;
35 terme_convectif.set_fichier(conv);
36 terme_convectif.set_description((Nom)"Convective flux =Integral(-rho*Y*u*ndS) [kg/s] if SI units used");
37 terme_diffusif.set_fichier(diff);
38 terme_diffusif.set_description((Nom)"Diffusive flux=Integral(rho*D*grad(Y)*ndS) [kg/s] if SI units used");
39 l_inco_ch->add_synonymous(alias_);
40 champs_compris_.ajoute_champ(l_inco_ch);
41 return is;
42}
43
49
50// FIXME : TODO : factorize
52{
53 if (mot=="diffusion")
54 {
55 Cerr << "Reading and typing of the diffusion operator : " << finl;
56 // associate mu_sur_Sc in the diffusivity
57 terme_diffusif.associer_diffusivite(diffusivite_pour_transport());
58 ref_cast_non_const(Champ_base,terme_diffusif.diffusivite()).nommer("mu_sur_Schmidt");
59 is >> terme_diffusif;
60 // Must call associer_diffusivite_pour_pas_de_temps
61 terme_diffusif.associer_diffusivite_pour_pas_de_temps(diffusivite_pour_pas_de_temps());
62 return 1;
63 }
64 else
66}
67
68bool Convection_Diffusion_Espece_Multi_base::has_champ(const Motcle& nom, OBS_PTR(Champ_base)& ref_champ) const
69{
71 return true;
72
73 // to be reviewed
74 if (probleme().equation(0).has_champ(nom, ref_champ))
75 return true;
76
77 return false; /* nothing found */
78}
79
81{
83 return true;
84
85 // to be reviewed
86 if (probleme().equation(0).has_champ(nom))
87 return true;
88
89 return false; /* nothing found */
90}
91
93{
94 OBS_PTR(Champ_base) ref_champ;
95
97 return ref_champ;
98
99 // to be reviewed
100 if (probleme().equation(0).has_champ(nom, ref_champ))
101 return ref_champ;
102
103 throw std::runtime_error(std::string("Field ") + nom.getString() + std::string(" not found !"));
104}
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
virtual bool has_champ(const Motcle &nom, OBS_PTR(Champ_base)&ref_champ) const =0
Particular case of Convection_Diffusion_std for a dilatable fluid when the transported scalar is the ...
const Champ_base & diffusivite_pour_pas_de_temps() const override=0
Particular case of Convection_Diffusion_Espece_Fluide_Dilatable_base for a quasi-compressible fluid w...
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
const Champ_base & get_champ(const Motcle &nom) const override
OBS_PTR(Fluide_Dilatable_base) le_fluide
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual void set_param(Param &titi) const override
Probleme_base & probleme()
Returns the problem associated with the equation.
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
Champs_compris champs_compris_
const Nom & le_nom() const override
Returns the name of the field.
A character string (Nom) in uppercase.
Definition Motcle.h:26
const std::string & getString() const
Definition Nom.h:92
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
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
Base class for output streams.
Definition Sortie.h:52