TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Op_Dift_EF_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 <Modele_turbulence_scal_base.h>
17#include <Navier_Stokes_std.h>
18#include <Op_Dift_EF_base.h>
19
20Implemente_base_sans_constructeur(Op_Dift_EF_base,"Op_Dift_EF_base",Op_Diff_EF_base);
21
22Op_Dift_EF_base::Op_Dift_EF_base()
23{
25}
26
28{
29 return Op_Diff_EF_base::printOn(is);
30}
31
33{
35 return is;
36}
37
39{
40 le_modele_turbulence = mod;
41}
42
44{
45 if (sub_type(Navier_Stokes_std,equation())) // handling the hydraulics
46 {
47 if ( le_modele_turbulence->utiliser_loi_paroi())
48 {
49 // Modif BM: only take the ref if the array has been initialized, otherwise it blocks
50 // the initialization
51 const DoubleTab& tab = le_modele_turbulence->loi_paroi().Cisaillement_paroi();
52 if (tab.size_array() > 0)
53 tau_tan_.ref(tab);
54 }
55 }
56}
57
59{
62
63 const RefObjU& modele_turbulence = equation().get_modele(TURBULENCE);
64 if (modele_turbulence && sub_type(Modele_turbulence_hyd_base,modele_turbulence.valeur()))
65 {
66 const Modele_turbulence_hyd_base& mod_turb = ref_cast(Modele_turbulence_hyd_base,modele_turbulence.valeur());
67 const Champ_Fonc_base& viscosite_turbulente = mod_turb.viscosite_turbulente();
68 associer_diffusivite_turbulente(viscosite_turbulente);
70 }
71 else if (sub_type(Modele_turbulence_scal_base,modele_turbulence.valeur()))
72 {
73 const Modele_turbulence_scal_base& modele_turbulence_scalaire = ref_cast(Modele_turbulence_scal_base,modele_turbulence.valeur());
74 const Champ_Fonc_base& conductivite_turbulente = modele_turbulence_scalaire.conductivite_turbulente();
75 associer_diffusivite_turbulente(conductivite_turbulente);
76 }
77 else
78 {
79 Cerr << "Error in Op_Dift_EF::completer() " << finl;
80 Cerr << que_suis_je() <<" operator is presently associated to "<<equation().que_suis_je()<<finl;
81 Cerr << "instead of being associated to an equation dedicated to a turbulent flow."<<finl;
82 exit();
83 }
84}
85
86void Op_Dift_EF_base::calculer_borne_locale(DoubleVect& borne_visco_turb, double dt_conv, double dt_diff_sur_dt_conv) const
87{
88 const Domaine_EF& le_dom_ef = le_dom_EF.valeur();
89 int nb_elem = le_dom_ef.nb_elem();
90 int flag = diffusivite().valeurs().dimension(0)>1 ? 1 : 0;
91 for (int elem=0; elem<nb_elem; elem++)
92 {
93 double h_inv = 1./le_dom_ef.carre_pas_maille(elem);
94 // Not very clean to retrieve diffu this way, but it avoids coding this method in several classes:
95 double diffu = (flag ? diffusivite().valeurs()(elem) : diffusivite().valeurs()(0,0));
96 //
97 double coef = 1./(2*(dt_conv+DMINFLOAT)*dimension*h_inv*dt_diff_sur_dt_conv) - diffu;
98 if (coef>0 && coef<borne_visco_turb(elem))
99 borne_visco_turb(elem) = coef;
100 }
101}
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
virtual DoubleTab & valeurs()=0
class Domaine_EF
Definition Domaine_EF.h:56
double carre_pas_maille(int i) const
Definition Domaine_EF.h:70
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual const RefObjU & get_modele(Type_modele type) const
Base class for the turbulence model hierarchy for Navier-Stokes equations.
const Champ_Fonc_base & viscosite_turbulente() const
Base class for scalar turbulence models coupled to a Navier-Stokes convection-diffusion equation.
const Champ_Fonc_base & conductivite_turbulente() const
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
Navier_Stokes_std This class carries the terms of the momentum equation.
static int dimension
Definition Objet_U.h:94
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
class Op_Diff_EF_base Base class for EF diffusion operators.
void associer_diffusivite_turbulente(const Champ_Fonc_base &)
void mettre_a_jour(double temps) override
DOES NOTHING - to override in derived classes.
void calculer_borne_locale(DoubleVect &, double, double) const override
void associer_modele_turbulence(const Modele_turbulence_hyd_base &)
void completer() override
Associates the operator with the domaine_dis, the domaine_Cl_dis, and the unknown of its equation.
void marque_elem(const Equation_base &eqn)
virtual const Champ_base & diffusivite() const =0
virtual void completer()
Associates the operator with the domaine_dis, the domaine_Cl_dis, and the unknown of its equation.
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
virtual void declare_support_masse_volumique(int ok)
The constructor of a derived class that uses the density field must call this function with the value...
_SIZE_ size_array() const
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
const Objet_U & valeur() const
Definition TRUST_Ref.h:134