TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Modele_turbulence_hyd_LES_Smago_VEF.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_hyd_LES_Smago_VEF.h>
17#include <Schema_Temps_base.h>
18#include <Domaine_Cl_VEF.h>
19#include <Domaine_VEF.h>
20#include <Champ_P1NC.h>
21#include <Debog.h>
22#include <Param.h>
23
24Implemente_instanciable(Modele_turbulence_hyd_LES_Smago_VEF, "Modele_turbulence_hyd_sous_maille_Smago_VEF", Modele_turbulence_hyd_LES_VEF_base);
25
26Sortie& Modele_turbulence_hyd_LES_Smago_VEF::printOn(Sortie& s) const { return s << que_suis_je() << " " << le_nom(); }
27
29
31{
33 param.ajouter("cs", &cs_);
34 param.ajouter_condition("value_of_cs_ge_0", "sous_maille_smago model constant must be positive.");
35}
36
38{
39 const Domaine_VEF& domaine_VEF = ref_cast(Domaine_VEF, le_dom_VF_.valeur());
40 const int nb_elem = domaine_VEF.nb_elem();
41 const int nb_elem_tot = domaine_VEF.nb_elem_tot();
42 if (SMA_barre_.size_array()==0)
43 SMA_barre_.resize(nb_elem_tot);
44
46
47 DoubleTab& visco_turb = la_viscosite_turbulente_->valeurs();
48 if (visco_turb.size() != nb_elem)
49 {
50 Cerr << "Size error for the array containing the values of the turbulent viscosity." << finl;
51 exit();
52 }
53
54 //const double cs = cs_;
55 CDoubleArrView l_v = l_.view_ro();
56 CDoubleArrView SMA_barre_v = SMA_barre_.view_ro();
57 DoubleTabView visco_turb_v = visco_turb.view_wo();
58 const double cs = cs_;
59 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), nb_elem, KOKKOS_LAMBDA(
60 const int elem)
61 {
62 visco_turb_v(elem,0) = cs*cs*l_v(elem)*l_v(elem)*sqrt(SMA_barre_v(elem));
63 });
64 end_gpu_timer(__KERNEL_NAME__);
65
66 double temps = mon_equation_->inconnue().temps();
67 la_viscosite_turbulente_->changer_temps(temps);
68 return la_viscosite_turbulente_;
69}
70
72{
73 const Domaine_Cl_VEF& domaine_Cl_VEF = ref_cast(Domaine_Cl_VEF, le_dom_Cl_.valeur());
74 const DoubleTab& la_vitesse = mon_equation_->inconnue().valeurs();
75
76 Champ_P1NC::calcul_S_barre(la_vitesse, SMA_barre_, domaine_Cl_VEF);
77}
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
static DoubleVect & calcul_S_barre(const DoubleTab &, DoubleVect &, const Domaine_Cl_VEF &)
class Domaine_VEF
Definition Domaine_VEF.h:53
int nb_elem_tot() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Class Modele_turbulence_hyd_LES_Smago_VEF.
public_for_cuda Champ_Fonc_base & calculer_viscosite_turbulente() override
Class Modele_turbulence_hyd_LES_VEF_base.
virtual void set_param(Param &) const
Definition Objet_U.h:130
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 const Nom & le_nom() const
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Objet_U.cpp:317
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_condition(const char *condition, const char *message, const char *name=0)
Declare a post-read logical condition that must hold on the parameter values.
Definition Param.cpp:496
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
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
std::enable_if_t< is_default_exec_space< EXEC_SPACE >, View< _TYPE_, _SHAPE_ > > view_wo()
Definition TRUSTTab.h:276
_SIZE_ size() const
Definition TRUSTVect.tpp:45