TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Paroi_hyd_base_EF.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_base.h>
17#include <Dirichlet_paroi_defilante.h>
18#include <Dirichlet_paroi_fixe.h>
19#include <Discretisation_base.h>
20#include <Domaine_Cl_dis_base.h>
21#include <Paroi_hyd_base_EF.h>
22#include <Schema_Temps_base.h>
23#include <EcrFicPartage.h>
24#include <Probleme_base.h>
25#include <Equation_base.h>
26#include <TRUSTTrav.h>
27#include <Scatter.h>
28
29Implemente_base(Paroi_hyd_base_EF, "Paroi_hyd_base_EF", Turbulence_paroi_base);
30
31Sortie& Paroi_hyd_base_EF::printOn(Sortie& s) const { return s << que_suis_je() << " " << le_nom(); }
32
34
36{
37 if (motlu == "u_star" && !champ_u_star_)
38 {
39 int nb_comp = 1;
40 Noms noms(1);
41 noms[0] = "u_star";
42 Noms unites(1);
43 unites[0] = "m/s";
44 double temps = 0.;
45 const Equation_base& equation = mon_modele_turb_hyd->equation();
46 const Discretisation_base& discr = equation.probleme().discretisation();
47 discr.discretiser_champ("champ_elem", equation.domaine_dis(), scalaire, noms, unites, nb_comp, temps, champ_u_star_);
48 champs_compris_.ajoute_champ(champ_u_star_);
49 }
50}
51
52bool Paroi_hyd_base_EF::has_champ(const Motcle& nom, OBS_PTR(Champ_base) &ref_champ) const
53{
54 if (champ_u_star_ && (nom == champ_u_star_->le_nom()))
55 {
56 ref_champ = Paroi_hyd_base_EF::get_champ(nom);
57 return true;
58 }
59 else if (champs_compris_.has_champ(nom, ref_champ))
60 return true;
61 else
62 return false;
63}
64
66{
67 if (champ_u_star_ && (nom == champ_u_star_->le_nom()))
68 return true;
69 return champs_compris_.has_champ(nom);
70}
71
73{
74 const Domaine_EF& domaine_EF = ref_cast(Domaine_EF, le_dom_dis_.valeur());
75 const IntTab& face_voisins = domaine_EF.face_voisins();
76 if (champ_u_star_ && (nom == champ_u_star_->le_nom()))
77 {
78 // Initialize the volumetric u_star field to 0
79 DoubleTab& valeurs = champ_u_star_->valeurs();
80 valeurs = 0;
81 const Equation_base& my_eqn = mon_modele_turb_hyd->equation();
82 if (tab_u_star_.size_array() > 0)
83 {
84 // Loop over boundaries to retrieve u_star if tab_u_star is sized
85 int nb_front = my_eqn.domaine_dis().nb_front_Cl();
86 for (int n_bord = 0; n_bord < nb_front; n_bord++)
87 {
88 const Cond_lim& la_cl = my_eqn.domaine_Cl_dis().les_conditions_limites(n_bord);
89 if (sub_type(Dirichlet_paroi_fixe, la_cl.valeur()))
90 {
91 const Front_VF& le_bord = ref_cast(Front_VF, la_cl->frontiere_dis());
92 int ndeb = le_bord.num_premiere_face();
93 int nfin = ndeb + le_bord.nb_faces();
94 for (int num_face = ndeb; num_face < nfin; num_face++)
95 {
96 int elem = face_voisins(num_face, 0);
97 valeurs(elem) = tab_u_star_(num_face);
98 }
99 }
100 }
101 }
102 valeurs.echange_espace_virtuel();
103 // Update the field time:
104 champ_u_star_->mettre_a_jour(my_eqn.schema_temps().temps_courant());
105 return champs_compris_.get_champ(nom);
106 }
107 else
108 return champs_compris_.get_champ(nom);
109}
110
115
116void Paroi_hyd_base_EF::associer(const Domaine_dis_base& domaine_dis, const Domaine_Cl_dis_base& domaine_Cl_dis)
117{
118 le_dom_dis_ = ref_cast(Domaine_VF, domaine_dis);
119 le_dom_Cl_dis_ = domaine_Cl_dis;
120}
121
123{
124 const Domaine_VF& zvf = le_dom_dis_.valeur();
125 const int nb_faces_bord = le_dom_dis_->nb_faces_bord();
126 tab_u_star_.resize(nb_faces_bord);
127 tab_d_plus_.resize(nb_faces_bord);
128 if (!Cisaillement_paroi_.get_md_vector())
129 {
132 }
133}
134
135DoubleTab& Paroi_hyd_base_EF::corriger_derivee_impl(DoubleTab& d) const
136{
138 {
139 int size = d.dimension_tot(0);
140 assert(size == face_keps_imposee_.size_array());
141 for (int face = 0; face < size; face++)
142 {
143 if (face_keps_imposee_(face) != -2)
144 {
145 d(face, 0) = 0;
146 d(face, 1) = 0;
147 }
148 }
149 }
150 return d;
151}
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
class Cond_lim Generic class used to represent any class
Definition Cond_lim.h:31
Dirichlet_paroi_fixe Represents a fixed wall in a Navier-Stokes type equation.
class Discretisation_base This class represents a spatial discretization scheme, which
void discretiser_champ(const Motcle &directive, const Domaine_dis_base &z, const Nom &nom, const Nom &unite, int nb_comp, int nb_pas_dt, double temps, OWN_PTR(Champ_Inc_base)&champ, const Nom &sous_type=NOM_VIDE) const
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
class Domaine_EF
Definition Domaine_EF.h:56
class Domaine_VF
Definition Domaine_VF.h:44
void creer_tableau_faces_bord(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
Definition Domaine_VF.h:418
int nb_faces_bord() const
Returns the number of faces on which boundary conditions are applied:
Definition Domaine_VF.h:512
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
int nb_front_Cl() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Equation_base The role of an equation is the calculation of one or more fields....
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the discretized boundary condition domain associated with the equation.
Probleme_base & probleme()
Returns the problem associated with the equation.
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
class Front_VF
Definition Front_VF.h:36
int nb_faces() const
Definition Front_VF.h:53
int num_premiere_face() const
Definition Front_VF.h:63
A character string (Nom) in uppercase.
Definition Motcle.h:26
const Nom & le_nom() const override
Returns *this.
Definition Nom.cpp:555
An array of character strings (VECT(Nom)).
Definition Noms.h:26
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 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
CLASS: Paroi_hyd_base_EF Base class for hydraulic wall laws in the EF discretization.
void associer(const Domaine_dis_base &, const Domaine_Cl_dis_base &) override
DoubleTab & corriger_derivee_impl(DoubleTab &d) const override
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
const Champ_base & get_champ(const Motcle &nom) const override
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
void creer_champ(const Motcle &motlu) override
const Discretisation_base & discretisation() const
Returns the discretization associated with the problem.
double temps_courant() const
Returns the current time.
Base class for output streams.
Definition Sortie.h:52
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")
Base class for the hierarchy of wall-law models computing turbulent quantities near walls....
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
OBS_PTR(Modele_turbulence_hyd_base) mon_modele_turb_hyd