TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Convection_Diffusion_Espece_Binaire_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_Binaire_base.h>
17#include <Navier_Stokes_Fluide_Dilatable_base.h>
18#include <Fluide_Dilatable_base.h>
19#include <Op_Conv_negligeable.h>
20#include <Discretisation_base.h>
21#include <Probleme_base.h>
22#include <TRUSTTrav.h>
23#include <Perf_counters.h>
24
25Implemente_base(Convection_Diffusion_Espece_Binaire_base,"Convection_Diffusion_Espece_Binaire_base",Convection_Diffusion_Espece_Fluide_Dilatable_base);
26
28{
30}
31
33{
35 terme_convectif.set_fichier("Convection_Espece_Binaire");
36 terme_convectif.set_description((Nom)"Convective flux =Integral(-rho*Y*u*ndS) [kg/s] if SI units used");
37 terme_diffusif.set_fichier("Diffusion_Espece_Binaire");
38 terme_diffusif.set_description((Nom)"Diffusive flux=Integral(rho*D*grad(Y)*ndS) [kg/s] if SI units used");
39
40 // Rename the field here so it can be recognized if a mass fraction probe is requested.
41 if (le_fluide->type_fluide()=="Melange_Binaire") l_inco_ch->nommer("fraction_massique");
42 else
43 {
44 Cerr << "Error in your data file !" << finl;
45 Cerr << "The equation " << que_suis_je() << " should only be used with the EOS Melange_Binaire";
47 }
48 champs_compris_.ajoute_champ(l_inco_ch);
49 return is;
50}
51
56
58{
59 if (mot=="diffusion")
60 {
61 /*
62 * The diffusive term is div(rho*D*grad(Y))
63 * recall that mu_sur_Sc = rho*D and nu_sur_Sc = D
64 */
65
66 Cerr << "Reading and typing of the diffusion operator : " << finl;
67 terme_diffusif.associer_diffusivite(diffusivite_pour_transport());
68 ref_cast_non_const(Champ_base,terme_diffusif.diffusivite()).nommer("mu_sur_Schmidt");
69 is >> terme_diffusif;
70 terme_diffusif.associer_diffusivite_pour_pas_de_temps(diffusivite_pour_pas_de_temps());
71 return 1;
72 }
73 else
75
76}
77
79{
80 return le_fluide->nu_sur_Schmidt(); // D (diffusion coefficient)
81}
82
84{
85 const Navier_Stokes_std& eqn_hydr = ref_cast(Navier_Stokes_std,probleme().equation(0));
86 return eqn_hydr.rho_la_vitesse() /* rho * u and not u */;
87}
88
90{
92 zcl_modif_->les_conditions_limites().set_modifier_val_imp(0);
93 return 1;
94}
95
100
102{
103 derivee=0.;
104 return derivee_en_temps_inco_sans_solveur_masse_impl(*this,derivee,true /* explicit */);
105}
106
107void Convection_Diffusion_Espece_Binaire_base::assembler( Matrice_Morse& matrice,const DoubleTab& inco, DoubleTab& resu)
108{
110}
111
112void Convection_Diffusion_Espece_Binaire_base::assembler_blocs_avec_inertie(matrices_t matrices, DoubleTab& secmem, const tabs_t& semi_impl)
113{
114 statistics().begin_count(STD_COUNTERS::ajouter_blocs,statistics().get_last_opened_counter_level()+1);
115 Convection_Diffusion_Fluide_Dilatable_Proto::assembler_blocs(*this, matrices, secmem, semi_impl);
116 schema_temps().ajouter_blocs(matrices, secmem, *this);
117 if (!discretisation().is_poly_family())
118 {
119 const std::string& nom_inco = inconnue().le_nom().getString();
120 Matrice_Morse *mat = matrices.count(nom_inco) ? matrices.at(nom_inco) : nullptr;
121 modifier_pour_Cl(*mat,secmem);
122 }
123 statistics().end_count(STD_COUNTERS::ajouter_blocs);
124
125}
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
Particular case of Convection_Diffusion_Espece_Fluide_Dilatable_base for an isothermal and isobaric d...
void completer() override
Completes the construction (initialization) of objects associated with the equation.
void assembler_blocs_avec_inertie(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl) override
int preparer_calcul() override
Everything that does not depend on other possible problems.
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
void assembler(Matrice_Morse &mat_morse, const DoubleTab &present, DoubleTab &secmem) override
DoubleTab & derivee_en_temps_inco(DoubleTab &) override
Returns the time derivative of the unknown I of the equation: dI/dt = M-1*(sum(operators(I) + sources...
Particular case of Convection_Diffusion_std for a dilatable fluid when the transported scalar is the ...
int preparer_calcul() override
Everything that does not depend on other possible problems.
DoubleTab & derivee_en_temps_inco_sans_solveur_masse_impl(Convection_Diffusion_Fluide_Dilatable_base &eqn, DoubleTab &derivee, const bool is_expl)
Returns the time derivative of the equation's unknown.
public_for_cuda void assembler_impl(Convection_Diffusion_Fluide_Dilatable_base &eqn, Matrice_Morse &mat_morse, const DoubleTab &present, DoubleTab &secmem)
void assembler_blocs(Convection_Diffusion_Fluide_Dilatable_base &eqn, matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl)
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
const Discretisation_base & discretisation() const
Returns the discretization associated with the equation.
virtual void completer()
Completes the construction (initialization) of objects associated with the equation.
virtual void modifier_pour_Cl(Matrice_Morse &mat_morse, DoubleTab &secmem) const
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.
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
Champs_compris champs_compris_
const Nom & le_nom() const override
Returns the name of the field.
Matrice_Morse class - Represents a (sparse) matrix M, not necessarily square,.
A character string (Nom) in uppercase.
Definition Motcle.h:26
Navier_Stokes_std This class carries the terms of the momentum equation.
virtual const Champ_Inc_base & rho_la_vitesse() const
const std::string & getString() const
Definition Nom.h:92
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
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
virtual void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const Equation_base &eqn, const tabs_t &semi_impl={}) const
Base class for output streams.
Definition Sortie.h:52