TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Transport_turbulent_SGDH.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 <Transport_turbulent_SGDH.h>
17#include <Param.h>
18#include <Probleme_base.h>
19
20#include <Pb_Multiphase.h>
21#include <TRUSTTrav.h>
22
23Implemente_instanciable(Transport_turbulent_SGDH, "Transport_turbulent_SGDH|Transport_turbulent_isotrope", Transport_turbulent_base);
24// XD type_diffusion_turbulente_multiphase_SGDH type_diffusion_turbulente_multiphase_deriv SGDH BRACE not_set
25
27{
28 return os;
29}
30
32{
33 Param param(que_suis_je());
34 double Pr_t = -1;
35 param.ajouter("Pr_t|Prandtl_turbulent|Schmitt_turbulent", &Pr_t); // XD attr Pr_t floattant Prandtl_turbulent OPT
36 // XD_CONT not_set
37 param.ajouter("sigma|sigma_turbulent", &sigma_); // XD_ADD_P floattant
38 // XD_CONT not_set
39 param.ajouter("no_alpha", &no_alpha_); // XD_ADD_P flag
40 // XD_CONT not_set
41 param.ajouter("gas_turb", &gas_turb_); // XD_ADD_P flag
42 // XD_CONT not_set
43 param.lire_avec_accolades_depuis(is);
44 if (Pr_t > 0 && sigma_ != 1) Process::exit(que_suis_je() + ": cannot specify both Pr_t and sigma!");
45 if (Pr_t > 0) sigma_ = 1. / Pr_t;
46 return is;
47}
48
49// Modifier_nu modifies mu: alpha and rho are part of the term
51{
52 const DoubleTab& mu0 = eq.diffusivite_pour_transport().passe(),
53 &nu0 = eq.diffusivite_pour_pas_de_temps().passe(), //molecular viscosities
54 *alp = (sub_type(Pb_Multiphase, pb_.valeur()) && !no_alpha_) ? &pb_->get_champ("alpha").passe() : nullptr; //multiplied by alpha if Pb_Multiphase
55 const int cnu = nu0.dimension(0) == 1, cmu = mu0.dimension(0) == 1;
56 int i, nl = nu.dimension(0), n, N = nu.dimension(1), d, D = dimension;
57 //turbulent kinematic viscosity
58 DoubleTrav nu_t(nl, N);
59 visc_turb.eddy_viscosity(nu_t);
60 //formula to convert nu to mu: mu0 * sigma_ * nu_t / nu0
61 if (nu.nb_dim() == 2)
62 for (i = 0; i < nl; i++)
63 {
64 for (n = 0; n < 1; n++) //isotrope
65 nu(i, n) += (alp ? (*alp)(i, n) : 1) * mu0(!cmu * i, n) * sigma_ * nu_t(i, n) / nu0(!cnu * i, n);
66 if (gas_turb_)
67 for (n = 1; n < N; n++) //isotrope
68 nu(i, n) += (alp ? (*alp)(i, n) : 1) * mu0(!cmu * i, n) * sigma_ / nu0(!cnu * i, n) * nu_t(i, 0.) * std::min((*alp)(i,n)*10, 1.) ;
69 }
70 else if (nu.nb_dim() == 3)
71 for (i = 0; i < nl; i++)
72 for (n = 0; n < N; n++)
73 for (d = 0; d < D; d++) //anisotrope diagonal
74 nu(i, n, d) += (alp ? (*alp)(i, n) : 1) * mu0(!cmu * i, n) * sigma_ * nu_t(i, n) / nu0(!cnu * i, n);
75 else for (i = 0; i < nl; i++)
76 for (n = 0; n < N; n++)
77 for (d = 0; d < D; d++) //anisotrope complet
78 nu(i, n, d, d) += (alp ? (*alp)(i, n) : 1) * mu0(!cmu * i, n) * sigma_ * nu_t(i, n) / nu0(!cnu * i, n);
79}
virtual DoubleTab & passe(int i=1)
Definition Champ_Proto.h:50
Convection_Diffusion_std This class is the base for equations modelling the transport.
virtual const Champ_Don_base & diffusivite_pour_transport() const
virtual const Champ_base & diffusivite_pour_pas_de_temps() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
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
Multiphase thermohydraulics problem of type "3*N equations":
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
int nb_dim() const
Definition TRUSTTab.h:199
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
Simple Gradient Diffusion Hypothesis (SGDH) turbulent transport model:
void modifier_mu(const Convection_Diffusion_std &eq, const Viscosite_turbulente_base &visc_turb, DoubleTab &nu) const override
Correlations describing the effect of turbulence in another equation (thermal, turbulent quantities,...
Turbulent viscosity correlations describing the Reynolds stress tensor R_{ij} = - <u'_i u'_j>.
virtual void eddy_viscosity(DoubleTab &nu_t) const =0