TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Op_Evanescence_Homogene_VDF_Face.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 <Op_Evanescence_Homogene_VDF_Face.h>
17#include <Vitesse_relative_base.h>
18#include <Pb_Multiphase.h>
19
20Implemente_instanciable(Op_Evanescence_Homogene_VDF_Face, "Op_Evanescence_HOMOGENE_VDF_Face", Op_Evanescence_Homogene_Face_base);
21
24
26{
28
29 const Pb_Multiphase& pbm = ref_cast(Pb_Multiphase, equation().probleme());
30 const Vitesse_relative_base* correlation_vd = pbm.has_correlation("vitesse_relative") ? &ref_cast(Vitesse_relative_base, pbm.get_correlation("vitesse_relative")) : nullptr;
31
32 if (correlation_vd && correlation_vd->needs_grad_alpha())
33 {
34 Cerr << "Typing gradient operator useful for the correlation " << correlation_vd->que_suis_je() << finl;
35 const Equation_base& eq_masse = pbm.equation_masse();
36 grad_vdf_faces_.associer_eqn(eq_masse);
37 grad_vdf_faces_.typer();
38 grad_vdf_faces_.l_op_base().associer_eqn(eq_masse);
39 const Domaine_dis_base& zdis = eq_masse.domaine_dis();
40 const Domaine_Cl_dis_base& zcl = eq_masse.domaine_Cl_dis();
41 const Champ_Inc_base& inco = eq_masse.inconnue();
42 grad_vdf_faces_->associer(zdis, zcl, inco);
43 }
44}
45
47{
48 assert (grad_vdf_faces_);
49
50 const Pb_Multiphase& pbm = ref_cast(Pb_Multiphase, equation().probleme());
51 const DoubleTab& alpha = pbm.equation_masse().inconnue().passe();
52 const Domaine_VF& domaine = ref_cast(Domaine_VF, equation().domaine_dis());
53 const DoubleTab& xp = domaine.xp(), &xv = domaine.xv();
54 const DoubleTab& n_f = domaine.face_normales(), &vf_dir = domaine.volumes_entrelaces_dir();
55 const DoubleVect& vf = domaine.volumes_entrelaces(), &fs = domaine.face_surfaces(), &ve = domaine.volumes();
56 const IntTab& f_e = domaine.face_voisins(), &e_f = domaine.elem_faces();
57 const int N = alpha.line_size(), nf_tot = domaine.nb_faces_tot(), D = dimension, ne_tot = domaine.nb_elem_tot(), nf = domaine.nb_faces();
58
59 /* calculaiton of the gradient of alpha at the face */
60 DoubleTrav grad_f_a(nf_tot, N);
61 grad_vdf_faces_->calculer(alpha, grad_f_a);
62
63 DoubleTrav gradAlphaElem(ne_tot, D, N);
64 /* Calcul du grad aux elems */
65 for (int n = 0; n < N; n++)
66 for (int e = 0; e < ne_tot; e++)
67 for (int d = 0; d < D; d++)
68 for (int j = 0 ; j < e_f.dimension(1); j++)
69 {
70 const int f = e_f(e, j);
71
72 if (f < 0 ) continue;
73
74 gradAlphaElem(e, d, n) += (e == f_e(f, 0) ? 1 : -1) * fs(f) * (xv(f, d) - xp(e, d)) / ve(e) * grad_f_a(f, n);
75 }
76
77 /* Calcul du grad vectoriel aux faces */
78 double scalGradElem = 0.;
79 for (int n = 0; n < N; n++)
80 for (int f = 0; f < nf; f++)
81 {
82 for (int c = 0; c < 2; c++)
83 for (int d = 0; d < D; d++)
84 {
85 const int e = f_e(f, c);
86
87 if (e < 0) continue;
88
89 gradAlphaFaces(f, d, n) += vf_dir(f, c) / vf(f) * gradAlphaElem(e, d, n);
90 }
91
92 scalGradElem = 0.;
93 for (int d = 0; d < D; d++)
94 scalGradElem += gradAlphaFaces(f, d, n) * n_f(f, d) / fs(f);
95
96 for (int d = 0; d < D; d++)
97 gradAlphaFaces(f, d, n) += (grad_f_a(f, n) - scalGradElem) * n_f(f, d) / fs(f);
98 }
99}
Classe Champ_Inc_base.
DoubleTab & passe(int i=1) override
Renvoie les valeurs du champs a l'instant t-i.
classe Domaine_Cl_dis_base Les objets Domaine_Cl_dis_base representent les conditions aux limites
class Domaine_VF
Definition Domaine_VF.h:44
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
virtual const Champ_Inc_base & inconnue() const =0
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Renvoie le domaine des conditions aux limite discretisee associee a l'equation.
Domaine_dis_base & domaine_dis()
Renvoie le domaine discretise associe a l'equation.
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
static int dimension
Definition Objet_U.h:99
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
Classe Op_Evanescence_Homogene_Face_base.
void calc_grad_alpha_faces(DoubleTab &) const override
virtual void preparer_calcul()
classe Pb_Multiphase Cette classe represente un probleme de thermohydraulique multiphase de type "3*N...
virtual Equation_base & equation_masse()
int has_correlation(std::string nom_correlation) const
const Correlation_base & get_correlation(std::string nom_correlation) const
Classe de base des flux de sortie.
Definition Sortie.h:52
int line_size() const
Definition TRUSTVect.tpp:67
classe Vitesse_relative_base
virtual bool needs_grad_alpha() const